##// END OF EJS Templates
http: len(x) fails if it doesn't fit into an int, use __len__() instead...
Benoit Boissinot -
r10491:d7e582ca stable
parent child Browse files
Show More
@@ -74,10 +74,15 b' class httprepository(repo.repository):'
74 q.update(args)
74 q.update(args)
75 qs = '?%s' % urllib.urlencode(q)
75 qs = '?%s' % urllib.urlencode(q)
76 cu = "%s%s" % (self._url, qs)
76 cu = "%s%s" % (self._url, qs)
77 req = urllib2.Request(cu, data, headers)
78 if data is not None:
79 # len(data) is broken if data doesn't fit into Py_ssize_t
80 # add the header ourself to avoid OverflowError
81 size = data.__len__()
82 self.ui.debug("sending %s bytes\n" % size)
83 req.add_unredirected_header('Content-Length', '%d' % size)
77 try:
84 try:
78 if data:
85 resp = self.urlopener.open(req)
79 self.ui.debug("sending %s bytes\n" % len(data))
80 resp = self.urlopener.open(urllib2.Request(cu, data, headers))
81 except urllib2.HTTPError, inst:
86 except urllib2.HTTPError, inst:
82 if inst.code == 401:
87 if inst.code == 401:
83 raise util.Abort(_('authorization failed'))
88 raise util.Abort(_('authorization failed'))
General Comments 0
You need to be logged in to leave comments. Login now