xmlrpc: Bugzilla integration issue
Jim Hague
jim.hague at acm.org
Wed Feb 29 11:10:07 UTC 2012
On Tuesday 28 Feb 2012 19:11:46 Oleg Smolsky wrote:
> On 2012-02-28 11:05, Jim Hague wrote:
> > On Tuesday 28 Feb 2012 17:18:18 Oleg Smolsky wrote:
> >> Hey there, I've just hit an issue with Bugzilla integration in
> >> hgext/bugzilla.py (xmlrpc method).
> >> [...]
> >>
> >> Could someone shed some light on this please? It almost seems that the
> >>
> >> code chokes on the compressed HTTP payload...
> >
> > Rats. You are quite right. I think that's exactly what is going wrong :-(
>
> Thank you for the quick reply, Jim! I've just debugged this further and
> the fix is to do the following inside the extension:
>
> # Deal with compression.
> # ToDo:
> # this needs to check the Content-Encoding header...
> import StringIO
> data = StringIO.StringIO(payload)
> import gzip
> gzipper = gzip.GzipFile(fileobj=data)
> payload = gzipper.read()
Yes, that would work, though as you say I'd need to check the Content-Encoding
header.
Since the API calls are not large, and I don't expect much data to be
transferred, my feeling is that compressing the traffic isn't a big win here
anyway. Oleg, can you try this tiny patch instead and let me know if it works
for you?
diff -r 476a981fdf34 -r cd83a2e41c9a hgext/bugzilla.py
--- a/hgext/bugzilla.py Mon Jan 16 01:21:30 2012 -0600
+++ b/hgext/bugzilla.py Wed Feb 29 11:00:18 2012 +0000
@@ -497,6 +497,7 @@
def request(self, host, handler, request_body, verbose=0):
self.verbose = verbose
+ self.accept_gzip_encoding = False
# issue XML-RPC request
h = self.make_connection(host)
--
Jim Hague - jim.hague at acm.org Never trust a computer you can't lift.
More information about the Mercurial
mailing list