@e-mc/request 0.7.7 → 0.7.8

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
@@ -1,7 +1,5 @@
1
1
  # @e-mc/request
2
2
 
3
- PEP 402 - Forever Any Tomato
4
-
5
3
  ## LICENSE
6
4
 
7
5
  MIT
@@ -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
@@ -2010,10 +2010,10 @@ class Request extends module_1.default {
2010
2010
  result = encoding && !pipeline ? '' : null;
2011
2011
  titleBgColor = 'bgBlue';
2012
2012
  }
2013
- resolve(result);
2014
2013
  if (log) {
2015
2014
  this.writeTimeProcess('HTTP' + httpVersion, request.statusMessage || url.toString(), startTime, { type: 1024, queue: !!this.host, titleBgColor, messageUnit, messageUnitMinWidth: 9, delayTime, bypassLog: LOG_STDOUT });
2016
2015
  }
2016
+ resolve(result);
2017
2017
  });
2018
2018
  host.success(httpVersion);
2019
2019
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@e-mc/request",
3
- "version": "0.7.7",
3
+ "version": "0.7.8",
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.7.7",
24
- "@e-mc/types": "0.7.7",
23
+ "@e-mc/module": "0.7.8",
24
+ "@e-mc/types": "0.7.8",
25
25
  "combined-stream": "^1.0.8",
26
26
  "js-yaml": "^4.1.0",
27
27
  "which": "^2.0.2"