WIP: http2: improve compatibility with http1, add tests
This PR brings near full compatibility with express
's use of http1 API. List of updates:
- Add
complete
prop forHttp2ServerRequest
- Add
method
setter since some user-land modules use this - Add
socket
andconnection
onHttp2ServerResponse
- Major rework of
writeHead
,write
,end
,addHeader
andremoveHeader
. A lot of user-land modules, including express, rely on the fact that in http1 all write methods callwriteHead
if headers haven't been written yet. - Add support for http1 style handling of HEAD requests (expects
end
call and triggers callback, even ifwriteHead
already happened) - Remove closure created for unsetting stream reference
Please let me know if I can provide more info for any of these changes. I know there's a lot here and some of the logic is a bit complicated in order to replicate http1 behaviour. It came a long way since my 1st pass at it.
(Re: express, after this PR only 5 tests are failing and they're a result of other modules relying on specific http1-only behaviour. This should bode well for compatibility with other popular libraries too.)
Thanks in advance for any and all reviews!
Checklist
-
make -j4 test
(UNIX), orvcbuild test
(Windows) passes -
tests and/or benchmarks are included -
commit message follows commit guidelines
Affected core subsystem(s)
http2, test