Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

http/2 compat will emit finish before end() for HEAD requests #24742

Closed
ronag opened this issue Nov 30, 2018 · 4 comments
Closed

http/2 compat will emit finish before end() for HEAD requests #24742

ronag opened this issue Nov 30, 2018 · 4 comments
Labels
http2 Issues or PRs related to the http2 subsystem.

Comments

@ronag
Copy link
Member

ronag commented Nov 30, 2018

i.e. this breaks for HEAD requests:

server.on('request', (req, res) => {
  res.on('finish', common.mustCall()) // Fail
  res.on('close', common.mustCall())  // Fail
  res.end()
})
@ronag ronag closed this as completed Dec 1, 2018
@ronag ronag reopened this Dec 1, 2018
@ronag
Copy link
Member Author

ronag commented Jun 8, 2019

Probably duplicate #24743

@ronag ronag closed this as completed Jun 8, 2019
@ronag ronag reopened this Aug 8, 2019
@rexagod
Copy link
Member

rexagod commented Jun 17, 2020

@ronag Please correct me if I'm wrong but I think this issue and the duplicate one both are fixed now. I tried reproducing them using the code below. The code passes.

const http = require('http');
const assert = require('assert');

const server = http.createServer();

server.listen(0);

server.on('listening', (res) => {
  const clientrequest = http.request({
    port: server.address().port,
    method: 'HEAD',
    path: '/'
  });
  clientrequest.end();
});

server.on('request', (req, res) => {

  // #24743
  assert(!res.finished);

  // #24742
  res.on('finish', () => { console.log('finish') });
  res.on('close', () => { console.log('close') });

  res.end();
  server.close();
});

@jasnell jasnell added the http2 Issues or PRs related to the http2 subsystem. label Jun 26, 2020
@jasnell
Copy link
Member

jasnell commented Jun 26, 2020

@ronag is this still an issue?

@ronag
Copy link
Member Author

ronag commented Jun 26, 2020

Probably not. Though I don't remember what caused the original issue and what might have fixed it.

@ronag ronag closed this as completed Jun 26, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
http2 Issues or PRs related to the http2 subsystem.
Projects
None yet
Development

No branches or pull requests

3 participants