GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — http: send 400 bad request on parse error by mog422 · Pull Request #15324 · nodejs/node

Conversation

@mog422

@mog422 mog422 commented Sep 11, 2017 •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown
Contributor

A web server such as nginx assumes that upstream is dead
if upstream closes the socket without any response.

Checklist
  • make -j4 test (UNIX), or vcbuild test (Windows) passes
  • tests and/or benchmarks are included
  • commit message follows commit guidelines
Affected core subsystem(s)

http

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@nodejs-github-bot nodejs-github-bot added the http Issues and PRs related to the http subsystem. label Sep 11, 2017
@mog422
mog422 force-pushed the http.send400.on.parser.error branch 2 times, most recently from 5147084 to 1a7fd84 Compare September 11, 2017 02:09
@mscdex

mscdex commented Sep 11, 2017 •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown
Contributor

-1 I would prefer to have this explicitly done by userland. Also, this could cause some backwards compatibility issues...

FWIW code-wise the response written to the socket could be a static Buffer for better performance.

lpinca reacted with thumbs up emoji
All reactions
  • 👍 1 reaction

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@mog422
mog422 force-pushed the http.send400.on.parser.error branch from 1a7fd84 to c3cbc17 Compare September 11, 2017 04:34
@mog422

mog422 commented Sep 11, 2017

Copy link
Copy Markdown
Contributor Author

I clearly think that this should be done in the framework.
I have never seen user need to implement this in any framework I know.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@apapirovski

apapirovski commented Sep 11, 2017

Copy link
Copy Markdown
Contributor

Not sure about compatibility but it does feel weird that this is in user-land when comparing it to http2. Seems like node is potentially encouraging a lot of badly behaved servers out there. Just looking at popular user-land implementations, only fastify behaves well.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@jasnell

jasnell commented Sep 12, 2017

Copy link
Copy Markdown
Member

Preferably, this would have been the behavior from the beginning, for backwards compatibility reasons now, I'd say that this is not worth changing and should be kept to userland. The http/2 implementation was intentionally made stricter in these kinds of cases to avoid having this kind of problem. I'm -1 on this change.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@BridgeAR

BridgeAR commented Sep 13, 2017 •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown
Member

@jasnell what do you think about just running CITGM on it and see how bad things break? This would be semver-major anyway and I do see the point that it makes sense to have it in the framework. Especially as a lot of servers will likely not handle this properly because they did not think about it.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@jasnell

jasnell commented Sep 14, 2017

Copy link
Copy Markdown
Member

I would be extremely surprised if anything in CITGM would exercise this case so I'm not sure if that would help.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@apapirovski

apapirovski commented Sep 14, 2017 •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown
Contributor

Some of the libraries likely have tests around this behaviour, no? Feels like at the very least this would be interesting to test & see what it does with CITGM. Couldn't Node ultimately emit a warning and then semver-major release it, or something?

The fact that this only affects situations where the end-users haven't bound a listener for 'clientError' should make the risk of this at least a little bit smaller, no? If they're not doing any handling of their own, is it that likely to break their code?

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@jasnell

jasnell commented Sep 15, 2017

Copy link
Copy Markdown
Member

@nodejs/tsc thoughts?

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@jasnell

jasnell commented Sep 15, 2017

Copy link
Copy Markdown
Member

CITGM: https://ci.nodejs.org/view/Node.js-citgm/job/citgm-smoker/986/

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@dougwilson

dougwilson commented Sep 15, 2017

Copy link
Copy Markdown
Member

I think this should, one day, be the default behavior when there is no registered listener. No one will really notice.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@mcollina mcollina added the semver-major PRs that contain breaking changes and should be released in the next major version. label Sep 18, 2017
@mcollina

mcollina commented Sep 18, 2017

Copy link
Copy Markdown
Member

This is a semver-major change.

The major problem is that the top frameworks are not implementing it. I think that adding it to core it's the best solution to fix this issue.

@dougwilson are you ok with this one? I'm 👍 if it's ok for you.

BridgeAR reacted with thumbs up emoji
All reactions
  • 👍 1 reaction

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@jasnell

jasnell commented Sep 19, 2017

Copy link
Copy Markdown
Member

Ok, I'm convinced ;-) ...

BridgeAR reacted with thumbs up emoji
All reactions
  • 👍 1 reaction

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@dougwilson

dougwilson commented Sep 19, 2017

Copy link
Copy Markdown
Member

At least for frameworks like Connect / Express / Koa they all sit abstracted higher than the server instance, so they don't have the server reference to add a listener, which is why none of those frameworks set up this kind of listener.

But, if these frameworks ever wanted to, doing so would replace this default handler, so there doesn't seem like much downside to me.

BridgeAR reacted with thumbs up emoji
All reactions
  • 👍 1 reaction

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

BridgeAR
BridgeAR approved these changes Sep 19, 2017
View reviewed changes
Comment thread lib/_http_server.js Outdated

@BridgeAR BridgeAR Sep 19, 2017

Copy link
Copy Markdown
Member

There was a problem hiding this comment.

Choose a reason for hiding this comment

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

It would be nice to change this to a static value instead of using string concatenation as @mscdex pointed out.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@mog422
mog422 force-pushed the http.send400.on.parser.error branch 2 times, most recently from f163e76 to 24325ee Compare September 19, 2017 22:51
@mog422

mog422 commented Sep 19, 2017

Copy link
Copy Markdown
Contributor Author

I fixed it.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

cjihrig
cjihrig reviewed Sep 20, 2017
View reviewed changes
Comment thread test/parallel/test-http-blank-header.js Outdated

@cjihrig cjihrig Sep 20, 2017

Copy link
Copy Markdown
Contributor

There was a problem hiding this comment.

Choose a reason for hiding this comment

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

You should probably accumulate the data in a string here and then perform the assertion in the 'end' handler.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@mog422
mog422 force-pushed the http.send400.on.parser.error branch from 24325ee to 71e702f Compare September 20, 2017 00:15
@mog422

mog422 commented Sep 20, 2017

Copy link
Copy Markdown
Contributor Author

@cjihrig fixed.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

cjihrig
cjihrig approved these changes Sep 20, 2017
View reviewed changes

@cjihrig cjihrig left a comment

Copy link
Copy Markdown
Contributor

There was a problem hiding this comment.

Choose a reason for hiding this comment

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

Code LGTM.

I do see the potential for backwards compatibility issues too though. @mscdex, you might want to use the big red X to prevent your -1 from getting accidentally overlooked (if you feel strongly enough about it).

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
mscdex
mscdex previously requested changes Sep 20, 2017
View reviewed changes

@mscdex mscdex left a comment

Copy link
Copy Markdown
Contributor

There was a problem hiding this comment.

Choose a reason for hiding this comment

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

Making it more explicit

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@jasnell jasnell added the tsc-review label Sep 20, 2017
@jasnell

jasnell commented Sep 20, 2017

Copy link
Copy Markdown
Member

Marking for tsc-review given the objections. Ping @nodejs/tsc

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@jasnell
jasnell requested a review from a team September 20, 2017 07:40
@Trott

Trott commented Oct 18, 2017

Copy link
Copy Markdown
Member

11 TSC members have approved. At the TSC meeting today, we agreed to take that as a vote count, so this can land.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@Trott Trott removed tsc-agenda Issues and PRs to discuss during Technical Steering Committee meetings. tsc-review labels Oct 18, 2017
ofrobots
ofrobots approved these changes Oct 18, 2017
View reviewed changes

@ofrobots ofrobots left a comment

Copy link
Copy Markdown
Contributor

There was a problem hiding this comment.

Choose a reason for hiding this comment

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

+1 on the change landing. Didn't review the code.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@jasnell jasnell added this to the 9.0.0 milestone Oct 18, 2017
@addaleax

addaleax commented Oct 18, 2017

Copy link
Copy Markdown
Member

Old CIs are inaccessible, so here’s a fresh one: https://ci.nodejs.org/job/node-test-commit/13272/

(Looks like AIX already broke down due to build system changes? @nodejs/build)

This should be ready.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@BridgeAR

BridgeAR commented Oct 19, 2017

Copy link
Copy Markdown
Member

The CI is very red. Rerun https://ci.nodejs.org/job/node-test-pull-request/10846/

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@BridgeAR
BridgeAR dismissed mscdex’s stale review October 19, 2017 05:35

Dismissing the blocking review due to the TSC vote.

@mcollina

mcollina commented Oct 19, 2017

Copy link
Copy Markdown
Member

CI again: https://ci.nodejs.org/job/node-test-pull-request/10851/

It seemed very red for some infra problem.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@addaleax

addaleax commented Oct 19, 2017 •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown
Member

I looked through the the CI runs, nothing in there is related to this PR.

Landed in f2f391e

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@addaleax addaleax closed this Oct 19, 2017
addaleax pushed a commit that referenced this pull request Oct 19, 2017
@mog422 @addaleax
http: send 400 bad request on parse error
f2f391e
A web server such as nginx assumes that upstream is dead
if upstream closes the socket without any response.

PR-URL: #15324
Reviewed-By: Matteo Collina <[email protected]>
Reviewed-By: Ali Ijaz Sheikh <[email protected]>
Reviewed-By: Franziska Hinkelmann <[email protected]>
Reviewed-By: James M Snell <[email protected]>
Reviewed-By: Myles Borins <[email protected]>
Reviewed-By: Evan Lucas <[email protected]>
Reviewed-By: Sakthipriyan Vairamani <[email protected]>
Reviewed-By: Anna Henningsen <[email protected]>
Reviewed-By: Jeremiah Senkpiel <[email protected]>
Reviewed-By: Colin Ihrig <[email protected]>
Reviewed-By: Joyee Cheung <[email protected]>
Reviewed-By: Ruben Bridgewater <[email protected]>
Reviewed-By: Michael Dawson <[email protected]>
@hueniverse hueniverse mentioned this pull request Oct 19, 2017
Send 400 bad request on parse error hapijs/hapi#3624
Closed
addaleax pushed a commit to ayojs/ayo that referenced this pull request Oct 26, 2017
@mog422 @addaleax
http: send 400 bad request on parse error
1cbc3b3
A web server such as nginx assumes that upstream is dead
if upstream closes the socket without any response.

PR-URL: nodejs/node#15324
Reviewed-By: Matteo Collina <[email protected]>
Reviewed-By: Ali Ijaz Sheikh <[email protected]>
Reviewed-By: Franziska Hinkelmann <[email protected]>
Reviewed-By: James M Snell <[email protected]>
Reviewed-By: Myles Borins <[email protected]>
Reviewed-By: Evan Lucas <[email protected]>
Reviewed-By: Sakthipriyan Vairamani <[email protected]>
Reviewed-By: Anna Henningsen <[email protected]>
Reviewed-By: Jeremiah Senkpiel <[email protected]>
Reviewed-By: Colin Ihrig <[email protected]>
Reviewed-By: Joyee Cheung <[email protected]>
Reviewed-By: Ruben Bridgewater <[email protected]>
Reviewed-By: Michael Dawson <[email protected]>
@jasnell jasnell mentioned this pull request Oct 30, 2017
Proposal: 2017-10-31, Version 9.0.0 (Current) #15135
Merged
addaleax pushed a commit to ayojs/ayo that referenced this pull request Dec 7, 2017
@mog422 @addaleax
http: send 400 bad request on parse error
055e62f
A web server such as nginx assumes that upstream is dead
if upstream closes the socket without any response.

PR-URL: nodejs/node#15324
Reviewed-By: Matteo Collina <[email protected]>
Reviewed-By: Ali Ijaz Sheikh <[email protected]>
Reviewed-By: Franziska Hinkelmann <[email protected]>
Reviewed-By: James M Snell <[email protected]>
Reviewed-By: Myles Borins <[email protected]>
Reviewed-By: Evan Lucas <[email protected]>
Reviewed-By: Sakthipriyan Vairamani <[email protected]>
Reviewed-By: Anna Henningsen <[email protected]>
Reviewed-By: Jeremiah Senkpiel <[email protected]>
Reviewed-By: Colin Ihrig <[email protected]>
Reviewed-By: Joyee Cheung <[email protected]>
Reviewed-By: Ruben Bridgewater <[email protected]>
Reviewed-By: Michael Dawson <[email protected]>
@cristianbote cristianbote mentioned this pull request Feb 2, 2018
http server. empty reply on GET request with not url encoded GET-param #6295
Closed
@lpinca lpinca mentioned this pull request Feb 20, 2018
doc: update description of 'clientError' event #18885
Closed
3 tasks done
lpinca added a commit to lpinca/node that referenced this pull request Feb 20, 2018
@lpinca
doc: update description of 'clientError' event
e733af6
Default behavior is to send a '400 Bad Request' response if the socket
is writable.

Refs: nodejs#15324
benjamingr pushed a commit that referenced this pull request Feb 23, 2018
@lpinca Benjamin Gruenbaum
doc: update description of 'clientError' event
54cb3c5
Default behavior is to send a '400 Bad Request' response if the socket
is writable.

PR-URL: #18885
Refs: #15324
Reviewed-By: Colin Ihrig <[email protected]>
Reviewed-By: Ruben Bridgewater <[email protected]>
addaleax pushed a commit to addaleax/node that referenced this pull request Feb 26, 2018
@lpinca @addaleax
doc: update description of 'clientError' event
8d0cc17
Default behavior is to send a '400 Bad Request' response if the socket
is writable.

PR-URL: nodejs#18885
Refs: nodejs#15324
Reviewed-By: Colin Ihrig <[email protected]>
Reviewed-By: Ruben Bridgewater <[email protected]>
addaleax pushed a commit that referenced this pull request Feb 26, 2018
@lpinca @addaleax
doc: update description of 'clientError' event
38cf3cf
Default behavior is to send a '400 Bad Request' response if the socket
is writable.

PR-URL: #18885
Refs: #15324
Reviewed-By: Colin Ihrig <[email protected]>
Reviewed-By: Ruben Bridgewater <[email protected]>
@apapirovski apapirovski mentioned this pull request Apr 12, 2018
HTTP connection prematurely closed when unescaped space present in query string #13407
Closed
MayaLekova pushed a commit to MayaLekova/node that referenced this pull request May 8, 2018
@lpinca @MayaLekova
doc: update description of 'clientError' event
0c5fe94
Default behavior is to send a '400 Bad Request' response if the socket
is writable.

PR-URL: nodejs#18885
Refs: nodejs#15324
Reviewed-By: Colin Ihrig <[email protected]>
Reviewed-By: Ruben Bridgewater <[email protected]>
MylesBorins pushed a commit that referenced this pull request Aug 8, 2018
@lpinca @MylesBorins
doc: update description of 'clientError' event
4272fda
Default behavior is to send a '400 Bad Request' response if the socket
is writable.

PR-URL: #18885
Refs: #15324
Reviewed-By: Colin Ihrig <[email protected]>
Reviewed-By: Ruben Bridgewater <[email protected]>
MylesBorins pushed a commit that referenced this pull request Aug 9, 2018
@lpinca @MylesBorins
doc: update description of 'clientError' event
18baec4
Default behavior is to send a '400 Bad Request' response if the socket
is writable.

PR-URL: #18885
Refs: #15324
Reviewed-By: Colin Ihrig <[email protected]>
Reviewed-By: Ruben Bridgewater <[email protected]>
MylesBorins pushed a commit that referenced this pull request Aug 16, 2018
@lpinca @MylesBorins
doc: update description of 'clientError' event
f876887
Default behavior is to send a '400 Bad Request' response if the socket
is writable.

PR-URL: #18885
Refs: #15324
Reviewed-By: Colin Ihrig <[email protected]>
Reviewed-By: Ruben Bridgewater <[email protected]>
@dougwilson dougwilson mentioned this pull request Jul 21, 2020
http: don't write error to socket #34465
Closed
4 tasks done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

@bnoordhuis bnoordhuis bnoordhuis left review comments
@mcollina mcollina mcollina approved these changes
@jasnell jasnell jasnell approved these changes
@addaleax addaleax addaleax approved these changes
@cjihrig cjihrig cjihrig approved these changes
@joyeecheung joyeecheung joyeecheung approved these changes
@BridgeAR BridgeAR BridgeAR approved these changes
+8 more reviewers
@ofrobots ofrobots ofrobots approved these changes
@fhinkel fhinkel fhinkel approved these changes
@MylesBorins MylesBorins MylesBorins approved these changes
@evanlucas evanlucas evanlucas approved these changes
@thefourtheye thefourtheye thefourtheye approved these changes
@Fishrock123 Fishrock123 Fishrock123 approved these changes
@mhdawson mhdawson mhdawson approved these changes
@mscdex mscdex mscdex left review comments
Reviewers whose approvals may not affect merge requirements

Uh oh!

There was an error while loading. Please reload this page.

Assignees

No one assigned

Labels

http Issues and PRs related to the http subsystem. semver-major PRs that contain breaking changes and should be released in the next major version.

Projects

None yet

Milestone

9.0.0

Development

Successfully merging this pull request may close these issues.

Uh oh!

There was an error while loading. Please reload this page.

20 participants

@mog422 @mscdex @apapirovski @jasnell @BridgeAR @dougwilson @mcollina @cjihrig @hueniverse @bnoordhuis @addaleax @rvagg @Trott @ofrobots @fhinkel @MylesBorins @evanlucas @thefourtheye @Fishrock123 @joyeecheung
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
You are visitor 01402775 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.