1 |
|
2 |
|
3 |
|
4 |
|
5 |
|
6 |
|
7 |
|
8 |
|
9 |
|
10 |
|
11 |
|
12 |
|
13 |
|
14 |
|
15 |
|
16 | const EventEmitter = require('events');
|
17 | const {helper, debugError} = require('./helper');
|
18 | const Multimap = require('./Multimap');
|
19 |
|
20 | class NetworkManager extends EventEmitter {
|
21 | |
22 |
|
23 |
|
24 |
|
25 | constructor(client, frameManager) {
|
26 | super();
|
27 | this._client = client;
|
28 | this._frameManager = frameManager;
|
29 |
|
30 | this._requestIdToRequest = new Map();
|
31 |
|
32 | this._interceptionIdToRequest = new Map();
|
33 |
|
34 | this._extraHTTPHeaders = {};
|
35 |
|
36 | this._offline = false;
|
37 |
|
38 |
|
39 | this._credentials = null;
|
40 |
|
41 | this._attemptedAuthentications = new Set();
|
42 | this._userRequestInterceptionEnabled = false;
|
43 | this._protocolRequestInterceptionEnabled = false;
|
44 |
|
45 | this._requestHashToRequestIds = new Multimap();
|
46 |
|
47 | this._requestHashToInterceptionIds = new Multimap();
|
48 |
|
49 | this._client.on('Network.requestWillBeSent', this._onRequestWillBeSent.bind(this));
|
50 | this._client.on('Network.requestIntercepted', this._onRequestIntercepted.bind(this));
|
51 | this._client.on('Network.requestServedFromCache', this._onRequestServedFromCache.bind(this));
|
52 | this._client.on('Network.responseReceived', this._onResponseReceived.bind(this));
|
53 | this._client.on('Network.loadingFinished', this._onLoadingFinished.bind(this));
|
54 | this._client.on('Network.loadingFailed', this._onLoadingFailed.bind(this));
|
55 | }
|
56 |
|
57 | |
58 |
|
59 |
|
60 | async authenticate(credentials) {
|
61 | this._credentials = credentials;
|
62 | await this._updateProtocolRequestInterception();
|
63 | }
|
64 |
|
65 | |
66 |
|
67 |
|
68 | async setExtraHTTPHeaders(extraHTTPHeaders) {
|
69 | this._extraHTTPHeaders = {};
|
70 | for (const key of Object.keys(extraHTTPHeaders)) {
|
71 | const value = extraHTTPHeaders[key];
|
72 | console.assert(helper.isString(value), `Expected value of header "${key}" to be String, but "${typeof value}" is found.`);
|
73 | this._extraHTTPHeaders[key.toLowerCase()] = value;
|
74 | }
|
75 | await this._client.send('Network.setExtraHTTPHeaders', { headers: this._extraHTTPHeaders });
|
76 | }
|
77 |
|
78 | |
79 |
|
80 |
|
81 | extraHTTPHeaders() {
|
82 | return Object.assign({}, this._extraHTTPHeaders);
|
83 | }
|
84 |
|
85 | |
86 |
|
87 |
|
88 | async setOfflineMode(value) {
|
89 | if (this._offline === value)
|
90 | return;
|
91 | this._offline = value;
|
92 | await this._client.send('Network.emulateNetworkConditions', {
|
93 | offline: this._offline,
|
94 |
|
95 | latency: 0,
|
96 | downloadThroughput: -1,
|
97 | uploadThroughput: -1
|
98 | });
|
99 | }
|
100 |
|
101 | |
102 |
|
103 |
|
104 | async setUserAgent(userAgent) {
|
105 | await this._client.send('Network.setUserAgentOverride', { userAgent });
|
106 | }
|
107 |
|
108 | |
109 |
|
110 |
|
111 | async setRequestInterception(value) {
|
112 | this._userRequestInterceptionEnabled = value;
|
113 | await this._updateProtocolRequestInterception();
|
114 | }
|
115 |
|
116 | async _updateProtocolRequestInterception() {
|
117 | const enabled = this._userRequestInterceptionEnabled || !!this._credentials;
|
118 | if (enabled === this._protocolRequestInterceptionEnabled)
|
119 | return;
|
120 | this._protocolRequestInterceptionEnabled = enabled;
|
121 | const patterns = enabled ? [{urlPattern: '*'}] : [];
|
122 | await Promise.all([
|
123 | this._client.send('Network.setCacheDisabled', {cacheDisabled: enabled}),
|
124 | this._client.send('Network.setRequestInterception', {patterns})
|
125 | ]);
|
126 | }
|
127 |
|
128 | |
129 |
|
130 |
|
131 | _onRequestIntercepted(event) {
|
132 | if (event.authChallenge) {
|
133 |
|
134 | let response = 'Default';
|
135 | if (this._attemptedAuthentications.has(event.interceptionId)) {
|
136 | response = 'CancelAuth';
|
137 | } else if (this._credentials) {
|
138 | response = 'ProvideCredentials';
|
139 | this._attemptedAuthentications.add(event.interceptionId);
|
140 | }
|
141 | const {username, password} = this._credentials || {username: undefined, password: undefined};
|
142 | this._client.send('Network.continueInterceptedRequest', {
|
143 | interceptionId: event.interceptionId,
|
144 | authChallengeResponse: { response, username, password }
|
145 | }).catch(debugError);
|
146 | return;
|
147 | }
|
148 | if (!this._userRequestInterceptionEnabled && this._protocolRequestInterceptionEnabled) {
|
149 | this._client.send('Network.continueInterceptedRequest', {
|
150 | interceptionId: event.interceptionId
|
151 | }).catch(debugError);
|
152 | }
|
153 |
|
154 | if (event.redirectUrl) {
|
155 | const request = this._interceptionIdToRequest.get(event.interceptionId);
|
156 | if (request) {
|
157 | this._handleRequestRedirect(request, event.responseStatusCode, event.responseHeaders, false , false , null );
|
158 | this._handleRequestStart(request._requestId, event.interceptionId, event.redirectUrl, event.resourceType, event.request, event.frameId, request._redirectChain);
|
159 | }
|
160 | return;
|
161 | }
|
162 | const requestHash = generateRequestHash(event.request);
|
163 | const requestId = this._requestHashToRequestIds.firstValue(requestHash);
|
164 | if (requestId) {
|
165 | this._requestHashToRequestIds.delete(requestHash, requestId);
|
166 | this._handleRequestStart(requestId, event.interceptionId, event.request.url, event.resourceType, event.request, event.frameId, []);
|
167 | } else {
|
168 | this._requestHashToInterceptionIds.set(requestHash, event.interceptionId);
|
169 | this._handleRequestStart(null, event.interceptionId, event.request.url, event.resourceType, event.request, event.frameId, []);
|
170 | }
|
171 | }
|
172 |
|
173 | |
174 |
|
175 |
|
176 | _onRequestServedFromCache(event) {
|
177 | const request = this._requestIdToRequest.get(event.requestId);
|
178 | if (request)
|
179 | request._fromMemoryCache = true;
|
180 | }
|
181 |
|
182 | |
183 |
|
184 |
|
185 |
|
186 |
|
187 |
|
188 |
|
189 |
|
190 | _handleRequestRedirect(request, redirectStatus, redirectHeaders, fromDiskCache, fromServiceWorker, securityDetails) {
|
191 | const response = new Response(this._client, request, redirectStatus, redirectHeaders, fromDiskCache, fromServiceWorker, securityDetails);
|
192 | request._response = response;
|
193 | request._redirectChain.push(request);
|
194 | response._bodyLoadedPromiseFulfill.call(null, new Error('Response body is unavailable for redirect responses'));
|
195 | this._requestIdToRequest.delete(request._requestId);
|
196 | this._interceptionIdToRequest.delete(request._interceptionId);
|
197 | this._attemptedAuthentications.delete(request._interceptionId);
|
198 | this.emit(NetworkManager.Events.Response, response);
|
199 | this.emit(NetworkManager.Events.RequestFinished, request);
|
200 | }
|
201 |
|
202 | |
203 |
|
204 |
|
205 |
|
206 |
|
207 |
|
208 |
|
209 |
|
210 |
|
211 | _handleRequestStart(requestId, interceptionId, url, resourceType, requestPayload, frameId, redirectChain) {
|
212 | let frame = null;
|
213 | if (frameId)
|
214 | frame = this._frameManager.frame(frameId);
|
215 | const request = new Request(this._client, requestId, interceptionId, this._userRequestInterceptionEnabled, url, resourceType, requestPayload, frame, redirectChain);
|
216 | if (requestId)
|
217 | this._requestIdToRequest.set(requestId, request);
|
218 | if (interceptionId)
|
219 | this._interceptionIdToRequest.set(interceptionId, request);
|
220 | this.emit(NetworkManager.Events.Request, request);
|
221 | }
|
222 |
|
223 | |
224 |
|
225 |
|
226 | _onRequestWillBeSent(event) {
|
227 | if (this._protocolRequestInterceptionEnabled) {
|
228 |
|
229 | if (event.redirectResponse)
|
230 | return;
|
231 | const requestHash = generateRequestHash(event.request);
|
232 | const interceptionId = this._requestHashToInterceptionIds.firstValue(requestHash);
|
233 | const request = interceptionId ? this._interceptionIdToRequest.get(interceptionId) : null;
|
234 | if (request) {
|
235 | request._requestId = event.requestId;
|
236 | this._requestIdToRequest.set(event.requestId, request);
|
237 | this._requestHashToInterceptionIds.delete(requestHash, interceptionId);
|
238 | } else {
|
239 | this._requestHashToRequestIds.set(requestHash, event.requestId);
|
240 | }
|
241 | return;
|
242 | }
|
243 | let redirectChain = [];
|
244 | if (event.redirectResponse) {
|
245 | const request = this._requestIdToRequest.get(event.requestId);
|
246 |
|
247 | if (request) {
|
248 | this._handleRequestRedirect(request, event.redirectResponse.status, event.redirectResponse.headers, event.redirectResponse.fromDiskCache, event.redirectResponse.fromServiceWorker, event.redirectResponse.securityDetails);
|
249 | redirectChain = request._redirectChain;
|
250 | }
|
251 | }
|
252 | this._handleRequestStart(event.requestId, null, event.request.url, event.type, event.request, event.frameId, redirectChain);
|
253 | }
|
254 |
|
255 | |
256 |
|
257 |
|
258 | _onResponseReceived(event) {
|
259 | const request = this._requestIdToRequest.get(event.requestId);
|
260 |
|
261 | if (!request)
|
262 | return;
|
263 | const response = new Response(this._client, request, event.response.status, event.response.headers,
|
264 | event.response.fromDiskCache, event.response.fromServiceWorker, event.response.securityDetails);
|
265 | request._response = response;
|
266 | this.emit(NetworkManager.Events.Response, response);
|
267 | }
|
268 |
|
269 | |
270 |
|
271 |
|
272 | _onLoadingFinished(event) {
|
273 | const request = this._requestIdToRequest.get(event.requestId);
|
274 |
|
275 |
|
276 | if (!request)
|
277 | return;
|
278 | request.response()._bodyLoadedPromiseFulfill.call(null);
|
279 | this._requestIdToRequest.delete(request._requestId);
|
280 | this._interceptionIdToRequest.delete(request._interceptionId);
|
281 | this._attemptedAuthentications.delete(request._interceptionId);
|
282 | this.emit(NetworkManager.Events.RequestFinished, request);
|
283 | }
|
284 |
|
285 | |
286 |
|
287 |
|
288 | _onLoadingFailed(event) {
|
289 | const request = this._requestIdToRequest.get(event.requestId);
|
290 |
|
291 |
|
292 | if (!request)
|
293 | return;
|
294 | request._failureText = event.errorText;
|
295 | const response = request.response();
|
296 | if (response)
|
297 | response._bodyLoadedPromiseFulfill.call(null);
|
298 | this._requestIdToRequest.delete(request._requestId);
|
299 | this._interceptionIdToRequest.delete(request._interceptionId);
|
300 | this._attemptedAuthentications.delete(request._interceptionId);
|
301 | this.emit(NetworkManager.Events.RequestFailed, request);
|
302 | }
|
303 | }
|
304 |
|
305 | class Request {
|
306 | |
307 |
|
308 |
|
309 |
|
310 |
|
311 |
|
312 |
|
313 |
|
314 |
|
315 |
|
316 |
|
317 | constructor(client, requestId, interceptionId, allowInterception, url, resourceType, payload, frame, redirectChain) {
|
318 | this._client = client;
|
319 | this._requestId = requestId;
|
320 | this._interceptionId = interceptionId;
|
321 | this._allowInterception = allowInterception;
|
322 | this._interceptionHandled = false;
|
323 | this._response = null;
|
324 | this._failureText = null;
|
325 |
|
326 | this._url = url;
|
327 | this._resourceType = resourceType.toLowerCase();
|
328 | this._method = payload.method;
|
329 | this._postData = payload.postData;
|
330 | this._headers = {};
|
331 | this._frame = frame;
|
332 | this._redirectChain = redirectChain;
|
333 | for (const key of Object.keys(payload.headers))
|
334 | this._headers[key.toLowerCase()] = payload.headers[key];
|
335 |
|
336 | this._fromMemoryCache = false;
|
337 | }
|
338 |
|
339 | |
340 |
|
341 |
|
342 | url() {
|
343 | return this._url;
|
344 | }
|
345 |
|
346 | |
347 |
|
348 |
|
349 | resourceType() {
|
350 | return this._resourceType;
|
351 | }
|
352 |
|
353 | |
354 |
|
355 |
|
356 | method() {
|
357 | return this._method;
|
358 | }
|
359 |
|
360 | |
361 |
|
362 |
|
363 | postData() {
|
364 | return this._postData;
|
365 | }
|
366 |
|
367 | |
368 |
|
369 |
|
370 | headers() {
|
371 | return this._headers;
|
372 | }
|
373 |
|
374 | |
375 |
|
376 |
|
377 | response() {
|
378 | return this._response;
|
379 | }
|
380 |
|
381 | |
382 |
|
383 |
|
384 | frame() {
|
385 | return this._frame;
|
386 | }
|
387 |
|
388 | |
389 |
|
390 |
|
391 | redirectChain() {
|
392 | return this._redirectChain.slice();
|
393 | }
|
394 |
|
395 | |
396 |
|
397 |
|
398 | failure() {
|
399 | if (!this._failureText)
|
400 | return null;
|
401 | return {
|
402 | errorText: this._failureText
|
403 | };
|
404 | }
|
405 |
|
406 | |
407 |
|
408 |
|
409 | async continue(overrides = {}) {
|
410 | console.assert(this._allowInterception, 'Request Interception is not enabled!');
|
411 | console.assert(!this._interceptionHandled, 'Request is already handled!');
|
412 | this._interceptionHandled = true;
|
413 | await this._client.send('Network.continueInterceptedRequest', {
|
414 | interceptionId: this._interceptionId,
|
415 | url: overrides.url,
|
416 | method: overrides.method,
|
417 | postData: overrides.postData,
|
418 | headers: overrides.headers,
|
419 | }).catch(error => {
|
420 |
|
421 |
|
422 | debugError(error);
|
423 | });
|
424 | }
|
425 |
|
426 | |
427 |
|
428 |
|
429 | async respond(response) {
|
430 |
|
431 | if (this._url.startsWith('data:'))
|
432 | return;
|
433 | console.assert(this._allowInterception, 'Request Interception is not enabled!');
|
434 | console.assert(!this._interceptionHandled, 'Request is already handled!');
|
435 | this._interceptionHandled = true;
|
436 |
|
437 | const responseBody = response.body && helper.isString(response.body) ? Buffer.from((response.body)) : (response.body || null);
|
438 |
|
439 | const responseHeaders = {};
|
440 | if (response.headers) {
|
441 | for (const header of Object.keys(response.headers))
|
442 | responseHeaders[header.toLowerCase()] = response.headers[header];
|
443 | }
|
444 | if (response.contentType)
|
445 | responseHeaders['content-type'] = response.contentType;
|
446 | if (responseBody && !('content-length' in responseHeaders)) {
|
447 |
|
448 | responseHeaders['content-length'] = Buffer.byteLength(responseBody);
|
449 | }
|
450 |
|
451 | const statusCode = response.status || 200;
|
452 | const statusText = statusTexts[statusCode] || '';
|
453 | const statusLine = `HTTP/1.1 ${statusCode} ${statusText}`;
|
454 |
|
455 | const CRLF = '\r\n';
|
456 | let text = statusLine + CRLF;
|
457 | for (const header of Object.keys(responseHeaders))
|
458 | text += header + ': ' + responseHeaders[header] + CRLF;
|
459 | text += CRLF;
|
460 | let responseBuffer = Buffer.from(text, 'utf8');
|
461 | if (responseBody)
|
462 | responseBuffer = Buffer.concat([responseBuffer, responseBody]);
|
463 |
|
464 | await this._client.send('Network.continueInterceptedRequest', {
|
465 | interceptionId: this._interceptionId,
|
466 | rawResponse: responseBuffer.toString('base64')
|
467 | }).catch(error => {
|
468 |
|
469 |
|
470 | debugError(error);
|
471 | });
|
472 | }
|
473 |
|
474 | |
475 |
|
476 |
|
477 | async abort(errorCode = 'failed') {
|
478 | const errorReason = errorReasons[errorCode];
|
479 | console.assert(errorReason, 'Unknown error code: ' + errorCode);
|
480 | console.assert(this._allowInterception, 'Request Interception is not enabled!');
|
481 | console.assert(!this._interceptionHandled, 'Request is already handled!');
|
482 | this._interceptionHandled = true;
|
483 | await this._client.send('Network.continueInterceptedRequest', {
|
484 | interceptionId: this._interceptionId,
|
485 | errorReason
|
486 | }).catch(error => {
|
487 |
|
488 |
|
489 | debugError(error);
|
490 | });
|
491 | }
|
492 | }
|
493 |
|
494 | const errorReasons = {
|
495 | 'aborted': 'Aborted',
|
496 | 'accessdenied': 'AccessDenied',
|
497 | 'addressunreachable': 'AddressUnreachable',
|
498 | 'connectionaborted': 'ConnectionAborted',
|
499 | 'connectionclosed': 'ConnectionClosed',
|
500 | 'connectionfailed': 'ConnectionFailed',
|
501 | 'connectionrefused': 'ConnectionRefused',
|
502 | 'connectionreset': 'ConnectionReset',
|
503 | 'internetdisconnected': 'InternetDisconnected',
|
504 | 'namenotresolved': 'NameNotResolved',
|
505 | 'timedout': 'TimedOut',
|
506 | 'failed': 'Failed',
|
507 | };
|
508 |
|
509 | helper.tracePublicAPI(Request);
|
510 |
|
511 | class Response {
|
512 | |
513 |
|
514 |
|
515 |
|
516 |
|
517 |
|
518 |
|
519 |
|
520 |
|
521 | constructor(client, request, status, headers, fromDiskCache, fromServiceWorker, securityDetails) {
|
522 | this._client = client;
|
523 | this._request = request;
|
524 | this._contentPromise = null;
|
525 |
|
526 | this._bodyLoadedPromise = new Promise(fulfill => {
|
527 | this._bodyLoadedPromiseFulfill = fulfill;
|
528 | });
|
529 |
|
530 | this._status = status;
|
531 | this._url = request.url();
|
532 | this._fromDiskCache = fromDiskCache;
|
533 | this._fromServiceWorker = fromServiceWorker;
|
534 | this._headers = {};
|
535 | for (const key of Object.keys(headers))
|
536 | this._headers[key.toLowerCase()] = headers[key];
|
537 | this._securityDetails = null;
|
538 | if (securityDetails) {
|
539 | this._securityDetails = new SecurityDetails(
|
540 | securityDetails['subjectName'],
|
541 | securityDetails['issuer'],
|
542 | securityDetails['validFrom'],
|
543 | securityDetails['validTo'],
|
544 | securityDetails['protocol']);
|
545 | }
|
546 | }
|
547 |
|
548 | |
549 |
|
550 |
|
551 | url() {
|
552 | return this._url;
|
553 | }
|
554 |
|
555 | |
556 |
|
557 |
|
558 | ok() {
|
559 | return this._status === 0 || (this._status >= 200 && this._status <= 299);
|
560 | }
|
561 |
|
562 | |
563 |
|
564 |
|
565 | status() {
|
566 | return this._status;
|
567 | }
|
568 |
|
569 | |
570 |
|
571 |
|
572 | headers() {
|
573 | return this._headers;
|
574 | }
|
575 |
|
576 | |
577 |
|
578 |
|
579 | securityDetails() {
|
580 | return this._securityDetails;
|
581 | }
|
582 |
|
583 | |
584 |
|
585 |
|
586 | buffer() {
|
587 | if (!this._contentPromise) {
|
588 | this._contentPromise = this._bodyLoadedPromise.then(async error => {
|
589 | if (error)
|
590 | throw error;
|
591 | const response = await this._client.send('Network.getResponseBody', {
|
592 | requestId: this._request._requestId
|
593 | });
|
594 | return Buffer.from(response.body, response.base64Encoded ? 'base64' : 'utf8');
|
595 | });
|
596 | }
|
597 | return this._contentPromise;
|
598 | }
|
599 |
|
600 | |
601 |
|
602 |
|
603 | async text() {
|
604 | const content = await this.buffer();
|
605 | return content.toString('utf8');
|
606 | }
|
607 |
|
608 | |
609 |
|
610 |
|
611 | async json() {
|
612 | const content = await this.text();
|
613 | return JSON.parse(content);
|
614 | }
|
615 |
|
616 | |
617 |
|
618 |
|
619 | request() {
|
620 | return this._request;
|
621 | }
|
622 |
|
623 | |
624 |
|
625 |
|
626 | fromCache() {
|
627 | return this._fromDiskCache || this._request._fromMemoryCache;
|
628 | }
|
629 |
|
630 | |
631 |
|
632 |
|
633 | fromServiceWorker() {
|
634 | return this._fromServiceWorker;
|
635 | }
|
636 | }
|
637 | helper.tracePublicAPI(Response);
|
638 |
|
639 |
|
640 |
|
641 |
|
642 |
|
643 | function generateRequestHash(request) {
|
644 | let normalizedURL = request.url;
|
645 | try {
|
646 |
|
647 |
|
648 |
|
649 | normalizedURL = decodeURI(request.url);
|
650 | } catch (e) {
|
651 | }
|
652 | const hash = {
|
653 | url: normalizedURL,
|
654 | method: request.method,
|
655 | postData: request.postData,
|
656 | headers: {},
|
657 | };
|
658 |
|
659 | if (!normalizedURL.startsWith('data:')) {
|
660 | const headers = Object.keys(request.headers);
|
661 | headers.sort();
|
662 | for (let header of headers) {
|
663 | const headerValue = request.headers[header];
|
664 | header = header.toLowerCase();
|
665 | if (header === 'accept' || header === 'referer' || header === 'x-devtools-emulate-network-conditions-client-id')
|
666 | continue;
|
667 | hash.headers[header] = headerValue;
|
668 | }
|
669 | }
|
670 | return JSON.stringify(hash);
|
671 | }
|
672 |
|
673 | class SecurityDetails {
|
674 | |
675 |
|
676 |
|
677 |
|
678 |
|
679 |
|
680 |
|
681 |
|
682 | constructor(subjectName, issuer, validFrom, validTo, protocol) {
|
683 | this._subjectName = subjectName;
|
684 | this._issuer = issuer;
|
685 | this._validFrom = validFrom;
|
686 | this._validTo = validTo;
|
687 | this._protocol = protocol;
|
688 | }
|
689 |
|
690 | |
691 |
|
692 |
|
693 | subjectName() {
|
694 | return this._subjectName;
|
695 | }
|
696 |
|
697 | |
698 |
|
699 |
|
700 | issuer() {
|
701 | return this._issuer;
|
702 | }
|
703 |
|
704 | |
705 |
|
706 |
|
707 | validFrom() {
|
708 | return this._validFrom;
|
709 | }
|
710 |
|
711 | |
712 |
|
713 |
|
714 | validTo() {
|
715 | return this._validTo;
|
716 | }
|
717 |
|
718 | |
719 |
|
720 |
|
721 | protocol() {
|
722 | return this._protocol;
|
723 | }
|
724 | }
|
725 |
|
726 | NetworkManager.Events = {
|
727 | Request: 'request',
|
728 | Response: 'response',
|
729 | RequestFailed: 'requestfailed',
|
730 | RequestFinished: 'requestfinished',
|
731 | };
|
732 |
|
733 | const statusTexts = {
|
734 | '100': 'Continue',
|
735 | '101': 'Switching Protocols',
|
736 | '102': 'Processing',
|
737 | '200': 'OK',
|
738 | '201': 'Created',
|
739 | '202': 'Accepted',
|
740 | '203': 'Non-Authoritative Information',
|
741 | '204': 'No Content',
|
742 | '206': 'Partial Content',
|
743 | '207': 'Multi-Status',
|
744 | '208': 'Already Reported',
|
745 | '209': 'IM Used',
|
746 | '300': 'Multiple Choices',
|
747 | '301': 'Moved Permanently',
|
748 | '302': 'Found',
|
749 | '303': 'See Other',
|
750 | '304': 'Not Modified',
|
751 | '305': 'Use Proxy',
|
752 | '306': 'Switch Proxy',
|
753 | '307': 'Temporary Redirect',
|
754 | '308': 'Permanent Redirect',
|
755 | '400': 'Bad Request',
|
756 | '401': 'Unauthorized',
|
757 | '402': 'Payment Required',
|
758 | '403': 'Forbidden',
|
759 | '404': 'Not Found',
|
760 | '405': 'Method Not Allowed',
|
761 | '406': 'Not Acceptable',
|
762 | '407': 'Proxy Authentication Required',
|
763 | '408': 'Request Timeout',
|
764 | '409': 'Conflict',
|
765 | '410': 'Gone',
|
766 | '411': 'Length Required',
|
767 | '412': 'Precondition Failed',
|
768 | '413': 'Payload Too Large',
|
769 | '414': 'URI Too Long',
|
770 | '415': 'Unsupported Media Type',
|
771 | '416': 'Range Not Satisfiable',
|
772 | '417': 'Expectation Failed',
|
773 | '418': 'I\'m a teapot',
|
774 | '421': 'Misdirected Request',
|
775 | '422': 'Unprocessable Entity',
|
776 | '423': 'Locked',
|
777 | '424': 'Failed Dependency',
|
778 | '426': 'Upgrade Required',
|
779 | '428': 'Precondition Required',
|
780 | '429': 'Too Many Requests',
|
781 | '431': 'Request Header Fields Too Large',
|
782 | '451': 'Unavailable For Legal Reasons',
|
783 | '500': 'Internal Server Error',
|
784 | '501': 'Not Implemented',
|
785 | '502': 'Bad Gateway',
|
786 | '503': 'Service Unavailable',
|
787 | '504': 'Gateway Timeout',
|
788 | '505': 'HTTP Version Not Supported',
|
789 | '506': 'Variant Also Negotiates',
|
790 | '507': 'Insufficient Storage',
|
791 | '508': 'Loop Detected',
|
792 | '510': 'Not Extended',
|
793 | '511': 'Network Authentication Required',
|
794 | };
|
795 |
|
796 | module.exports = {Request, Response, NetworkManager};
|