equal
deleted
inserted
replaced
72 self.ui.debug("sending %s command\n" % cmd) |
72 self.ui.debug("sending %s command\n" % cmd) |
73 q = {"cmd": cmd} |
73 q = {"cmd": cmd} |
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 try: |
77 req = urllib2.Request(cu, data, headers) |
78 if data: |
78 if data is not None: |
79 self.ui.debug("sending %s bytes\n" % len(data)) |
79 # len(data) is broken if data doesn't fit into Py_ssize_t |
80 resp = self.urlopener.open(urllib2.Request(cu, data, headers)) |
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) |
|
84 try: |
|
85 resp = self.urlopener.open(req) |
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')) |
84 raise |
89 raise |
85 except httplib.HTTPException, inst: |
90 except httplib.HTTPException, inst: |