MCPcopy Index your code
hub / github.com/nodejs/node / initializeOptions

Function initializeOptions

lib/internal/http2/core.js:3358–3413  ·  view source on GitHub ↗
(options)

Source from the content-addressed store, hash-verified

3356}
3357
3358function initializeOptions(options) {
3359 assertIsObject(options, 'options');
3360 options = { ...options };
3361 assertIsObject(options.settings, 'options.settings');
3362 options.settings = { ...options.settings };
3363
3364 assertIsArray(options.remoteCustomSettings, 'options.remoteCustomSettings');
3365 if (options.remoteCustomSettings) {
3366 options.remoteCustomSettings = [ ...options.remoteCustomSettings ];
3367 if (options.remoteCustomSettings.length > MAX_ADDITIONAL_SETTINGS)
3368 throw new ERR_HTTP2_TOO_MANY_CUSTOM_SETTINGS();
3369 }
3370
3371 if (options.maxSessionInvalidFrames !== undefined)
3372 validateUint32(options.maxSessionInvalidFrames, 'options.maxSessionInvalidFrames');
3373
3374 if (options.maxSessionRejectedStreams !== undefined) {
3375 validateUint32(
3376 options.maxSessionRejectedStreams,
3377 'options.maxSessionRejectedStreams',
3378 );
3379 }
3380
3381 if (options.unknownProtocolTimeout !== undefined)
3382 validateUint32(options.unknownProtocolTimeout, 'options.unknownProtocolTimeout');
3383 else
3384 // TODO(danbev): is this a good default value?
3385 options.unknownProtocolTimeout = 10000;
3386
3387 if (options.strictSingleValueFields !== undefined) {
3388 validateBoolean(
3389 options.strictSingleValueFields,
3390 'options.strictSingleValueFields',
3391 );
3392 } else {
3393 options.strictSingleValueFields = true;
3394 }
3395
3396
3397 // Initialize http1Options bag for HTTP/1 fallback when allowHTTP1 is true.
3398 // This bag is passed to storeHTTPOptions() to configure HTTP/1 server
3399 // behavior (timeouts, IncomingMessage/ServerResponse classes, etc.).
3400 options.http1Options = { ...options.http1Options };
3401
3402 // Backward compat: migrate deprecated top-level Http1 options (DEP0201)
3403 if (options.Http1IncomingMessage !== undefined) {
3404 options.http1Options.IncomingMessage ??= options.Http1IncomingMessage;
3405 }
3406 if (options.Http1ServerResponse !== undefined) {
3407 options.http1Options.ServerResponse ??= options.Http1ServerResponse;
3408 }
3409
3410 options.Http2ServerRequest ||= Http2ServerRequest;
3411 options.Http2ServerResponse ||= Http2ServerResponse;
3412 return options;
3413}
3414
3415function initializeTLSOptions(options, servername) {

Callers 3

initializeTLSOptionsFunction · 0.85
constructorMethod · 0.85
performServerHandshakeFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…