Mercurial > hg
diff mercurial/keepalive.py @ 8296:908c5906091b
util: remove md5
This hash function is broken and should not be used by new code. It is
currently only used by keepalive.
author | Martin Geisler <mg@lazybytes.net> |
---|---|
date | Mon, 04 May 2009 21:30:39 +0200 |
parents | 655c435efe92 |
children | 430e59ff3437 |
line wrap: on
line diff
--- a/mercurial/keepalive.py Mon May 04 20:29:05 2009 +0200 +++ b/mercurial/keepalive.py Mon May 04 21:30:39 2009 +0200 @@ -21,6 +21,8 @@ # - fix for digest auth (inspired from urllib2.py @ Python v2.4) # Modified by Dirkjan Ochtman: # - import md5 function from a local util module +# Modified by Martin Geisler: +# - moved md5 function from local util module to this module """An HTTP handler for urllib2 that supports HTTP 1.1 and keepalive. @@ -528,8 +530,16 @@ print "open connections:", hosts keepalive_handler.close_all() +def md5(s): + try: + from hashlib import md5 as _md5 + except ImportError: + from md5 import md5 as _md5 + global md5 + md5 = _md5 + return _md5(s) + def continuity(url): - from util import md5 format = '%25s: %s' # first fetch the file with the normal http handler