You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Description:
I'm using koa with http2.createSecureServer and during some requests Request.secure turns from initial true to false. I've seen that the property indirectly checks whether Request.req.socket.encrypted is truthy. This is only true if socket is of type TLSSocket which is initially the case. But when the bug occurs Http2ServerRequest.socket switches its underlying type to ServerHttp2Stream.
As far as I can tell it has to do with the client sending a RST_STREAM and node.js closing the HttpStream (aborted event is triggered on the stream). But I would argue this should either leave the secure flag true or throw an error when trying to access it. Solely relying on socket.encrypted doesn't seem to be enough for HTTP2.
I've stumbled upon this error while trying to set a secure cookie which lead to a pretty misleading error: Cannot send secure cookie over unencrypted connection.
Describe the bug
Node.js version: 19.4.0
OS version: Windows 10
Description:
I'm using koa with
http2.createSecureServer
and during some requestsRequest.secure
turns from initialtrue
tofalse
. I've seen that the property indirectly checks whetherRequest.req.socket.encrypted
is truthy. This is only true ifsocket
is of typeTLSSocket
which is initially the case. But when the bug occursHttp2ServerRequest.socket
switches its underlying type toServerHttp2Stream
.As far as I can tell it has to do with the client sending a
RST_STREAM
and node.js closing theHttpStream
(aborted
event is triggered on the stream). But I would argue this should either leave thesecure
flagtrue
or throw an error when trying to access it. Solely relying onsocket.encrypted
doesn't seem to be enough for HTTP2.I've stumbled upon this error while trying to set a secure cookie which lead to a pretty misleading error:
Cannot send secure cookie over unencrypted connection.
Actual behavior
Request.secure
isfalse
.Expected behavior
Request.secure
should betrue
or throw an error.Code to reproduce
Checklist
The text was updated successfully, but these errors were encountered: