By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
434,960 Members | 2,459 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 434,960 IT Pros & Developers. It's quick & easy.

decompression problem

P: n/a
Hey,

I've written a http sniffer that monitors the traffic on port 80.
This application works like it should be but there is one small problem.
Suppose I run the application and I surf to www.google.be then I retrieve
all the HTTP messages (Response and Request)
but the content of the message is gzip encoded (http compression).

Here you see the original message:

HTTP/1.1 200 OK
Cache-Control: private
Content-Type: text/html; charset=UTF-8
Content-Encoding: gzip
Server: GWS/2.1
Content-Length: 1763
Date: Sun, 01 Oct 2006 09:22:42 GMT

< Wr۸@F'(qֵDf'l.nNsL[<$
-{=~zc<? %1-X"s|8~Ѽ sF %.1-5
D
OMiWg-qF',*
&T
3wR[͵?OX7#"ZMS EZ3Z2~sN|c
Sew{f*m"Tir7G?>DfU""1L
>ʤ.I6YN2\?%|1I6Jh:J(IG:oY6\' +~Hj"'),+)'
;6 "V0uyfdY+h*Qffes[>"!؍?,S?`yٺ< '.7$ $knJ3+ra*' P MOa'p}^1. ZIXXLGmɏ|vJjan oDm8oj
sbAL,"I.[zѳ~Pʲ?PSY$jfY.TL"'="'<Ҧ1K.,
$uE&vU4uKMMO'ͲVw.Be.!WSV7Z9 z,,l X*V"iI"?&?.O{a>'?BKާZ!<<^RQOASb I-K'gh-z6_Ģ I~\pO.[Y:\YE5X*!g)Y9x*a(kZN?: z]^?č"S*b-X{XH3
yuON7NZrtskyfHfYizW֢Wsoa_-NW̤* m
4 4P.D.F*Ay??vk.я`0"CfYfis?{ c
jx7a,O[?z[Ͽm.fQ<|$K
~<dT-(?-F7jva
vypG <MOM@ĺsFdq_`I<#hPb k'EcSL?Cb@A|>r%JoSQ?0'f?,
l|n[ Vox, .~ToA? Yjׁ)*T˧-3?̏e8o.0ik
t'Um^,x:f-8ic"sf*3W|Z|RYy "_%,@x
6lu\2q?^w\,H* o?b'乶SvG_M"?WT

When I copy the encoded content into notepad and save it as a gz file.
If I try to decompress it, I receive "CRC is invalid".
I've tried several things but nothing seems to work.

Has anybody how I can decompress the content of this message so I retrieve
the html code?

Thx in advance

Frederik

Oct 1 '06 #1
Share this Question
Share on Google+
3 Replies


P: n/a
You can use the GZipStream class to decompress the response stream:
http://msdn2.microsoft.com/en-us/lib...zipstream.aspx

Or take a look at Fiddler:
http://www.fiddlertool.com/fiddler/

This is an HTTP sniffer with built-in support for gzip decompression.
Frederik Vanderhaegen wrote:
Hey,

I've written a http sniffer that monitors the traffic on port 80.
This application works like it should be but there is one small problem.
Suppose I run the application and I surf to www.google.be then I retrieve
all the HTTP messages (Response and Request)
but the content of the message is gzip encoded (http compression).

Here you see the original message:

HTTP/1.1 200 OK
Cache-Control: private
Content-Type: text/html; charset=UTF-8
Content-Encoding: gzip
Server: GWS/2.1
Content-Length: 1763
Date: Sun, 01 Oct 2006 09:22:42 GMT

[SNIP]

When I copy the encoded content into notepad and save it as a gz file.
If I try to decompress it, I receive "CRC is invalid".
I've tried several things but nothing seems to work.

Has anybody how I can decompress the content of this message so I retrieve
the html code?

Thx in advance

Frederik
Oct 1 '06 #2

P: n/a

"Frederik Vanderhaegen" <fr*******************@pandora.bewrote in message
news:OI**************@TK2MSFTNGP05.phx.gbl...
Hey,

I've written a http sniffer that monitors the traffic on port 80.
This application works like it should be but there is one small problem.
Suppose I run the application and I surf to www.google.be then I retrieve
all the HTTP messages (Response and Request)
but the content of the message is gzip encoded (http compression).

Here you see the original message:

HTTP/1.1 200 OK
Cache-Control: private
Content-Type: text/html; charset=UTF-8
Content-Encoding: gzip
Server: GWS/2.1
Content-Length: 1763
Date: Sun, 01 Oct 2006 09:22:42 GMT

< Wr۸@F'(qֵDf'l.nNsL[<$
-{=~zc<? %1-X"s|8~Ѽ sF %.1-5
D
OMiWg-qF',*
&T
3wR[͵?OX7#"ZMS EZ3Z2~sN|c
Sew{f*m"Tir7G?>DfU""1L
>ʤ.I6YN2\?%|1I6Jh:J(IG:oY6\'
+~Hj"'),+)' ;6
"V0uyfdY+h*Qffes[>"!؍?,S?`yٺ< '.7$
$knJ3+ra*' P
MOa'p}^1.ZIXXLGmɏ| vJjanoDm8oj
sbAL,"I.[zѳ~Pʲ?PSY$jfY.TL"'="'<Ҧ1K.,
$uE&vU4uKMMO'ͲVw.Be.!WSV7Z9 z,,l
X*V"iI"?&?.O{a>'?BKާZ!<<^RQOASb I-K'gh-z6_Ģ
I~\pO.[Y:\YE5X*!g)Y9x*a(kZN?: z]^?č"S*b-X{XH3
yuON7NZrtskyfHfYizW֢Wsoa_-NW̤* m 4
4P.D.F*Ay??vk.я`0"CfYfis?{ c
jx7a,O[?z[Ͽm.fQ<|$K
~<dT-(?-F7jva vypG
<MOM@ĺsFdq_`I<#hPbk'EcSL?C b@A|>r%JoSQ?0'f?,
l|n[ Vox, .~ToA? Yjׁ)*T˧-3?̏e8o.0ik
t'Um^,x:f-8ic"sf*3W|Z|RYy "_%,@x
6lu\2q?^w\,H* o?b'乶SvG_M"?WT

When I copy the encoded content into notepad and save it as a gz file.
If I try to decompress it, I receive "CRC is invalid".
I've tried several things but nothing seems to work.

Because when you cut and paste you are not copying all the characters. There
are many control characters that won't show up such as tabs(0x10 or
something), line feeds(0x9 I guess), etc...

If you stored the msg as a binary then you can use some hex editor to remove
the text header and it might work. (or just try to save the body as a binary
file with .zip extension and then open it and it should work)
Oct 1 '06 #3

P: n/a
Thus wrote Chris,
You can use the GZipStream class to decompress the response stream:
http://msdn2.microsoft.com/en-us/lib...ession.gzipstr
eam.aspx

Or take a look at Fiddler:
http://www.fiddlertool.com/fiddler/
This is an HTTP sniffer with built-in support for gzip decompression.
In .NET 2.0, HttpWebResponse can decompress HTTP messages automatically,
if you set HttpWebRequest.AutomaticDecompression to an appropriate value
(i.e. anything other than DecompressionMethods.None).

Cheers,
--
Joerg Jooss
ne********@joergjooss.de
Oct 5 '06 #4

This discussion thread is closed

Replies have been disabled for this discussion.