You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I had a problem using https://github.com/binarysec/gate, so I made a shorter version of this bug below. The bug is that the close event of the response is called even if the connection ended correctly, and so the finish event is never called (close means that there were still data to be sent to the client, but the connection closed before the .end()). It seems to only happen in HTTP/2, not HTTP/1.1. Also,
this bug happens with bot the latest v4 and v6 of nodejs (debian repo version). It may be a nodejs bug or a spdy bug, so I thought I would ask it here first. To reproduce it, here are the steps :
Test case
This test focuses on request forwarding, but you may make a shorter version too.
consthttp=require('http');consthttps=require('https');constspdy=require('spdy');constcrypto=require('crypto');constfs=require("fs");consturl=require('url');varsrvOptions={key: fs.readFileSync('server.key').toString('utf8'),cert: fs.readFileSync('server.crt').toString('utf8')};varonReq=function(req,res){console.log('Received :',req.url);varoptions=url.parse(req.url);options.headers=req.headers;options.method=req.method;options.host='87.98.146.101';/* Test using static response */res.writeHeader(200,{'Content-Length': 6});res.write('Hello!');res.end();/* Test using a pipe */// var connector = https.request(options, function(serverResponse) {// res.writeHeader(serverResponse.statusCode, serverResponse.headers);// serverResponse.pipe(res);// });// req.pipe(connector);res.on('close',function(){console.log('Had close... :-(')});res.on('finish',function(){console.log('Had finish! :-)')});};varserver=spdy.createServer(srvOptions,onReq);server.listen(443);
Run server
sudo node server.js
Test
Go to https://www.materiel.net/ (using firefox in my case, but any browser supporting HTTP/2 should do).
The text was updated successfully, but these errors were encountered:
I had a problem using https://github.com/binarysec/gate, so I made a shorter version of this bug below. The bug is that the
close
event of the response is called even if the connection ended correctly, and so thefinish
event is never called (close
means that there were still data to be sent to the client, but the connection closed before the.end()
). It seems to only happen in HTTP/2, not HTTP/1.1. Also,this bug happens with bot the latest v4 and v6 of nodejs (debian repo version). It may be a nodejs bug or a spdy bug, so I thought I would ask it here first. To reproduce it, here are the steps :
Test case
This test focuses on request forwarding, but you may make a shorter version too.
Create ssl certs
Install dependancies
Set host
Add this to your system hosts file :
server.js
Put this in a file called
server.js
:Run server
Test
Go to https://www.materiel.net/ (using firefox in my case, but any browser supporting HTTP/2 should do).
The text was updated successfully, but these errors were encountered: