Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

HTTP HEAD Responses cannot be processed correctly #648

Open
JannisBush opened this issue Dec 1, 2022 · 0 comments
Open

HTTP HEAD Responses cannot be processed correctly #648

JannisBush opened this issue Dec 1, 2022 · 0 comments

Comments

@JannisBush
Copy link

Describe the bug
HTTP HEAD Responses are currently not parsed correctly.
As there is no body, the library raises an Error and it does not seem possible to ignore it for HEAD responses.

To Reproduce
Steps to reproduce the behavior:

import dpkt

head_response = b"HTTP/1.1 200 OK\r\nContent-Length: 10\r\n\r\n"
resp = dpkt.http.Response(head_response)

-> dpkt.dpkt.NeedData: short body (missing 10 bytes)

Expected behavior
Option to tell the Response that it is a head_response such that it does not raise an Exception (dpkt.http.Response(head_response, head_response=True)).

Additional context
This problem was already raised in the past: #77
But if I understand the code correctly, only status codes 1XX, 204, and 304 are handled correctly at the moment.

JannisBush added a commit to JannisBush/dpkt that referenced this issue Dec 1, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant