473,805 Members | 1,887 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

decompression problem

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.n NsL[<$
-{=~zc<? %1-X"s|8~ sF %.1-5
D
OMiWg-qF',*
&T
3wR[͵?OX7#"Z MS EZ3Z2~sN|c
Sew{f* m"Tir7G ?>DfU""1 L
>ʤ.I6YN2 \?%|1I6 Jh:J(IG:oY6\ ' +~Hj"' ),+)'
;6 "V0uyfdY+ h*Qffes[>"!؍?,S? `yٺ< '.7$ $knJ 3+ra*' P MOa'p}^ 1.ZIXXL Gm ɏ|vJ janoD m8oj
sbAL, "I.[zѳ~Pʲ?PSY$ jfY.TL"'= "'<Ҧ1 K.,
$uE&vU4u KMMO'ͲVw. Be.!WSV7 Z9z,,l X*V"iI"?&?. O{a>'?BKާ Z!<<^RQOA SbI-K'gh-z6_Ģ I ~\pO.[Y:\YE5 X*!g)Y9x *a(kZN? :z]^?č"S*b-X{XH3
yuON7NZrt skyfHfYi zW֢Wsoa_-NW̤* m
4 4P.D.F*Ay ??vk.я `0"CfYfi s?{c
jx7a,O[?z[Ͽm.fQ<|$K 
~<dT-(?-F7jva
vypG <MOM@ĺsFdq _`I<#hP bk'EcSL ?Cb@A| >r%JoS Q?0'f?,
l|n[ Vox, .~ToA? Yjׁ)*T ˧-3?̏e8o.0 ik
t'Um^,x :f-8ic"sf* 3W|Z|RYy  "_%,@x
6lu\2q?^ w\,H* o?b'乶Sv G_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
3 3272
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

"Frederik Vanderhaegen" <fr************ *******@pandora .bewrote in message
news:OI******** ******@TK2MSFTN GP05.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.n NsL[<$
-{=~zc<? %1-X"s|8~ sF %.1-5
D
OMiWg-qF',*
&T
3wR[͵?OX7#"Z MS EZ3Z2~sN|c
Sew{f* m"Tir7G ?>DfU""1 L
>ʤ.I6YN2 \?%|1I6 Jh:J(IG:oY6\ '
+~Hj"' ),+)' ;6
"V0uyfdY+ h*Qffes[>"!؍?,S? `yٺ< '.7$
$knJ 3+ra*' P
MOa'p}^1 .ZIXXLG mɏ |vJj anoDm 8oj
sbAL, "I.[zѳ~Pʲ?PSY$ jfY.TL"'= "'<Ҧ1 K.,
$uE&vU4u KMMO'ͲVw. Be.!WSV7 Z9z,,l
X*V"iI"?&?. O{a>'?BKާ Z!<<^RQOA SbI-K'gh-z6_Ģ
I~\pO.[Y:\YE5 X*!g)Y9x *a(kZN? :z]^?č"S*b-X{XH3
yuON7NZrt skyfHfYi zW֢Wsoa_-NW̤* m 4
4P.D.F*Ay ??vk.я `0"CfYfi s?{c
jx7a,O[?z[Ͽm.fQ<|$K 
~<dT-(?-F7jva vypG
<MOM@ĺsFdq _`I<#hP bk'EcSL ?Cb@A| >r%JoS Q?0'f?,
l|n[ Vox, .~ToA? Yjׁ)*T ˧-3?̏e8o.0 ik
t'Um^,x :f-8ic"sf* 3W|Z|RYy  "_%,@x
6lu\2q?^ w\,H* o?b'乶Sv G_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
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. AutomaticDecomp ression to an appropriate value
(i.e. anything other than DecompressionMe thods.None).

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

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

117
7278
by: Peter Olcott | last post by:
www.halting-problem.com
28
5228
by: Jon Davis | last post by:
If I have a class with a virtual method, and a child class that overrides the virtual method, and then I create an instance of the child class AS A base class... BaseClass bc = new ChildClass(); .... and then call the virtual method, why is it that the base class's method is called instead of the overridden method? How do I fix this if I don't know at runtime what the child class is? I'm using Activator.CreateInstance() to load the...
6
3818
by: Ammar | last post by:
Dear All, I'm facing a small problem. I have a portal web site, that contains articles, for each article, the end user can send a comment about the article. The problem is: I the comment length is more that 1249 bytes, then the progress bar of the browser will move too slow and then displaying that the page not found!!!! If the message is less than or equal to 1249 then no problem.
2
4937
by: Frederik Vanderhaegen | last post by:
Hi, I'm writing an application who captures everything that passes on port 80. The result op the capture is an byte array with the retrieved values. My problem is the following when i'm trying to convert the byte array to UTF8 everything looks like: "E EQ@ @q =ryQzaP&I 0f -quGXzsR'V0L"#Ĵ5\}?P>!(?lnޏ0^YOS?Tw?i` d.Sw'z+^
3
3171
by: Sayudh27 | last post by:
Hi all, I need to decompress data packets that are being received over the network.The packets contain live data and I need to use the LZO algorithm for decompression.However,I am not sure as to exactly how to correctly apply it. Any help will be really appreciated... Thanks..
4
4190
by: =?Utf-8?B?Sm9uIEphY29icw==?= | last post by:
The compression part of this code works fine for me, but the decompression part of this code does not. The output file from that is the same as the compressed file. What is wrong with my code? Thanks, Jon 'compression starts here Dim src As FileStream = File.OpenRead(Fn) Dim dst As FileStream = File.Create(Ofn) Dim cmp As New DeflateStream(dst, CompressionMode.Compress)
6
7455
by: =?Utf-8?B?QkRSaWNoYXJkc29u?= | last post by:
Hi, I have been using the new GZipStream classes, and have been experiencing problems when attemping to decompress files, which from experience, seem to be failing when the original file size exceeds something like 64 MB. For example, when I attempt to decompress a text file of size 1.18 MB to its original size of 106 MB, I receive the following error message: System.IO.IOException: Insufficient system resources exist to complete the
3
2028
by: Stephany Young | last post by:
Does anyone have the source code for a C# implementation of the AR2000 Compression/Decompression algorithm that they might like to share?
1
2713
by: phasma | last post by:
Hi. I'm trying to disassemble bzipped file. If I use minidom.parseString, I'm getting this error: Traceback (most recent call last): File "./replications.py", line 342, in ? File "/usr/lib64/python2.4/xml/dom/minidom.py", line 1925, in parseString
0
9596
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10609
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
10366
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
10105
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
9185
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development projectplanning, coding, testing, and deploymentwithout human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7646
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupr who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6876
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5677
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
3845
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.