On 05/16/2014 01:45 PM, Tom Breton (Tehom) wrote: > The RawHeader approach seems better, actually. Too bad QT doesn't offer a > neat solution. > > Or we could just live with it. Now that we know what causes it - good > work, BTW, Tim - we can be sure the consequences aren't too serious.
Since QNetworkAccessManager provides the header "Accept-Encoding: gzip, deflate" by default, explicitly setting QNetworkRequest::setRawHeader("Accept-Encoding", "gzip, deflate") makes absolutely no difference in what is the server sees or in how it responds. The headers in both cases are Request: GET /comp_005.rg HTTP/1.1 Accept-Encoding: gzip, deflate Connection: Keep-Alive Accept-Language: en-US,* User-Agent: Mozilla/5.0 Host: xxx.valhalla.local:80 Reply: HTTP/1.1 200 OK Date: Sat, 17 May 2014 11:02:17 GMT Server: Sha-bang! Last-Modified: Wed, 05 Mar 2014 15:06:40 GMT ETag: "1ea9d2-3d06-53173d80" Accept-Ranges: bytes Content-Length: 15622 Keep-Alive: timeout=15, max=100 Connection: Keep-Alive Content-Type: text/plain Content-Encoding: gzip However, without the explicit inclusion of the Accept-Encoding header, the file is automatically decompressed on arrival. Just for fun I also tried setting QNetworkRequest::setRawHeader("Accept-Encoding", "whatever") with the following result: Request: GET /comp_005.rg HTTP/1.1 Accept-Encoding: whatever Connection: Keep-Alive Accept-Language: en-US,* User-Agent: Mozilla/5.0 Host: xxx.valhalla.local:80 Reply: HTTP/1.1 200 OK Date: Sat, 17 May 2014 11:30:23 GMT Server: Sha-bang! Last-Modified: Wed, 05 Mar 2014 15:06:40 GMT ETag: "1ea9d2-3d06-53173d80" Accept-Ranges: bytes Content-Length: 15622 Keep-Alive: timeout=15, max=100 Connection: Keep-Alive Content-Type: text/plain Content-Encoding: x-gzip The server came back with "Content-Encoding: x-gzip" instead of "Content-Encoding: gzip," but the end result was the same: the file was not decompressed. It would seem supplying any sort of Accept-Encoding header is adequate to prevent QNetworkAccessManager from doing its thing, but I have no way of verifying this in all cases. It's probably OK, but I'm always apprehensive about relying on undocumented behavior to make something work. Tim Munro ------------------------------------------------------------------------------ "Accelerate Dev Cycles with Automated Cross-Browser Testing - For FREE Instantly run your Selenium tests across 300+ browser/OS combos. Get unparalleled scalability from the best Selenium testing platform available Simple to use. Nothing to install. Get started now for free." http://p.sf.net/sfu/SauceLabs _______________________________________________ Rosegarden-devel mailing list Rosegarden-devel@lists.sourceforge.net - use the link below to unsubscribe https://lists.sourceforge.net/lists/listinfo/rosegarden-devel