1 | ;
|
2 |
|
3 | function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
4 | function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
5 | function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
6 | function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return typeof key === "symbol" ? key : String(key); }
|
7 | function _toPrimitive(input, hint) { if (typeof input !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (typeof res !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
|
8 | const Stream = require('node:stream');
|
9 | const net = require('node:net');
|
10 | const tls = require('node:tls');
|
11 | // eslint-disable-next-line node/no-deprecated-api
|
12 | const _require = require('node:url'),
|
13 | parse = _require.parse;
|
14 | const process = require('node:process');
|
15 | const semverGte = require('semver/functions/gte');
|
16 | let http2;
|
17 | if (semverGte(process.version, 'v10.10.0')) http2 = require('node:http2');else throw new Error('superagent: this version of Node.js does not support http2');
|
18 | const _http2$constants = http2.constants,
|
19 | HTTP2_HEADER_PATH = _http2$constants.HTTP2_HEADER_PATH,
|
20 | HTTP2_HEADER_STATUS = _http2$constants.HTTP2_HEADER_STATUS,
|
21 | HTTP2_HEADER_METHOD = _http2$constants.HTTP2_HEADER_METHOD,
|
22 | HTTP2_HEADER_AUTHORITY = _http2$constants.HTTP2_HEADER_AUTHORITY,
|
23 | HTTP2_HEADER_HOST = _http2$constants.HTTP2_HEADER_HOST,
|
24 | HTTP2_HEADER_SET_COOKIE = _http2$constants.HTTP2_HEADER_SET_COOKIE,
|
25 | NGHTTP2_CANCEL = _http2$constants.NGHTTP2_CANCEL;
|
26 | function setProtocol(protocol) {
|
27 | return {
|
28 | request(options) {
|
29 | return new Request(protocol, options);
|
30 | }
|
31 | };
|
32 | }
|
33 | class Request extends Stream {
|
34 | constructor(protocol, options) {
|
35 | super();
|
36 | const defaultPort = protocol === 'https:' ? 443 : 80;
|
37 | const defaultHost = 'localhost';
|
38 | const port = options.port || defaultPort;
|
39 | const host = options.host || defaultHost;
|
40 | delete options.port;
|
41 | delete options.host;
|
42 | this.method = options.method;
|
43 | this.path = options.path;
|
44 | this.protocol = protocol;
|
45 | this.host = host;
|
46 | delete options.method;
|
47 | delete options.path;
|
48 | const sessionOptions = _objectSpread({}, options);
|
49 | if (options.socketPath) {
|
50 | sessionOptions.socketPath = options.socketPath;
|
51 | sessionOptions.createConnection = this.createUnixConnection.bind(this);
|
52 | }
|
53 | this._headers = {};
|
54 | const session = http2.connect(`${protocol}//${host}:${port}`, sessionOptions);
|
55 | this.setHeader('host', `${host}:${port}`);
|
56 | session.on('error', error => this.emit('error', error));
|
57 | this.session = session;
|
58 | }
|
59 | createUnixConnection(authority, options) {
|
60 | switch (this.protocol) {
|
61 | case 'http:':
|
62 | {
|
63 | return net.connect(options.socketPath);
|
64 | }
|
65 | case 'https:':
|
66 | {
|
67 | options.ALPNProtocols = ['h2'];
|
68 | options.servername = this.host;
|
69 | options.allowHalfOpen = true;
|
70 | return tls.connect(options.socketPath, options);
|
71 | }
|
72 | default:
|
73 | {
|
74 | throw new Error('Unsupported protocol', this.protocol);
|
75 | }
|
76 | }
|
77 | }
|
78 | setNoDelay(bool) {
|
79 | // We can not use setNoDelay with HTTP/2.
|
80 | // Node 10 limits http2session.socket methods to ones safe to use with HTTP/2.
|
81 | // See also https://nodejs.org/api/http2.html#http2_http2session_socket
|
82 | }
|
83 | getFrame() {
|
84 | if (this.frame) {
|
85 | return this.frame;
|
86 | }
|
87 | const method = {
|
88 | [HTTP2_HEADER_PATH]: this.path,
|
89 | [HTTP2_HEADER_METHOD]: this.method
|
90 | };
|
91 | let headers = this.mapToHttp2Header(this._headers);
|
92 | headers = Object.assign(headers, method);
|
93 | const frame = this.session.request(headers);
|
94 | frame.once('response', (headers, flags) => {
|
95 | headers = this.mapToHttpHeader(headers);
|
96 | frame.headers = headers;
|
97 | frame.statusCode = headers[HTTP2_HEADER_STATUS];
|
98 | frame.status = frame.statusCode;
|
99 | this.emit('response', frame);
|
100 | });
|
101 | this._headerSent = true;
|
102 | frame.once('drain', () => this.emit('drain'));
|
103 | frame.on('error', error => this.emit('error', error));
|
104 | frame.on('close', () => this.session.close());
|
105 | this.frame = frame;
|
106 | return frame;
|
107 | }
|
108 | mapToHttpHeader(headers) {
|
109 | const keys = Object.keys(headers);
|
110 | const http2Headers = {};
|
111 | for (var _i = 0, _keys = keys; _i < _keys.length; _i++) {
|
112 | let key = _keys[_i];
|
113 | let value = headers[key];
|
114 | key = key.toLowerCase();
|
115 | switch (key) {
|
116 | case HTTP2_HEADER_SET_COOKIE:
|
117 | {
|
118 | value = Array.isArray(value) ? value : [value];
|
119 | break;
|
120 | }
|
121 | default:
|
122 | {
|
123 | break;
|
124 | }
|
125 | }
|
126 | http2Headers[key] = value;
|
127 | }
|
128 | return http2Headers;
|
129 | }
|
130 | mapToHttp2Header(headers) {
|
131 | const keys = Object.keys(headers);
|
132 | const http2Headers = {};
|
133 | for (var _i2 = 0, _keys2 = keys; _i2 < _keys2.length; _i2++) {
|
134 | let key = _keys2[_i2];
|
135 | let value = headers[key];
|
136 | key = key.toLowerCase();
|
137 | switch (key) {
|
138 | case HTTP2_HEADER_HOST:
|
139 | {
|
140 | key = HTTP2_HEADER_AUTHORITY;
|
141 | value = /^http:\/\/|^https:\/\//.test(value) ? parse(value).host : value;
|
142 | break;
|
143 | }
|
144 | default:
|
145 | {
|
146 | break;
|
147 | }
|
148 | }
|
149 | http2Headers[key] = value;
|
150 | }
|
151 | return http2Headers;
|
152 | }
|
153 | setHeader(name, value) {
|
154 | this._headers[name.toLowerCase()] = value;
|
155 | }
|
156 | getHeader(name) {
|
157 | return this._headers[name.toLowerCase()];
|
158 | }
|
159 | write(data, encoding) {
|
160 | const frame = this.getFrame();
|
161 | return frame.write(data, encoding);
|
162 | }
|
163 | pipe(stream, options) {
|
164 | const frame = this.getFrame();
|
165 | return frame.pipe(stream, options);
|
166 | }
|
167 | end(data) {
|
168 | const frame = this.getFrame();
|
169 | frame.end(data);
|
170 | }
|
171 | abort(data) {
|
172 | const frame = this.getFrame();
|
173 | frame.close(NGHTTP2_CANCEL);
|
174 | this.session.destroy();
|
175 | }
|
176 | }
|
177 | exports.setProtocol = setProtocol;
|
178 | //# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJuYW1lcyI6WyJTdHJlYW0iLCJyZXF1aXJlIiwibmV0IiwidGxzIiwiX3JlcXVpcmUiLCJwYXJzZSIsInByb2Nlc3MiLCJzZW12ZXJHdGUiLCJodHRwMiIsInZlcnNpb24iLCJFcnJvciIsIl9odHRwMiRjb25zdGFudHMiLCJjb25zdGFudHMiLCJIVFRQMl9IRUFERVJfUEFUSCIsIkhUVFAyX0hFQURFUl9TVEFUVVMiLCJIVFRQMl9IRUFERVJfTUVUSE9EIiwiSFRUUDJfSEVBREVSX0FVVEhPUklUWSIsIkhUVFAyX0hFQURFUl9IT1NUIiwiSFRUUDJfSEVBREVSX1NFVF9DT09LSUUiLCJOR0hUVFAyX0NBTkNFTCIsInNldFByb3RvY29sIiwicHJvdG9jb2wiLCJyZXF1ZXN0Iiwib3B0aW9ucyIsIlJlcXVlc3QiLCJjb25zdHJ1Y3R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