(client)
| 8099 | this[kInterceptors] = [createRedirectInterceptor({ maxRedirections })]; |
| 8100 | } |
| 8101 | this[kUrl] = util.parseOrigin(url); |
| 8102 | this[kConnector] = connect2; |
| 8103 | this[kPipelining] = pipelining != null ? pipelining : 1; |
| 8104 | this[kMaxHeadersSize] = maxHeaderSize || http.maxHeaderSize; |
| 8105 | this[kKeepAliveDefaultTimeout] = keepAliveTimeout == null ? 4e3 : keepAliveTimeout; |
| 8106 | this[kKeepAliveMaxTimeout] = keepAliveMaxTimeout == null ? 6e5 : keepAliveMaxTimeout; |
| 8107 | this[kKeepAliveTimeoutThreshold] = keepAliveTimeoutThreshold == null ? 2e3 : keepAliveTimeoutThreshold; |
| 8108 | this[kKeepAliveTimeoutValue] = this[kKeepAliveDefaultTimeout]; |
| 8109 | this[kServerName] = null; |
| 8110 | this[kLocalAddress] = localAddress != null ? localAddress : null; |
| 8111 | this[kResuming] = 0; |
| 8112 | this[kNeedDrain] = 0; |
| 8113 | this[kHostHeader] = `host: ${this[kUrl].hostname}${this[kUrl].port ? `:${this[kUrl].port}` : ""}\r |
| 8114 | `; |
| 8115 | this[kBodyTimeout] = bodyTimeout != null ? bodyTimeout : 3e5; |
| 8116 | this[kHeadersTimeout] = headersTimeout != null ? headersTimeout : 3e5; |
| 8117 | this[kStrictContentLength] = strictContentLength == null ? true : strictContentLength; |
| 8118 | this[kMaxRedirections] = maxRedirections; |
| 8119 | this[kMaxRequests] = maxRequestsPerClient; |
| 8120 | this[kClosedResolve] = null; |
| 8121 | this[kMaxResponseSize] = maxResponseSize > -1 ? maxResponseSize : -1; |
| 8122 | this[kMaxConcurrentStreams] = maxConcurrentStreams != null ? maxConcurrentStreams : 100; |
| 8123 | this[kHTTPContext] = null; |
| 8124 | this[kQueue] = []; |
| 8125 | this[kRunningIdx] = 0; |
| 8126 | this[kPendingIdx] = 0; |
| 8127 | this[kResume] = (sync) => resume(this, sync); |
| 8128 | this[kOnError] = (err) => onError(this, err); |
| 8129 | } |
| 8130 | get pipelining() { |
| 8131 | return this[kPipelining]; |
| 8132 | } |
| 8133 | set pipelining(value) { |
| 8134 | this[kPipelining] = value; |
| 8135 | this[kResume](true); |
| 8136 | } |
| 8137 | get [kPending]() { |
| 8138 | return this[kQueue].length - this[kPendingIdx]; |
| 8139 | } |
| 8140 | get [kRunning]() { |
| 8141 | return this[kPendingIdx] - this[kRunningIdx]; |
| 8142 | } |
| 8143 | get [kSize]() { |
| 8144 | return this[kQueue].length - this[kRunningIdx]; |
| 8145 | } |
| 8146 | get [kConnected]() { |
| 8147 | return !!this[kHTTPContext] && !this[kConnecting] && !this[kHTTPContext].destroyed; |
| 8148 | } |
| 8149 | get [kBusy]() { |
| 8150 | var _a; |
| 8151 | return Boolean( |
| 8152 | ((_a = this[kHTTPContext]) == null ? void 0 : _a.busy(null)) || this[kSize] >= (getPipelining(this) || 1) || this[kPending] > 0 |
| 8153 | ); |
| 8154 | } |
| 8155 | /* istanbul ignore: only used for test */ |
| 8156 | [kConnect](cb) { |
| 8157 | connect(this); |
| 8158 | this.once("connect", cb); |
no test coverage detected