Commit Graph

41 Commits

Author SHA1 Message Date
Pulkit Goyal
123aebf3ce keepalive: switch from thread to threading module
The thread module in py3 is renamed to _thread, but we can use
 the high level threading module instead.
2016-07-01 19:17:16 +05:30
Pulkit Goyal
af9d7f66d0 py3: conditionalize httplib import
The httplib library is renamed to http.client in python 3. So the
import is conditionalized and a test is added in check-code to warn
to use util.httplib
2016-06-28 16:01:53 +05:30
Augie Fackler
ad67b99d20 cleanup: replace uses of util.(md5|sha1|sha256|sha512) with hashlib.\1
All versions of Python we support or hope to support make the hash
functions available in the same way under the same name, so we may as
well drop the util forwards.
2016-06-10 00:12:33 -04:00
timeless
109fcbc79e pycompat: switch to util.urlreq/util.urlerr for py3 compat 2016-04-06 23:22:12 +00:00
Gregory Szorc
2ef42b9dfb keepalive: remove useless parentheses around exception type 2016-02-28 00:00:13 -08:00
Gregory Szorc
73c33b60d4 keepalive: use print function 2015-06-21 23:14:54 -07:00
Gregory Szorc
ccd1a37a31 keepalive: use absolute_import 2015-12-22 16:28:28 -08:00
Gregory Szorc
5380dea2a7 global: mass rewrite to use modern exception syntax
Python 2.6 introduced the "except type as instance" syntax, replacing
the "except type, instance" syntax that came before. Python 3 dropped
support for the latter syntax. Since we no longer support Python 2.4 or
2.5, we have no need to continue supporting the "except type, instance".

This patch mass rewrites the exception syntax to be Python 2.6+ and
Python 3 compatible.

This patch was produced by running `2to3 -f except -w -n .`.
2015-06-23 22:20:08 -07:00
Mike Hommey
9741dad0cc util: move md5 back next to sha1 and allow to call it without an argument
This effectively backs out changeset 7582042d6cce.

The API change is done so that both util.sha1 and util.md5 can be called the
same way. The function is moved in order to use it for md5 checksumming for
an upcoming bundle2 feature.
2014-09-24 16:00:47 +09:00
Mike Hommey
d177b1d78f keepalive: fix how md5 is used
The code in keepalive dates from when it was importing the md5 module directly
and uses md5.new. Since then, what 'md5' means has been changed from an import
of the md5 module to being a function using the right module between hashlib
and md5, so the md5.new idiom doesn't work anymore.
2014-09-24 15:52:40 +09:00
Mads Kiilerich
1e900bb145 check-code: check for spaces around = for named parameters 2013-10-03 14:50:47 +02:00
Bryan O'Sullivan
e6925c17ab keepalive: drop python 2.2 legacy code 2012-10-02 14:27:13 -07:00
Mads Kiilerich
2f4504e446 fix trivial spelling errors 2012-08-15 22:38:42 +02:00
Mads Kiilerich
377db36818 help: fix some instances of 'the the' 2012-07-26 02:54:13 +02:00
Brodie Rao
7f47d4e347 check-code: ignore naked excepts with a "re-raise" comment
This also promotes the naked except check from a warning to an error.
2012-05-13 13:18:06 +02:00
Brodie Rao
c577fac135 cleanup: replace naked excepts with more specific ones 2012-05-12 16:02:45 +02:00
Brodie Rao
92158e04de cleanup: "raise SomeException()" -> "raise SomeException" 2012-05-12 16:00:58 +02:00
Brodie Rao
a7ef0a0cc5 cleanup: "not x in y" -> "x not in y" 2012-05-12 16:00:57 +02:00
Martin Geisler
d8334151e6 Remove FSF mailing address from GPL headers
The GPLv3 FAQ suggests to upgrade by

  [...] replace all your existing v2 license notices (usually at the
  top of each file) with the new recommended text available on the GNU
  licenses howto. It's more future-proof because it no longer includes
  the FSF's postal mailing address.

This removes the postal address, but leaves the version number at 2+.
2012-01-06 16:27:13 +01:00
Augie Fackler
c47e760250 keepalive: use safehasattr instead of hasattr 2011-07-25 20:36:59 -05:00
Thomas Arendsen Hein
692a53d202 classes: fix class style problems found by 06e968819ac9
This makes test-wireprotocol.py work on Python 2.4
2011-06-29 15:00:00 +02:00
Martin Geisler
af8a35e078 check-code: flag 0/1 used as constant Boolean expression 2011-06-01 12:38:46 +02:00
Benoit Boissinot
328394047f fix coding style (reported by pylint) 2010-02-08 15:36:34 +01:00
Matt Mackall
8d99be19f0 many, many trivial check-code fixups 2010-01-25 00:05:27 -06:00
Augie Fackler
c66ce37035 keepalive: handle broken pipes gracefully during large POSTs 2009-11-02 11:03:22 -05:00
Martin Geisler
6533e94352 util: remove md5
This hash function is broken and should not be used by new code. It is
currently only used by keepalive.
2009-05-04 21:30:39 +02:00
Patrick Mezard
af0fa1531e keepalive: fix a82d2fe41c70, reintroduce unredirected_hdrs
The previous fix dropped unredirected_hdrs which contain authentication
headers. Removing them break POST request requiring authentication (like
unbundle calls to bitbucket.org).
2009-04-27 22:15:36 +02:00
Matt Mackall
72994b59d3 keepalive: attempt to fix issue1003
This is a reimport of the relevant piece of the upstream urlgrabber,
which appears to be more correct.
2009-04-23 15:40:10 -05:00
Peter Arrenbrecht
19591b6a8c cleanup: drop unused assignments 2009-03-23 13:13:06 +01:00
Peter Arrenbrecht
a2d3e23eef cleanup: drop variables for unused return values
They are unnecessary. I did leave them in localrepo.py where there is
something like:

  _junk = foo()
  _junk = None

to free memory early. I don't know if just `foo()` will free the return
value as early.
2009-03-23 13:13:02 +01:00
Peter Arrenbrecht
b1f5d67640 keepalive: fix reference to IncompleteRead 2009-03-23 11:12:01 +01:00
Matt Mackall
b649059d2b keepalive: borrow code from newer httplib to patch ValueError (issue1088) 2009-02-16 17:37:23 -06:00
Dirkjan Ochtman
574603a8c0 use dict.iteritems() rather than dict.items()
This should be faster and more future-proof. Calls where the result is to be
sorted using util.sort() have been left unchanged. Calls to .items() on
configparser objects have been left as-is, too.
2009-01-12 09:16:03 +01:00
Dirkjan Ochtman
34d6bea8db python 2.6 compatibility: compatibility wrappers for hash functions 2008-04-04 22:36:40 +02:00
Alexis S. L. Carvalho
961a45df72 merge with crew-stable 2008-02-03 21:47:07 -02:00
Alexis S. L. Carvalho
f636dc58cf httprepo: use separate handlers for HTTP and HTTPS
This is needed to keep the code in keepalive.py from sharing
the same connection between HTTP and HTTPS.

cd1a6ad30c82 explains why we were using a single handler.

This should fix issue892.
2008-02-03 21:03:46 -02:00
Christian Ebert
5c18a69d2e Prefer i in d over d.has_key(i) 2008-01-20 14:39:25 +01:00
Benoit Boissinot
7616bbdf28 fix for digest auth when using keepalive.py
The problem was with python > 2.3 which stores part of the
headers in unredirected_hdrs.
Furthermore, we simplify the code to use httplib directly.

fix issue473
2007-01-08 16:18:29 +01:00
Vadim Gelfer
e0b0ae3431 clean up trailing white space. 2006-07-12 08:28:00 -07:00
Alexis S. L. Carvalho
30e9b6e2d4 Update keepalive.py to current CVS version of urlgrabber.
This fixes a bug where the output of test-bad-pull would differ
between python 2.3 and 2.4.  Also update the expected output of
this test.
2006-06-16 10:00:37 -03:00
Vadim Gelfer
d71b1891cb http client: support persistent connections.
uses keepalive module from urlgrabber package.  tested against "hg serve",
cgi server, and through http proxy.  used ethereal to verify that only
one tcp connection used during entire "hg pull" sequence.

if server supports keepalive, this makes latency of "hg pull" much lower.
2006-06-15 12:57:59 -07:00