Open sogaani opened 4 years ago
I think you can add https://github.com/nodejs/node/pull/24347 to the list as well.
Really good work! I would be interested in helping sorting some of this.
@sogaani I would like to suggest we put your tests in under tests/known_issues so that we might sort them out later? @addaleax would you agree?
Here is another one that might be worth to add to the list, https://github.com/nodejs/node/issues/29529
@ronag Thank you for looking at this issue. I added 2 issues you mentioned.
I'm glad to make pull request to put my tests at this repo if it is OK.
@addaleax Some guidance here? Would it make sense to add @sogaani's test in e.g. known_issues? Sorting all these out will probably take a while and I'd like to avoid losing this excellent work.
@sogaani: Another candidate for the list https://github.com/nodejs/node/issues/28267
@sogaani: Just wanted to give a quick ping that I'm still interested in helping sorting these out over time (a little swamped at the moment). But please do continue updating the list if you find more differences.
@ronag Thank you for mentioning the difference. I added :)
@rexagod: If you are looking for tasks there is plenty to pick from here.
Awesome! Thank you for pointing me here, @ronag!
@addaleax @ronag I've marked sub-issues that exhibited intentional behavior as Expected behavior
and submitted PRs for the rest of them. I think we can probably close this one now, or if any sub-issue was incorrectly marked, let me know and I'll separate that out into a new issue.
Fixes: https://github.com/nodejs/node/issues/29829
const server = http2.createServer((req, res) => { res.setHeader('Content-Type', 'text/plain') res.writeHead(304) res.write('a'); res.end() }); server.listen(0, () => { const client = http2.connect(`http://localhost:${server.address().port}`); const request = client.request() request.on('data', () => {}) request.on('end', () => { client.close(); server.close(); }) })
http2.Http2ServerRequest.connection.setTimeout
Http2ServerRequest.setTimeout
should return this
instead of void
/undefined
It's the last thing in the TypeScript typings to fix:
Argument of type 'Http2ServerRequest' is not assignable to parameter of type 'IncomingMessage'.
The types returned by 'setTimeout(...)' are incompatible between these types.
Type 'void' is not assignable to type 'IncomingMessage'.ts(2345)
See:
Http2ServerRequest.connection.setTimeout
returns a ServerHttp2Session/Stream
. The code snippet below works.
req.connection.setTimeout(500).on('timeout', () => {
console.log('timeout');
})
Sorry, my mistake, I mean Http2ServerRequest.setTimeout
, not Http2ServerRequest.connection.setTimeout
Also I think it would be nice to have http2stream.bytesWritten
.
@sogaani any updates on this? I wanted to help out with the http/2 in express proposal but this one seems to be a blocker
http2.Http2ServerResponse does not have res.writeProcessing
Isn't the 102 status code is totally deprecated and will not be added to HTTP/2 standard?
https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/102#browser_compatibility
Maybe it should be replaced with multiple res.write()
?
Thanks to the efforts of making the compatibility API, differences between
http[s]
andhttp2
modules seldom annoy developers. But, some http2 compatibility API still behaves differently and lacks some APIs fromhttp[s]
and it causes breakages to ecosystems forhttp[s]
(e.g. https://github.com/expressjs/express/pull/3730).In order to expose the differences, I've been translating test cases for
http[s]
to test cases forhttp2
at my repo. The following is a list of the differences currently founded by translated test cases.I'm not sure all the differences have to be fixed. I thought if they should not be fixed, documenting the differences is good for the developer.
Differences between http and http2 compatibility API
http2.Http2ServerRequest
does not havereq.connection.bytesWritten
. test:parallel/test-http-byteswritten.js,parallel/test-https-byteswritten.jshttp2.Http2ServerRequest.pause
is called,http2.Http2ServerRequest.socket
never emit 'data' event. test:parallel/test-http-dump-req-when-res-ends.jshttp2.Http2ServerResponse.writeHead
with 'HTTP/1 Connection specific headers'(e.g. "Transfer-Encoding":"chunked") causes error:ERR_HTTP2_INVALID_CONNECTION_HEADERS. test:parallel/test-http-head-request.jshttp2.Http2ServerResponse
does not haveres.writeProcessing
. test:parallel/test-http-information-processing.jshttp2.Http2ServerResponse.writeHead
with a spaced header name does not cause error. test:parallel/test-http-invalidheaderfield.jshttp2.Http2ServerRequest
does not havereq.connection.parser
. test:parallel/test-http-highwatermark.js,parallel/test-http-server-keepalive-end.jshttp2.Http2ServerResponse.end
calls callback before satisfying condition of 'finish' events. test:parallel/test-http-outgoing-finish.jshttp2.Http2ServerResponse.getHeaders
returns headers which is not initialized byObject.create(null)
test:parallel/test-http-mutable-headers.jshttp2.Http2ServerResponse
does not haveres.writableHighWaterMark
. test:parallel/test-http-outgoing-properties.js related issue:https://github.com/nodejs/node/issues/28969http2.Http2ServerResponse
does not haveres.writableLength
. test:parallel/test-http-outgoing-properties.js related issue:https://github.com/nodejs/node/issues/28969http2.Http2ServerResponse
does not haveres.writableFinished
. test:parallel/test-http-outgoing-writableFinished.js related issue:https://github.com/nodejs/node/issues/29230http2.Http2ServerRequest.headers
returns headers which is initialized byObject.create(null)
test:parallel/test-http-raw-headers.jshttp2.Http2ServerResponse.removeHeader
cannot remove a header nodejs automatically adds(e.g. 'date'). test:parallel/test-http-remove-header-stays-removed.jshttp2.Http2ServerResponse.write
afterhttp2.Http2ServerResponse.end
returnsfalse
. test:parallel/test-http-res-write-after-end.jshttp2.Http2ServerResponse.write
afterhttp2.Http2ServerResponse.end
does not emmit 'error'. test:parallel/test-http-res-write-after-end.js,parallel/test-http-server-write-after-end.js Fixed by https://github.com/nodejs/node/pull/30964http2.Http2ServerResponse.write
with array input does not cause an error. test:parallel/test-http-res-write-after-end.jshttp2.Http2ServerResponse.end
with array input does not cause an error. test:parallel/test-http-res-write-after-end.jshttp2.Http2ServerResponse
's error code start with 'ERR_HTTP2'. test:parallel/test-http-response-add-header-after-sent.js,parallel/test-http-response-remove-header-after-sent.js,parallel/test-http-response-statuscode.js,parallel/test-http-write-head.jshttp2.Http2ServerResponse.setHeader
andhttp2.Http2ServerResponse.writeHead
with multiple value of 'content-length' causes an error. test:parallel/test-http-response-multi-content-length.jshttp2.Http2ServerResponse.setHeader
andhttp2.Http2ServerResponse.writeHead
with multiple value of 'content-type' or other headers expected single value causes an error. test:parallel/test-http-response-multiheaders.jshttp2.Http2ServerResponse.writeHead
with invalid character does not cause error. test:parallel/test-http-response-splitting.jshttp2.Http2ServerResponse
sending 'Trailer' header without 'transfer encoding: chunked' does not cause error. test:parallel/test-http-server-de-chunked-trailer.jshttp2.Http2ServerResponse.writeHead
cannot set multiple value of header with nested array. test:parallel/test-http-set-cookies.jshttp2.Http2ServerResponse.setTimeout
does not pass a socket to cb function. test:parallel/test-http-set-timeout-server.jshttp2.Http2ServerResponse.writeHead
with invalid status message does not cause an error. test:parallel/test-http-status-reason-invalid-chars.jsstream.pipe(http2.Http2ServerResponse)
eventually emmits both 'finish' and 'close' events. test:parallel/test-http-writable-true-after-close.jshttp2.Http2ServerResponse.end
does not execute callback whenhttp2.Http2ServerResponse.end
has already been called. test:parallel/test-http-outgoing-end-multiple.js related PR:https://github.com/nodejs/node/pull/29229http2.Http2ServerRequest.connection.setTimeout
is called, 'timeout' event is not emitted. test:parallel/test-http-set-timeout.jshttp2.Http2ServerResponse.finished
turn true without callingend
. https://github.com/nodejs/node/pull/24347http2.Http2ServerResponse.write
throw err when connection is invalid. http1 do nothing then. https://github.com/nodejs/node/issues/29529http2.Http2Server
emitserror
when a connection is unexpectedly closed. In that case,http1.Server
emitsaborted
. https://github.com/nodejs/node/issues/28267http2.Http2ServerResponse.write(data)
afterhttp2.Http2ServerResponse.writeHead()
with status 304 or 204 cause error. https://github.com/expressjs/compression/pull/128#issuecomment-527730832