473,405 Members | 2,167 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,405 software developers and data experts.

http compression/decompression

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+^
MS~"2/<"5'f` tk5hZY"<TAټx7çls *Lk.^/?
M&h;ghG)o0]j?AFE 9 =x [bǫ5=DiJ'ZnGzkN-o$-AamX-SSjHƝȣ?-rt>|:va)*f--If;\:F-4Y6K^L?}{d*D~&D?'퐦, #4%S
>8,"'&SLMY.N"!\xO.\cZYm.
P<FD>( ?_?r&nch SY8 e6t-3|?y{%,ѨT#"
Ǻ{/.kD?r>i?"+z3{SowZ
M`H")n'@Y˹Xx?LPe1]|
Y̿6aXk<f2k\v{þ:'0.>sKu$'?d "$X'gyo':+!k8 .pi#>B'
yKWG&?fs,ZO
8Ij4qLpT)3s2Df.1-.'E$3]4F?¦ͬeOS L*{
FNs' "lbDYr.,^."

I've read somewhere that current browsers sometimes use "content-encoding:
gzip,deflate".
So I think this is also the case in the above sample (which is the first
packet I receive when I surf to www.google.be) , only I can't decompress the
packets who are sent over port 80, I'm using SharpZipLib and receive errors
like "first byte is incorrect, ..."

Does anyone has an idea/solution for my problem?

Thx in advance

Frederik
Aug 23 '06 #1
2 4917
Frederik Vanderhaegen wrote:
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`
I've read somewhere that current browsers sometimes use "content-encoding:
gzip,deflate".
So I think this is also the case in the above sample (which is the first
packet I receive when I surf to www.google.be) , only I can't decompress the
packets who are sent over port 80, I'm using SharpZipLib and receive errors
like "first byte is incorrect, ..."

Does anyone has an idea/solution for my problem?
You could try GZIP deflate it !

..NET 2.0 has GZIP support in System.IO.Compression ...

Arne
Aug 24 '06 #2
Hi,

I've tried it with GZIP from .NET 2.0 but got following error:
"The magic number in GZip header is not correct. Make sure you are passing
in a GZip stream."
I checked the message with Hexview and saw that the gzip header was missing.
After adding that,
I tried it again but then got "Found invalid data while decoding".

Decompressing the byte array, captured through port 80, seems not be as easy
as I thought.

Does anyone have any idea about the structure of a http message or about how
to decompress such a message?

Frederik

"Arne Vajhj" <ar**@vajhoej.dkschreef in bericht
news:i97Hg.4108$_q4.1633@dukeread09...
Frederik Vanderhaegen wrote:
>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`
>I've read somewhere that current browsers sometimes use
"content-encoding: gzip,deflate".
So I think this is also the case in the above sample (which is the first
packet I receive when I surf to www.google.be) , only I can't decompress
the packets who are sent over port 80, I'm using SharpZipLib and receive
errors like "first byte is incorrect, ..."

Does anyone has an idea/solution for my problem?

You could try GZIP deflate it !

.NET 2.0 has GZIP support in System.IO.Compression ...

Arne

Aug 24 '06 #3

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

Similar topics

5
by: mkarim | last post by:
I am looking for an algorithm I can use in C# that compresses small XML documents. Is there a chance of losing some literal data on decompression (as some claim)? How fast is the...
16
by: Claudio Grondi | last post by:
What started as a simple test if it is better to load uncompressed data directly from the harddisk or load compressed data and uncompress it (Windows XP SP 2, Pentium4 3.0 GHz system with 3 GByte...
1
by: chris.atlee | last post by:
I'm writing a program in python that creates tar files of a certain maximum size (to fit onto CD/DVD). One of the problems I'm running into is that when using compression, it's pretty much...
4
by: Frederik Vanderhaegen | last post by:
Hi, I'm writing an application who 'sniffs' port 80. The sniffing works 'perfect', I receive a byte array with the data sent over the port. My problem is the following, when I write the array...
2
by: TerryStone | last post by:
Thanks to anyone who reads this. Below is some C# that compresses an array of bytes, and then decompresses, and compares the original data with the new. Firstly, the length of the decompressed...
5
by: jeremyje | last post by:
I'm writing some code that will convert a regular string to a byte for compression and then beable to convert that compressed string back into original form. Conceptually I have.... For...
4
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?...
3
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?
14
by: Thomas Mlynarczyk | last post by:
Hello, I have a script that generates XML files which are sent to a client app on request via "new SimpleXMLElement( $sUrl, 0, true )". Both client and server run PHP 5.2 and the XML file can...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
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...
0
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,...

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.