mirror of
https://github.com/avwo/whistle.git
synced 2026-10-27 04:19:59 +08:00
refactor: handle abort
This commit is contained in:
@@ -679,6 +679,7 @@ function toHttp1(req, res) {
|
||||
var handleAbort = function() {
|
||||
if (client) {
|
||||
client.abort();
|
||||
req.stream && req.stream.close();
|
||||
client = null;
|
||||
}
|
||||
};
|
||||
@@ -721,6 +722,7 @@ function toHttp1(req, res) {
|
||||
client = http.request(options);
|
||||
client.on('error', handleError);
|
||||
client.on('response', function(svrRes) {
|
||||
svrRes.on('error', handleError);
|
||||
try {
|
||||
var code = svrRes.statusCode;
|
||||
res.writeHead(code, getStatusMessage(svrRes), formatRawHeaders(svrRes, isH2));
|
||||
|
||||
Reference in New Issue
Block a user