update stuff

This commit is contained in:
Yaroslav Kukharuk
2020-11-02 15:49:50 +02:00
parent d4a77b07d9
commit 7238d509f1
3 changed files with 15 additions and 6 deletions
+10 -3
View File
@@ -61,7 +61,8 @@ class Client extends EventEmitter {
path: req.url,
agent: this.agent,
method: req.method,
headers: req.headers
headers: req.headers,
timeout: 120000 // 2 min, default node timeout
};
const clientReq = http.request(opt, (clientRes) => {
@@ -70,7 +71,9 @@ class Client extends EventEmitter {
res.writeHead(clientRes.statusCode, clientRes.headers);
// using pump is deliberate - see the pump docs for why
pump(clientRes, res);
pump(clientRes, res, function(err) {
this.debug('> PIPE FINISHED, %s', err);
});
});
// this can happen when underlying agent produces an error
@@ -78,10 +81,14 @@ class Client extends EventEmitter {
// if we have already sent headers?
clientReq.once('error', (err) => {
// TODO(roman): if headers not sent - respond with gateway unavailable
this.debug('ERROR < %s', req.url);
this.debug(err);
});
// using pump is deliberate - see the pump docs for why
pump(req, clientReq);
pump(req, clientReq, function(err) {
this.debug('< PIPE FINISHED, %s', err);
});
}
handleUpgrade(req, socket) {