| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
1 parent b8aceac commit 9230fff
1 file changed
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -110,7 +110,7 @@ function ClientRequest(input, options, cb) { | |||
| 110 | 110 | options = Object.assign(input || {}, options); | |
| 111 | 111 | } | |
| 112 | 112 | ||
| 113 | - var agent = options.agent; | ||
| 113 | + let agent = options.agent; | ||
| 114 | 114 | const defaultAgent = options._defaultAgent || Agent.globalAgent; | |
| 115 | 115 | if (agent === false) { | |
| 116 | 116 | agent = new defaultAgent.constructor(); | |
@@ -128,11 +128,11 @@ function ClientRequest(input, options, cb) { | |||
| 128 | 128 | this.agent = agent; | |
| 129 | 129 | ||
| 130 | 130 | const protocol = options.protocol || defaultAgent.protocol; | |
| 131 | - var expectedProtocol = defaultAgent.protocol; | ||
| 131 | + let expectedProtocol = defaultAgent.protocol; | ||
| 132 | 132 | if (this.agent && this.agent.protocol) | |
| 133 | 133 | expectedProtocol = this.agent.protocol; | |
| 134 | 134 | ||
| 135 | - var path; | ||
| 135 | + let path; | ||
| 136 | 136 | if (options.path) { | |
| 137 | 137 | path = String(options.path); | |
| 138 | 138 | if (INVALID_PATH_REGEX.test(path)) | |
@@ -157,7 +157,7 @@ function ClientRequest(input, options, cb) { | |||
| 157 | 157 | if (options.timeout !== undefined) | |
| 158 | 158 | this.timeout = getTimerDuration(options.timeout, 'timeout'); | |
| 159 | 159 | ||
| 160 | - var method = options.method; | ||
| 160 | + let method = options.method; | ||
| 161 | 161 | const methodIsString = (typeof method === 'string'); | |
| 162 | 162 | if (method !== null && method !== undefined && !methodIsString) { | |
| 163 | 163 | throw new ERR_INVALID_ARG_TYPE('method', 'string', method); | |
@@ -197,7 +197,7 @@ function ClientRequest(input, options, cb) { | |||
| 197 | 197 | this.maxHeadersCount = null; | |
| 198 | 198 | this.reusedSocket = false; | |
| 199 | 199 | ||
| 200 | - var called = false; | ||
| 200 | + let called = false; | ||
| 201 | 201 | ||
| 202 | 202 | if (this.agent) { | |
| 203 | 203 | // If there is an agent we should default to Connection:keep-alive, | |
@@ -216,20 +216,20 @@ function ClientRequest(input, options, cb) { | |||
| 216 | 216 | const headersArray = Array.isArray(options.headers); | |
| 217 | 217 | if (!headersArray) { | |
| 218 | 218 | if (options.headers) { | |
| 219 | - var keys = Object.keys(options.headers); | ||
| 220 | - for (var i = 0; i < keys.length; i++) { | ||
| 221 | - var key = keys[i]; | ||
| 219 | + const keys = Object.keys(options.headers); | ||
| 220 | + for (let i = 0; i < keys.length; i++) { | ||
| 221 | + const key = keys[i]; | ||
| 222 | 222 | this.setHeader(key, options.headers[key]); | |
| 223 | 223 | } | |
| 224 | 224 | } | |
| 225 | 225 | ||
| 226 | 226 | if (host && !this.getHeader('host') && setHost) { | |
| 227 | - var hostHeader = host; | ||
| 227 | + let hostHeader = host; | ||
| 228 | 228 | ||
| 229 | 229 | // For the Host header, ensure that IPv6 addresses are enclosed | |
| 230 | 230 | // in square brackets, as defined by URI formatting | |
| 231 | 231 | // https://tools.ietf.org/html/rfc3986#section-3.2.2 | |
| 232 | - var posColon = hostHeader.indexOf(':'); | ||
| 232 | + const posColon = hostHeader.indexOf(':'); | ||
| 233 | 233 | if (posColon !== -1 && | |
| 234 | 234 | hostHeader.includes(':', posColon + 1) && | |
| 235 | 235 | hostHeader.charCodeAt(0) !== 91/* '[' */) { | |
@@ -461,8 +461,8 @@ function socketOnData(d) { | |||
| 461 | 461 | req.emit('error', ret); | |
| 462 | 462 | } else if (parser.incoming && parser.incoming.upgrade) { | |
| 463 | 463 | // Upgrade (if status code 101) or CONNECT | |
| 464 | - var bytesParsed = ret; | ||
| 465 | - var res = parser.incoming; | ||
| 464 | + const bytesParsed = ret; | ||
| 465 | + const res = parser.incoming; | ||
| 466 | 466 | req.res = res; | |
| 467 | 467 | ||
| 468 | 468 | socket.removeListener('data', socketOnData); | |
@@ -475,9 +475,9 @@ function socketOnData(d) { | |||
| 475 | 475 | parser.finish(); | |
| 476 | 476 | freeParser(parser, req, socket); | |
| 477 | 477 | ||
| 478 | - var bodyHead = d.slice(bytesParsed, d.length); | ||
| 478 | + const bodyHead = d.slice(bytesParsed, d.length); | ||
| 479 | 479 | ||
| 480 | - var eventName = req.method === 'CONNECT' ? 'connect' : 'upgrade'; | ||
| 480 | + const eventName = req.method === 'CONNECT' ? 'connect' : 'upgrade'; | ||
| 481 | 481 | if (req.listenerCount(eventName) > 0) { | |
| 482 | 482 | req.upgradeOrConnect = true; | |
| 483 | 483 | ||
| Back | FazBrowse Home | New Git URL |
0 commit comments