Repository navigation
http: missing close after finish #27480
Copy link
Copy link
Closed
Labels
httpIssues and PRs related to the http subsystem.Issues and PRs related to the http subsystem.
Description
Activity
- changed the title
[-]missing close after finish[/-][+]http: missing close after finish[/+]on Apr 29, 2019 A bit more nodejs testy:
const http = require('http') const send = require('send') const server = http .createServer(common.mustCall((req, res) => { send(req, '/Users/ronagy/Desktop/old/AFT2/Start_060918_40.mov') .pipe(res) .on('finish', common.mustCall()) .on('close', common.mustCall()); })); server.listen(9000, common.mustCall(() => { http.get({ port: server.address().port }, res => { res.on('data', buf => { // drain }); }); }));
I can't reproduce:
$ dd if=/dev/urandom of=data.bin count=1024 bs=1024 1024+0 records in 1024+0 records out 1048576 bytes transferred in 0.030293 secs (34614479 bytes/sec)$ cat finish.js 'use strict'; const http = require('http'); const { createReadStream } = require('fs'); const server = http.createServer((req, res) => { createReadStream('./data.bin') .pipe(res) .on('finish', () => { console.log('finish'); }) .on('close', () => { console.log('close'); }); }); server.listen(0, () => { http.get({ port: server.address().port }, (res) => { res.resume(); }); });$ node finish.js finish close ^C- addedhttpIssues and PRs related to the http subsystem.Issues and PRs related to the http subsystem.
on Apr 30, 2019 dd if=/dev/urandom of=data.bin count=1024 bs=1024 1024+0 records in 1024+0 records out 1048576 bytes transferred in 0.029004 secs (36152686 bytes/sec)
const http = require('http') const { createReadStream } = require('fs') const server = http .createServer((req, res) => { createReadStream('./data.bin') .pipe(res) .on('finish', () => console.log('finish')) .on('close', () => console.log('close')) }) server.listen(9000, () => { http.get({ port: server.address().port }, res => { res.resume() }) })
storage$ node --version v10.13.0 storage$ node tmp.js finish ^C
storage$ node --version && node tmp.js v10.15.3 finish ^CWorks in node 11 and later. Not sure what commit fixed it?
storage$ node --version && node tmp.js v12.1.0 finish closenode --version && node tmp.js v11.14.0 finish close@mcollina is this something we want to fix in LTS or should I just drop it?
aah! yes, then it is as it should be
Metadata
Metadata
Assignees
Labels
httpIssues and PRs related to the http subsystem.Issues and PRs related to the http subsystem.
Node 10.13
Would expect it to print 'finish' and then 'close'.