com.jimuwd.xian.registry-proxy 1.0.64 → 1.0.65

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.
Files changed (2) hide show
  1. package/dist/index.js +3 -1
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -214,17 +214,19 @@ async function writeResponseToDownstreamClient(registryInfo, targetUrl, resToDow
214
214
  };
215
215
  downstreamReq.on('close', cleanup);
216
216
  // write back body data (chunked probably)
217
- // pipe upstream body to downstream client and end when upstream ends.
217
+ // pipe upstream body to downstream client
218
218
  upstreamResponse.body.pipe(resToDownstreamClient, { end: false });
219
219
  upstreamResponse.body
220
220
  .on('data', (chunk) => logger.info(`Chunk transferred from ${targetUrl} to downstream client size=${chunk.length}`))
221
221
  .on('end', () => {
222
222
  logger.info(`Upstream server ${targetUrl} response.body ended.`);
223
+ resToDownstreamClient.end();
223
224
  })
224
225
  .on('close', () => {
225
226
  const errMsg = `Upstream server ${targetUrl} closed connection while transferring data.`;
226
227
  logger.error(errMsg);
227
228
  // resToDownstreamClient.destroy(new Error(errMsg));
229
+ resToDownstreamClient.destroy();
228
230
  })
229
231
  .on('error', (err) => {
230
232
  const errMsg = `Stream error: ${err.message}`;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "com.jimuwd.xian.registry-proxy",
3
- "version": "1.0.64",
3
+ "version": "1.0.65",
4
4
  "description": "A lightweight npm registry proxy with fallback support",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",