Jump to content

How to handle a HTTP Request with gzip, deflate headers


mary
 Share

Recommended Posts

Hi!

Please, I need your help to handle decompression html page. Here is my code

if I send the following to in my request

$oHTTP = ObjCreate("winhttp.winhttprequest.5.1")
$oHTTP.Open("GET", "http://www.stylephreak.com/index.php/archives/2004/08/standard-forms/")

[b]$oHTTP.SetRequestHeader("Accept-Encoding", "gzip,deflate")[/b] ; to get a compressed html page

$oHTTP.Send()

And then the Content-Encoding header in the response is 'gzip' or

'deflate'. How can I uncompress the content?

thinks a lot

Link to comment
Share on other sites

I suppose you're looking for something more elegant than 1) save the response to a file, 2) inflate the file with gunzip?

Dale

Free Internet Tools: DebugBar, AutoIt IE Builder, HTTP UDF, MODIV2, IE Developer Toolbar, IEDocMon, Fiddler, HTML Validator, WGet, curl

MSDN docs: InternetExplorer Object, Document Object, Overviews and Tutorials, DHTML Objects, DHTML Events, WinHttpRequest, XmlHttpRequest, Cross-Frame Scripting, Office object model

Automate input type=file (Related)

Alternative to _IECreateEmbedded? better: _IECreatePseudoEmbedded  Better Better?

IE.au3 issues with Vista - Workarounds

SciTe Debug mode - it's magic: #AutoIt3Wrapper_run_debug_mode=Y

Doesn't work needs to be ripped out of the troubleshooting lexicon. It means that what you tried did not produce the results you expected. It begs the questions 1) what did you try?, 2) what did you expect? and 3) what happened instead?

Reproducer: a small (the smallest?) piece of stand-alone code that demonstrates your trouble

Link to comment
Share on other sites

o? They seemed to resolve exactly what you asked in the thread (using perl but same concept)

http://coding.derkeiler.com/Archive/Perl/c...04-12/0625.html

or is this not applicable?

the solution is given for perl with an embeded perl decompression library. Autoit have not a similar library

I suppose you're looking for something more elegant than 1) save the response to a file, 2) inflate the file with gunzip?

Dale

this solution needs a lot of disk access specially when you send many httprequest

Edited by mary
Link to comment
Share on other sites

  • 2 months later...

Ok, I have a solution.

First, I modified InetGet (or _InetGetPro) so that it could retreive binary data

Then, I recompiled zlib.dll (zlib 1.2.3) so that the uncompress export could accept a variable zMode, which specifies gzip or zlib compressed data.

After amking the proper dll data structures, it's not too hard to do. Included in the zip file is the modified _InetGetPro and zlib1.dll, with header info.

Also, perhaps most importantly, I included a working example showing pure memory gzip http download and decompression, and a file gzip access example.

I can't post this in the example scripts section for some reason, it says I'm not allowed.. so here it is:

gzip_binary_InetGet.zip

Enjoy, and I appreciate your feedback.

Link to comment
Share on other sites

  • 2 months later...
  • 2 years later...

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...