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

Error method parsed when more data append request buffer #70

Open
rainhard opened this issue Apr 18, 2017 · 1 comment
Open

Error method parsed when more data append request buffer #70

rainhard opened this issue Apr 18, 2017 · 1 comment

Comments

@rainhard
Copy link

rainhard commented Apr 18, 2017

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
@benoitc
Copy link
Owner

benoitc commented Apr 21, 2017

i will have a look. thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants