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

Main for loop never terminates for parse!(r, p, Vector{UInt8}("Some-Header:")) #125

Closed
samoconnor opened this issue Nov 22, 2017 · 0 comments

Comments

@samoconnor
Copy link
Contributor

The main for loop in parse!() never terminates when the last parser input is fragmented so that the last character in the input bytes is the : at the end of a header.

i.e. If the parser will lock up if the request data is fragmented so that the first call to readavailable(socket) returns "HTTP/1.1 200 OK\r\nDate:".

PR #124 adds a test that parses 1 byte at a time to demonstrate the problem and adds a loop invariant @assert to the for loop to stop in looping forever.

julia> HTTP.parse(HTTP.Response, "HTTP/1.1 200 OK\r\nDate:")
ERROR: AssertionError: p > old_p
samoconnor added a commit to samoconnor/HTTP.jl that referenced this issue Nov 22, 2017
samoconnor added a commit to samoconnor/HTTP.jl that referenced this issue Nov 29, 2017
…uliaWeb#126.

Replace local `KEY` in `parse!()` with `parser.previous_field`.

Add onurlbytes(). Accumulates URL in `parser.valuebuffer`.

Use `Ref{String}` to return `extra`/`upgrade` so that caller can
tell
the difference between upgrade with empty string and no upgrade.

Add `s_req_fragment_start` to list of states where the url_mark
should
be reset to 1.
@quinnj quinnj closed this as completed in e5d43cc Jan 16, 2018
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