changeset 3567:3bab1fc0ab75

Turn bundle file into a string for http push, for urllib2 over proxies.
author Thomas Arendsen Hein <thomas@intevation.de>
date Fri, 27 Oct 2006 19:24:57 +0200
parents ca24144ed850
children 23f7d9621783
files mercurial/httprepo.py
diffstat 1 files changed, 6 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/httprepo.py	Fri Oct 27 18:30:53 2006 +0200
+++ b/mercurial/httprepo.py	Fri Oct 27 19:24:57 2006 +0200
@@ -221,6 +221,12 @@
         qs = '?%s' % urllib.urlencode(q)
         cu = "%s%s" % (self._url, qs)
         try:
+            if data:
+                if isinstance(data, file):
+                    # urllib2 needs string or buffer when using a proxy
+                    data.seek(0)
+                    data = data.read()
+                self.ui.debug(_("sending %d bytes\n") % len(data))
             resp = urllib2.urlopen(urllib2.Request(cu, data, headers))
         except urllib2.HTTPError, inst:
             if inst.code == 401: