@e-mc/request 0.5.7 → 0.5.9
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +6 -6
- package/README.md +4 -6
- package/http/host/index.d.ts +4 -4
- package/http/host/index.js +4 -4
- package/index.d.ts +4 -4
- package/index.js +1 -1
- package/package.json +29 -29
- package/util.d.ts +16 -16
package/LICENSE
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
Copyright 2024 An Pham
|
|
2
|
-
|
|
3
|
-
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
|
4
|
-
|
|
5
|
-
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
|
|
6
|
-
|
|
1
|
+
Copyright 2024 An Pham
|
|
2
|
+
|
|
3
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
|
4
|
+
|
|
5
|
+
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
|
|
6
|
+
|
|
7
7
|
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
package/README.md
CHANGED
package/http/host/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import type { HttpHostConstructor } from '../../../types/lib/request';
|
|
2
|
-
|
|
3
|
-
declare const HttpHost: HttpHostConstructor;
|
|
4
|
-
|
|
1
|
+
import type { HttpHostConstructor } from '../../../types/lib/request';
|
|
2
|
+
|
|
3
|
+
declare const HttpHost: HttpHostConstructor;
|
|
4
|
+
|
|
5
5
|
export = HttpHost;
|
package/http/host/index.js
CHANGED
|
@@ -102,28 +102,28 @@ class HttpHost {
|
|
|
102
102
|
return this._tlsConnect || (this._tlsConnect = new Promise(resolve => {
|
|
103
103
|
const alpn = 'h' + version;
|
|
104
104
|
const socket = tls.connect(+this.port, this.hostname, { ALPNProtocols: [alpn], requestCert: true, rejectUnauthorized: false }, () => {
|
|
105
|
-
resolve(data[3] = alpn === socket.alpnProtocol ? 1 : 0);
|
|
106
105
|
this._tlsConnect = null;
|
|
106
|
+
resolve(data[3] = alpn === socket.alpnProtocol ? 1 : 0);
|
|
107
107
|
});
|
|
108
108
|
socket
|
|
109
109
|
.setNoDelay(false)
|
|
110
110
|
.setTimeout(5000)
|
|
111
111
|
.on('timeout', () => {
|
|
112
|
+
socket.destroy();
|
|
112
113
|
if (this._tlsConnect) {
|
|
114
|
+
this._tlsConnect = null;
|
|
113
115
|
if (this.error(version) >= 10) {
|
|
114
116
|
resolve(data[3] = 0);
|
|
115
117
|
}
|
|
116
118
|
else {
|
|
117
119
|
resolve(2);
|
|
118
120
|
}
|
|
119
|
-
this._tlsConnect = null;
|
|
120
121
|
}
|
|
121
|
-
socket.destroy();
|
|
122
122
|
})
|
|
123
123
|
.on('error', () => {
|
|
124
124
|
this.failed(version);
|
|
125
|
-
resolve(data[3] = 0);
|
|
126
125
|
this._tlsConnect = null;
|
|
126
|
+
resolve(data[3] = 0);
|
|
127
127
|
})
|
|
128
128
|
.end();
|
|
129
129
|
}));
|
package/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import type { RequestConstructor } from '../types/lib';
|
|
2
|
-
|
|
3
|
-
declare const Request: RequestConstructor;
|
|
4
|
-
|
|
1
|
+
import type { RequestConstructor } from '../types/lib';
|
|
2
|
+
|
|
3
|
+
declare const Request: RequestConstructor;
|
|
4
|
+
|
|
5
5
|
export = Request;
|
package/index.js
CHANGED
|
@@ -1968,10 +1968,10 @@ class Request extends module_1.default {
|
|
|
1968
1968
|
result = encoding && !pipeline ? '' : null;
|
|
1969
1969
|
titleBgColor = 'bgBlue';
|
|
1970
1970
|
}
|
|
1971
|
-
resolve(result);
|
|
1972
1971
|
if (log) {
|
|
1973
1972
|
this.writeTimeProcess('HTTP' + httpVersion, request.statusMessage || url.toString(), startTime, { type: 1024, queue: !!this.host, titleBgColor, messageUnit, messageUnitMinWidth: 9, delayTime, bypassLog: true });
|
|
1974
1973
|
}
|
|
1974
|
+
resolve(result);
|
|
1975
1975
|
});
|
|
1976
1976
|
host.success(httpVersion);
|
|
1977
1977
|
};
|
package/package.json
CHANGED
|
@@ -1,29 +1,29 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "@e-mc/request",
|
|
3
|
-
"version": "0.5.
|
|
4
|
-
"description": "Request constructor for E-mc.",
|
|
5
|
-
"main": "index.js",
|
|
6
|
-
"types": "index.d.ts",
|
|
7
|
-
"publishConfig": {
|
|
8
|
-
"access": "public"
|
|
9
|
-
},
|
|
10
|
-
"repository": {
|
|
11
|
-
"type": "git",
|
|
12
|
-
"url": "git+https://github.com/anpham6/e-mc.git",
|
|
13
|
-
"directory": "src/request"
|
|
14
|
-
},
|
|
15
|
-
"keywords": [
|
|
16
|
-
"squared",
|
|
17
|
-
"squared-functions"
|
|
18
|
-
],
|
|
19
|
-
"author": "An Pham <anpham6@gmail.com>",
|
|
20
|
-
"license": "MIT",
|
|
21
|
-
"homepage": "https://github.com/anpham6/e-mc#readme",
|
|
22
|
-
"dependencies": {
|
|
23
|
-
"@e-mc/module": "0.5.
|
|
24
|
-
"@e-mc/types": "0.5.
|
|
25
|
-
"combined-stream": "^1.0.8",
|
|
26
|
-
"js-yaml": "^4.1.0",
|
|
27
|
-
"which": "^2.0.2"
|
|
28
|
-
}
|
|
29
|
-
}
|
|
1
|
+
{
|
|
2
|
+
"name": "@e-mc/request",
|
|
3
|
+
"version": "0.5.9",
|
|
4
|
+
"description": "Request constructor for E-mc.",
|
|
5
|
+
"main": "index.js",
|
|
6
|
+
"types": "index.d.ts",
|
|
7
|
+
"publishConfig": {
|
|
8
|
+
"access": "public"
|
|
9
|
+
},
|
|
10
|
+
"repository": {
|
|
11
|
+
"type": "git",
|
|
12
|
+
"url": "git+https://github.com/anpham6/e-mc.git",
|
|
13
|
+
"directory": "src/request"
|
|
14
|
+
},
|
|
15
|
+
"keywords": [
|
|
16
|
+
"squared",
|
|
17
|
+
"squared-functions"
|
|
18
|
+
],
|
|
19
|
+
"author": "An Pham <anpham6@gmail.com>",
|
|
20
|
+
"license": "MIT",
|
|
21
|
+
"homepage": "https://github.com/anpham6/e-mc#readme",
|
|
22
|
+
"dependencies": {
|
|
23
|
+
"@e-mc/module": "0.5.9",
|
|
24
|
+
"@e-mc/types": "0.5.9",
|
|
25
|
+
"combined-stream": "^1.0.8",
|
|
26
|
+
"js-yaml": "^4.1.0",
|
|
27
|
+
"which": "^2.0.2"
|
|
28
|
+
}
|
|
29
|
+
}
|
package/util.d.ts
CHANGED
|
@@ -1,17 +1,17 @@
|
|
|
1
|
-
import type { IncomingHttpHeaders, OutgoingHttpHeaders } from 'http';
|
|
2
|
-
|
|
3
|
-
declare namespace util {
|
|
4
|
-
function parseHeader<T = unknown>(headers: IncomingHttpHeaders, name: string): T | undefined;
|
|
5
|
-
function normalizeHeaders(headers: OutgoingHttpHeaders): OutgoingHttpHeaders;
|
|
6
|
-
function getBasicAuth(auth: AuthValue): string;
|
|
7
|
-
function getBasicAuth(username: unknown, password?: unknown): string;
|
|
8
|
-
function hasBasicAuth(value: string): boolean;
|
|
9
|
-
function checkRetryable(err: unknown): boolean;
|
|
10
|
-
function isRetryable(value: number, timeout?: boolean): boolean;
|
|
11
|
-
function trimPath(value: string): string;
|
|
12
|
-
function asInt(value: unknown): number;
|
|
13
|
-
function asFloat(value: unknown): number;
|
|
14
|
-
function fromSeconds(value: unknown): number;
|
|
15
|
-
}
|
|
16
|
-
|
|
1
|
+
import type { IncomingHttpHeaders, OutgoingHttpHeaders } from 'http';
|
|
2
|
+
|
|
3
|
+
declare namespace util {
|
|
4
|
+
function parseHeader<T = unknown>(headers: IncomingHttpHeaders, name: string): T | undefined;
|
|
5
|
+
function normalizeHeaders(headers: OutgoingHttpHeaders): OutgoingHttpHeaders;
|
|
6
|
+
function getBasicAuth(auth: AuthValue): string;
|
|
7
|
+
function getBasicAuth(username: unknown, password?: unknown): string;
|
|
8
|
+
function hasBasicAuth(value: string): boolean;
|
|
9
|
+
function checkRetryable(err: unknown): boolean;
|
|
10
|
+
function isRetryable(value: number, timeout?: boolean): boolean;
|
|
11
|
+
function trimPath(value: string): string;
|
|
12
|
+
function asInt(value: unknown): number;
|
|
13
|
+
function asFloat(value: unknown): number;
|
|
14
|
+
function fromSeconds(value: unknown): number;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
17
|
export = util;
|