@e-mc/request 0.8.11 → 0.8.12

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/README.md CHANGED
@@ -9,7 +9,7 @@
9
9
 
10
10
  ## Interface
11
11
 
12
- - https://www.unpkg.com/@e-mc/types@0.8.11/lib/index.d.ts
12
+ - https://www.unpkg.com/@e-mc/types@0.8.12/lib/index.d.ts
13
13
 
14
14
  ```typescript
15
15
  import type { IModule, ModuleConstructor } from "./index";
@@ -82,9 +82,9 @@ interface RequestConstructor extends ModuleConstructor {
82
82
 
83
83
  ## References
84
84
 
85
- - https://www.unpkg.com/@e-mc/types@0.8.11/lib/http.d.ts
86
- - https://www.unpkg.com/@e-mc/types@0.8.11/lib/request.d.ts
87
- - https://www.unpkg.com/@e-mc/types@0.8.11/lib/settings.d.ts
85
+ - https://www.unpkg.com/@e-mc/types@0.8.12/lib/http.d.ts
86
+ - https://www.unpkg.com/@e-mc/types@0.8.12/lib/request.d.ts
87
+ - https://www.unpkg.com/@e-mc/types@0.8.12/lib/settings.d.ts
88
88
 
89
89
  ## LICENSE
90
90
 
@@ -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(10000)
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.js CHANGED
@@ -2063,10 +2063,10 @@ class Request extends module_1.default {
2063
2063
  result = encoding && !pipeline ? '' : null;
2064
2064
  titleBgColor = 'bgBlue';
2065
2065
  }
2066
- resolve(result);
2067
2066
  if (log) {
2068
2067
  this.writeTimeProcess('HTTP' + httpVersion, request.statusMessage || url.toString(), startTime, { type: 1024, queue: !!this.host, titleBgColor, messageUnit, messageUnitMinWidth: 9, delayTime, bypassLog: LOG_STDOUT });
2069
2068
  }
2069
+ resolve(result);
2070
2070
  });
2071
2071
  host.success(httpVersion);
2072
2072
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@e-mc/request",
3
- "version": "0.8.11",
3
+ "version": "0.8.12",
4
4
  "description": "Request constructor for E-mc.",
5
5
  "main": "index.js",
6
6
  "types": "index.d.ts",
@@ -20,8 +20,8 @@
20
20
  "license": "MIT",
21
21
  "homepage": "https://github.com/anpham6/e-mc#readme",
22
22
  "dependencies": {
23
- "@e-mc/module": "0.8.11",
24
- "@e-mc/types": "0.8.11",
23
+ "@e-mc/module": "0.8.12",
24
+ "@e-mc/types": "0.8.12",
25
25
  "combined-stream": "^1.0.8",
26
26
  "js-yaml": "^4.1.0",
27
27
  "picomatch": "^3.0.1",