-
Notifications
You must be signed in to change notification settings - Fork 183
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
WIP: Lazy Parsing #331
base: master
Are you sure you want to change the base?
WIP: Lazy Parsing #331
Conversation
Use start-of-line index in FieldValue (be more lazy) Add findstart() function to find start of value when iterating. Docstrings
…ng stroage that does not implement `ncodeunits`
…g IOBuffer as underlying storage
…g IOBuffer as underlying storage
Make AWS signing code lazy header compatible
…seHeader constructor
…bility with rfc7540 8.1.2.1
a10d682
to
09d3664
Compare
The CI is passing sometimes and timing out sometimes: The HPack test takes 55MB of simulated HTTP/2 header streams from https://github.com/http2jp/hpack-test-case and processes them in a variety of ways to ensure that lazy random access works, and full iteration works, and random access after full iteration works, and vis versa... All this takes a bit of time. I might have to add an env var for |
With MbedTLS hanging bug fixed, CI now passing. |
This is exciting! Looks like this needs a rebase and perhaps a little squashing along the way? Any recommendations on where to start reviewing or what to look for/worry about? |
Yeah there are most definitely a bunch of commits fiddling with CI/toml etc that I can squash.
I was thinking you should start by just doing a sanity check that this PR is really a no-op as far as current exported functionality goes. Aside from all-new files, the changes should be:
Aside from that I'm happy to answer questions about the new code if you have any. |
@samoconnor, this would be really great functionality to have, especially the http2 support. Will you be able to pick this back up? Otherwise, I could try to dive in and get it merged in. |
This branch adds a number of modules (with passing tests) but does not integrate them into the HTTP request/response processing code.
Lazy parsing has potential performance and security benefits for HTTP clients and servers.
Consider a multi layered server request routing framework. The top level request handling function may only need to look at a single
auth-token
header to know that it should just close the connection. It can avoid waiting time parting the rest of the headers, which reduces the impact of DOS attacks (and it is immune to malformed header attacks that might be designed to waste memory and/or time processing headers.). If it is decided that a request is authorised, it may be that the top-level router only needs to look at the target URI to decide what to do next, so it does not need to bother parsing all the headers. This pattern can continue down the tree of handlers, so that each layer only needs to decode the parts of the header that are actually needed.There are similar benefits for clients too. There are many cases where the client of a web services API call just wants to check for
200 OK
and then read some json from the response body. The headers may be full of all kinds of meta-data from various intermediate proxies that are never used.This PR is intended to be a first step at adding some components that can later be used to implement lazy HTTP Message processing.
(The
so/lazyintegrate
branch has a working (but not optimal) integration of the LazyHTTP Parser/Generator withMessages.jl
.)LazyStrings.jl
LazyHTTP.jl
isvalid.jl
Regexs for checking validity of HTTP Headers (for cases where a lazy parser does not notice invalidity, but validity is important)
Nibbles.jl
Used for decoding HPack's Huffman code.
HPack.jl