Skip to content

remoteSettings event is not emitted on a HTTP/2 session when given a socket with some data #35981

Closed
@szmarczak

Description

@szmarczak
  • Version: v15.1.0
  • Platform: Linux solus 5.6.19-159.current #1 SMP PREEMPT Fri Oct 16 17:49:06 UTC 2020 x86_64 GNU/Linux
  • Subsystem: http2

What steps will reproduce the bug?

const http2 = require('http2');
const tls = require('tls');

const options = {
  ALPNProtocols: ['h2'],
  host: 'nghttp2.org',
  servername: 'nghttp2.org',
  port: 443
};

const socket = tls.connect(options, async () => {
    console.log('Connected!');
    
    await new Promise(resolve => setTimeout(resolve, 1000));
    
    const session = http2.connect('https://nghttp2.org', {
        createConnection: () => socket
    });

    session.once('remoteSettings', () => {
        console.log('Received remote settings!');
    });
});

How often does it reproduce? Is there a required condition?

Always.

What is the expected behavior?

Connected!
HTTP2 13382: Http2Session client: setting up session handle
HTTP2 13382: Http2Session client: sending settings
HTTP2 13382: Http2Session client: submitting settings
HTTP2 13382: Http2Session client: created
HTTP2 13382: Http2Session connect [Function: createConnection]
(node:13382) Warning: Setting the NODE_DEBUG environment variable to 'http2' can expose sensitive data (such as passwords, tokens and authentication headers) in the resulting log.
(Use `node --trace-warnings ...` to show where the warning was created)
+HTTP2 13382: Http2Session client: new settings received
+Received remote settings!
HTTP2 13382: Http2Session client: settings received

What do you see instead?

szm@solus ~/Desktop/http2-wrapper $ export NODE_DEBUG=http2 && node demo.js 
Connected!
HTTP2 13357: Http2Session client: setting up session handle
HTTP2 13357: Http2Session client: sending settings
HTTP2 13357: Http2Session client: submitting settings
HTTP2 13357: Http2Session client: created
HTTP2 13357: Http2Session connect [Function: createConnection]
HTTP2 13357: Http2Session connect: injecting 40 already in buffer
(node:13357) Warning: Setting the NODE_DEBUG environment variable to 'http2' can expose sensitive data (such as passwords, tokens and authentication headers) in the resulting log.
(Use `node --trace-warnings ...` to show where the warning was created)
HTTP2 13357: Http2Session client: settings received

Additional information

Related with #35678 and #35475

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions