Need help dechunking a stream

Hi All,

Can someone please help me to dechunk a binary stream I received from a webservice. I basically connected a TCP socket to the webservice and sent it the required request. The websvc responded with a large binary stream which I logged in both plain text and a hex sequence.

The initial portion of the binary stream which was the printable html header indicated that the body is deflated and chunked. I managed to download source code for gzip to perform deflating. I tested this source on some other plain zipped streams and confirm that it works.

My problem is that I need to dechunk the stream first and have tried following the supposedly simple chunked architecture as listed in top google searches, but find that the stream I have don't seem to follow the rules given by these searches I made. Basically I don't find the require fields (chunk_size, optional parameters, CRLF, chunk, ... repeating till end). I only find the first chunk_size followed by a CRLF. I then find no other corresponding CRLF's in the sequence. I even thought of assuming the remaining chunks were simply only preceded by their chunk_size occupying only one byte with chunk following, but still could not successfully dechunk the stream.

I also verified that the stream I receive was correct by manually firing it from an application with a TCP listener. I connected from IE to the sockets (IP, and Port) and simply loaded stream from a file I saved on disk and sent to IE's corresponding request. The page displayed perfectly.

Can someone please help me or point me in the right direction. I am almost out of options here. Should I post the hex sequence of the binary stream I received from the webservice?


Thanks in advance for any help.
Aha, I found my issue. I was decoding the chunk_size as the binary hex values instead of english hex values, ie hex (61) = 97 = 'a' I was using 97 instead of a = 10 - a really silly mistake.
Topic archived. No new replies allowed.