Commit Graph

13 Commits

Author SHA1 Message Date
Matt Mackall
22317edb2f httpclient: fix calling convention violation 2012-10-18 23:55:15 -05:00
Augie Fackler
05dca2a258 http2: make it possible to connect w/o ssl on port 443
The fix is just to make sure we always pass use_ssl=False to non-SSL
connections.
2012-10-16 18:05:33 -05:00
Mads Kiilerich
5e3dc3e383 avoid using abbreviations that look like spelling errors 2012-08-27 23:14:27 +02:00
Martin Geisler
ba8731035e Use explicit integer division
Found by running the test suite with the -3 flag to show places where
we have int / int division that can be replaced with int // int.
2012-01-08 18:15:54 +01:00
Matt Mackall
9dea83bdb8 auth: fix realm handling with Python < 2.4.3 (issue2739) 2011-10-17 13:42:42 -05:00
Mads Kiilerich
35dbb9abb2 http: handle push of bundles > 2 GB again (issue3017)
It was very elegant that httpsendfile implemented __len__ like a string. It was
however also dangerous because that protocol can't handle sizes bigger than 2 GB.
Mercurial tried to work around that, but it turned out to be too easy to
introduce new errors in this area.

With this change __len__ is no longer implemented at all and the code will work
the same way for short and long posts.
2011-09-21 22:52:00 +02:00
Patrick Mezard
107949ab73 http: pass user to readauthforuri() (fix f7ae45a69fcd)
urllib2 never handles URIs with credentials, we have to extract them and store
them in the password manager before handing the stripped URI. Half of the
changes deducing the username from the URI in f7ae45a69fcd were incorrect.
Instead, we retrieve the username from the password manager before passing to
readauthforuri().

test-hgweb-auth.py was passing because the test itself was flawed: it was
passing URIs with credentials to find_password(), which never happens.
2011-08-05 21:05:41 +02:00
Patrick Mezard
8028e79c02 hgweb: do not ignore [auth] if url has a username (issue2822)
The [auth] section was ignored when handling URLs like:

  http://user@example.com/foo

Instead, we look in [auth] for an entry matching the URL and supplied user
name. Entries without username can match URL with a username. Prefix length
ties are resolved in favor of entries matching the username. With:

  foo.prefix = http://example.org
  foo.username = user
  foo.password = password
  bar.prefix = http://example.org/bar

and the input URL:

  http://user@example.org/bar

the 'bar' entry will be selected because of prefix length, therefore prompting
for a password. This behaviour ensure that entries selection is consistent when
looking for credentials or for certificates, and that certificates can be
picked even if their entries do no define usernames while the URL does.
Additionally, entries without a username matched against a username are
returned as if they did have requested username set to avoid prompting again
for a username if the password is not set.

v2: reparse the URL in readauthforuri() to handle HTTP and HTTPS similarly.
v3: allow unset usernames to match URL usernames to pick certificates. Resolve
prefix length ties in favor of entries with usernames.
2011-08-01 23:58:50 +02:00
Matt Mackall
a8dec32fed httprepo: handle large lengths by bypassing the len() operator 2011-05-24 17:30:00 -05:00
Augie Fackler
640a6e5b0b httpconnection: improved logging formatting
I had to use this debugging output for the first time recently when
looking for a problem, and the lack of good formatting made things
difficult.
2011-05-16 16:59:45 -05:00
Augie Fackler
d61478c8ef httpconnection: correctly handle redirects from http to https
Previously the connection cache for keepalives didn't keep track of
ssl. This meant that when we connected to an https server after that
same server via http, both on the default port, we'd incorrectly reuse
the non-https connection as the default port meant the connection
cache key was the same.
2011-05-16 16:59:45 -05:00
Augie Fackler
93b91bd721 httpconnection: fix debug logging option for httpclient 2011-05-11 08:07:51 -05:00
Augie Fackler
33ebd50b83 url: use new http support if requested by the user
The new http library is wired in via an extra module
(httpconnection.py), as it requires similar but different plumbing to
connect the library to Mercurial's internals and urllib2. Eventualy we
should be able to remove all of keepalive.py and its associated tangle
in url.py and replace it all with the code in httpconnection.py.

To use the new library, set 'ui.usehttp2' to true. The underlying http
library uses the logging module liberally, so if things break you can
use 'ui.http2debuglevel' to set the log level to INFO or DEBUG to get
that logging information (for example, ui.http2debuglevel=info.)
2011-05-06 10:22:08 -05:00