Skip to content

Nested HTTP/2 pushStream fails with error #19095

Closed
@robbie-mac

Description

@robbie-mac

Version: 9.7.1
Platform: 64-bit (Windows)
Subsystem: http/2

//server = http2.createSecureServer(); init code removed for brevity
server.addListener('stream', function (stream, headers) {
    let resourcePath = path.join(serverRootPath, headers[HTTP2_HEADER_PATH]);
    stream.respondWithFile(resourcePath, {
        'content-type': mimeTypes.get(resourcePath.match(mimeRegExp)[0]),
    });
    let pushResourcePath = <full path to pushed resource>;
    stream.pushStream({ ':path': pushResourcePath }, { 'parent': stream.id }, (err, stream, headers) => {
        stream.respondWithFile(path.join(serverRoot, pushResourcePath), {
            'content-type': mimeTypes.get(path.join(serverRoot, pushResourcePath).match(mimeRegExp)[0]),
        });
        let subPushResourcePath = <full path to sub pushed resource>;
        stream.pushStream({ ':path': subPushResourcePath }, { 'parent': stream.id }, (err, stream, headers) => {
            stream.respondWithFile(path.join(serverRoot, subPushResourcePath), {
                'content-type': mimeTypes.get(path.join(serverRoot, subPushResourcePath).match(mimeRegExp)[0]),
            });
        });
    });
}); 

The nested pushStream callback argument (err) is populated with this:

{ Error [ERR_HTTP2_ERROR]: Invalid argument
at ServerHttp2Stream.pushStream (internal/http2/core.js:2095:17)
at file:///D:/http2_experimental_server/src/server.mjs:106:24
at process._tickCallback (internal/process/next_tick.js:114:19)
code: 'ERR_HTTP2_ERROR',
name: 'Error [ERR_HTTP2_ERROR]',
errno: -501 }

Metadata

Metadata

Assignees

No one assigned

    Labels

    http2Issues or PRs related to the http2 subsystem.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions