@e-mc/request 0.6.4 → 0.6.5

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.
@@ -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
@@ -2005,10 +2005,10 @@ class Request extends module_1.default {
2005
2005
  result = encoding && !pipeline ? '' : null;
2006
2006
  titleBgColor = 'bgBlue';
2007
2007
  }
2008
- resolve(result);
2009
2008
  if (log) {
2010
2009
  this.writeTimeProcess('HTTP' + httpVersion, request.statusMessage || url.toString(), startTime, { type: 1024, queue: !!this.host, titleBgColor, messageUnit, messageUnitMinWidth: 9, delayTime, bypassLog: true });
2011
2010
  }
2011
+ resolve(result);
2012
2012
  });
2013
2013
  host.success(httpVersion);
2014
2014
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@e-mc/request",
3
- "version": "0.6.4",
3
+ "version": "0.6.5",
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.6.4",
24
- "@e-mc/types": "0.6.4",
23
+ "@e-mc/module": "0.6.5",
24
+ "@e-mc/types": "0.6.5",
25
25
  "combined-stream": "^1.0.8",
26
26
  "js-yaml": "^4.1.0",
27
27
  "which": "^2.0.2"