Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

web socket decompressing issue

Hello, I'm building my own packet capture program using libpcap with c++. I wanted to capture a web socket protocol. I faced a problem while captureing it. I am using stomp library, and using permessage-deflate.

I looked at structure of web socket protocol. I successfully unmasked payload data using mask key. It looked just the same as wireshark's unmasked data. But the problem is here.

I heard that web socket protocol uses deflate compression to compress data. So I tried to decompress data which I already have unmasked. I used zlib that chatGPT gave me. But It kept saying error -3: data error. It says that data I tried to decompress is not a compressed data.

I also tried to compress data using zlib, but the result was different from wireshark's compressed data.

I want to know how wireshark successfully decompress data using deflate algorithm. I also want to know how to code it.

plz help me this is killing me for days..

web socket decompressing issue

Hello, I'm building my own packet capture program using libpcap with c++. I wanted to capture a web socket protocol. I faced a problem while captureing it. I am using stomp library, and using permessage-deflate.

I looked at structure of web socket protocol. I successfully unmasked payload data using mask key. It looked just the same as wireshark's unmasked data. But the problem is here.

I heard that web socket protocol uses deflate compression to compress data. So I tried to decompress data which I already have unmasked. I used zlib that chatGPT gave me. But It kept saying error -3: data error. It says that data I tried to decompress is not a compressed data.

I also tried to compress data using zlib, but the result was different from wireshark's compressed data.

I want to know how wireshark successfully decompress data using deflate algorithm. I also want to know how to code it.

plz help me this is killing me for days..

below is hex stream data Decompressed payload(115bytes) : 53454e440a64657374696e6174696f6e3a2f7075622f636861740a636f6e74656e742d6c656e6774683a36380a0a7b2273656e646572223a22686874626f79222c20226368616e6e656c4964223a3630302c202263686174223a2268656c6c6f222c202274696d65223a2231303a3030227d00

Unmasked data(88bytes) : 0a76f5734155500055c0959c9f57929a57a29b939a975e92616566c1c555ad549c9a97925aa464a594915192945fa9a4a3a004549c97979ae399a204720544a004a4223527271fa4a024333715c83734b0323050aa650000