benoitc / benoitc/http-parser

Error method parsed when more data append request buffer

Open
#70 2 comments 0 reactions 0 assignees View on GitHub
bug to investigate
Dominant language
C
Stars
345
Forks
94
PR merge metrics
No merged PRs in 30d

Description

I made a demo
```
try:
from http_parser.parser import HttpParser
except ImportError:
from http_parser.pyparser import HttpParser

req = "GET / HTTP/1.1\r\nHost: www.xxx.com\r\n\r\n"
resp = "HTTP/1.1 200 OK\r\nContent-Length: 4\r\n\r\n1234"

data = req
p = HttpParser()
nparsed = p.execute(data, len(data))
print p.get_method(), nparsed, len(data)
# Got: GET 37 37

data = req + resp
p = HttpParser()
nparsed = p.execute(data, len(data))
print p.get_method(), nparsed, len(data)
# Got: HEAD 38 79
# pyparser Got: GET 79 79

# expected: GET 37 79
```

Contributor guide

No contributing guide indexed for this repository

Research direction

Start by running the supplied demo through the C-backed HttpParser entry points, especially execute and get_method, and compare it with pyparser. Trace why appending the response changes the parsed method; done means the C implementation reports GET, parses 37 request bytes, and leaves the combined length at 79 as shown in the expected result.

Written by the indexing model from the issue text.

Assessment

Tech stack
c, python
Domain
api, backend
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
42/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.