masperro / httplib2

Automatically exported from code.google.com/p/httplib2
0 stars 0 forks source link

No way to disable http compression. #27

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
There is currently no way to disable HTTP compression.

I am using httplib2 in a testing scenario, and one of those tests is to
check that a server supports http compression.

But httplib2 automatically adds "accept-encoding: gzip" to all outgoing
requests, and then auto-decompresses the response, removing the all
important "content-encoding: gzip" header. These are exactly the things I
need to test.

So in order to use httplib2 for this kind of testing, I have to comment out
the relevant bits of code. Which is not a huge problem, but now I have a
non-standard httplib2 module.

Original issue reported on code.google.com by alan.ken...@gmail.com on 27 May 2008 at 10:35

GoogleCodeExporter commented 8 years ago
httplib2 used to have the same problem with 'if-match' headers and the way I 
solved
that problem was to only add the 'if-match' header if it *wasn't* supplied by 
the
client. I can do the same thing for the 'accept-encoding' header and only add 
it if
the client hasn't supplied one. 

As for the content-encoding header, the original value gets stored in the
"-content-encoding" header (note the leading dash) which is something I added a 
while
ago for my own unit testing purposes.

Original comment by joe.gregorio@gmail.com on 31 May 2008 at 6:10

GoogleCodeExporter commented 8 years ago
> I can do the same thing for the 'accept-encoding' header and 
> only add it if the client hasn't supplied one. 

That's fine, as long as it's also possible to specify no accept-encoding header,
perhaps by passing {'accept-encoding': None}, which would then remove the header
entirely from the request before it was sent.

> As for the content-encoding header, the original value gets 
> stored in the "-content-encoding" header (note the leading 
> dash) which is something I added a while ago for my own unit
> testing purposes.

That's fine. As long as its documented.

Thanks for a great library.

Original comment by alan.ken...@gmail.com on 31 May 2008 at 2:06

GoogleCodeExporter commented 8 years ago
You can now add you own Accept-Encoding: header whose value will over-ride the 
default.

Original comment by joe.gregorio@gmail.com on 6 Sep 2008 at 5:06