Join GitHub today
GitHub is home to over 50 million developers working together to host and review code, manage projects, and build software together.Sign up
HTTP responses with no body cause other responses to be consumed #77
From andrewf...@gmail.com on September 27, 2010 18:40:27
Put more clearly, when an HTTP response, say, 304 Not Modified, has no body but still has a content-type header, all data after that in the stream is consumed. What steps will reproduce the problem? 1. Unpack attached zip file
This program prints the number of responses parsed. There are two responses in the file, but only one is detected, with the other response as its body. You can see this if you print the responses instead of just the length of the list.
This test was run on Windows Vista with dpkt 1.7.
Original issue: http://code.google.com/p/dpkt/issues/detail?id=50
From ls...@google.com on September 28, 2010 07:32:20
Please note that 204 No Content, and others have no body either. http://www.w3.org/Protocols/rfc2616/rfc2616-sec4.html#sec4.3 "For response messages, whether or not a message-body is included with
From andrewf...@gmail.com on September 28, 2010 10:45:55
Ok. The current issue is being caused by dpkt reading the rest of the data into the body if the response header has a content-type header, which is wrong according to the RFC. A simple fix is simply to remove those two lines.
Of course, this doesn't solve the larger issue. Making the response intelligently decide whether to parse a body is tricky with dpkt's architecture, because the parsing of the body and headers is done in the http.Message superclass.
From matthaeu...@gmail.com on January 10, 2014 09:11:33
Attached is a patch to fix the issue:
Also attached modified dpkt_http_bug2.zip:
Attachment: http_fix_50.patch dpkt_http_bug2.zip