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: flush stored header #1695

Closed
wants to merge 1 commit into from

Conversation

vkurchatkin
Copy link
Contributor

flushHeaders should work for header written with writeHead.

R=@bnoordhuis

@mscdex mscdex added the http Issues or PRs related to the http subsystem. label May 13, 2015
@@ -5,7 +5,7 @@ const http = require('http');

const server = http.createServer();
server.on('request', function(req, res){
assert(req.headers['foo'], 'bar');
assert(req.headers['foo'] === 'bar');
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why this change?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

just an unrelated fix. bar was used as a message, not as expected value

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah I see now. Maybe it would be better to change this to assert.equal() instead, that way if the assertion should fail, it will show the two non-matching values in the message instead of just "false."

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yep, it is better!


const server = http.createServer();

server.on('request', function(req, res){
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

sorry, style: space in (req, res) {

server.on('request', function(req, res) {
res.writeHead(200, {'foo': 'bar'});
res.flushHeaders();
res.flushHeaders();
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

what the second flushHeaders() call is for?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Saw another test doing this. flushHeaders should be idempotent, this validates that nothing fatal happens if it is called twice

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you add that as a comment to the second flushHeaders call?

@bnoordhuis
Copy link
Member

LGTM with a comment. Is the CI happy?

@Fishrock123
Copy link
Contributor

@Fishrock123
Copy link
Contributor

CI is happy, @vkurchatkin are you able to update this?

`flushHeaders` should work for header written
with `writeHead`.
@vkurchatkin
Copy link
Contributor Author

updated! @Fishrock123 can you start CI, it's a shame but I have no idea how do it

@bnoordhuis
Copy link
Member

@vkurchatkin https://jenkins-iojs.nodesource.com/view/iojs/job/iojs+any-pr+multi/723/

Ping me on IRC if you want instructions on how to start a job (assuming you have an account.)

vkurchatkin added a commit that referenced this pull request May 29, 2015
`flushHeaders` should work for header written
with `writeHead`.

PR-URL: #1695
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
@vkurchatkin
Copy link
Contributor Author

All is green! this is really satisfying :-). Landed in 2c686fd

@rvagg rvagg mentioned this pull request May 30, 2015
andrewdeandrade pushed a commit to andrewdeandrade/node that referenced this pull request Jun 3, 2015
`flushHeaders` should work for header written
with `writeHead`.

PR-URL: nodejs/node#1695
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
http Issues or PRs related to the http subsystem.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

7 participants