mengzurui / dpkt

Automatically exported from code.google.com/p/dpkt
Other
0 stars 0 forks source link

HTTP "short body" exception for file transfers that exceed one packet #57

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. Download any file that spans multiple packets
2. Parse through the pcap file and look at the "Content-length" of the HTTP 
packet
3. Because the download is split up in multiple packets, the size in bytes is 
for the entire download rather than the HTTP packet

What is the expected output? What do you see instead?
I am not expecting to receive an exception

What version of the product are you using? On what operating system?
dpkt 1.7

Please provide any additional information below.
My current fix is just to comment out lines 57 and 58 of http.py like:
#if len(body) != n:
#   raise dpkt.NeedData('short body (missing %d bytes)' % (n - len(body)))

If these are not commented out, I receive the "short body" exception

Original issue reported on code.google.com by tdea...@gmail.com on 14 Dec 2010 at 1:34

GoogleCodeExporter commented 9 years ago
tdean87,

If you care about reassembling a full HTTP response from the subsequent packets 
associated with that TCP connection, this exception may be useful to you.  If 
you don't care about full reassembly, you can just catch the NeedData exception 
and continue on with your parsing.

Regards,
Jon Oberheide

Original comment by jon.ober...@gmail.com on 6 Jan 2011 at 4:36