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

http2: improve errors thrown in header validation #16718

Closed
wants to merge 1 commit into
base: master
from

Conversation

Projects
None yet
6 participants
@joyeecheung
Member

joyeecheung commented Nov 3, 2017

Previously #16715

This PR:

  • Include the header name and the value in ERR_HTTP2_INVALID_HEADER_VALUE for debug-ability as #16714 suggests. Before it's Value must not be undefined or null, after it's Invalid value "undefined" for header "test". If the user is setting the header in a loop this would be much more useful.
  • Use Error.captureStackTrace to exclude the validation functions from the stack trace
Checklist
  • make -j4 test (UNIX), or vcbuild test (Windows) passes
  • tests and/or benchmarks are included
  • documentation is changed or added
  • commit message follows commit guidelines
Affected core subsystem(s)

http2

@joyeecheung

This comment has been minimized.

Show comment
Hide comment
@@ -837,7 +837,7 @@ requests and responses.
<a id="ERR_HTTP2_INVALID_HEADER_VALUE"></a>
### ERR_HTTP2_INVALID_HEADER_VALUE
Used to indicate that an invalid HTTP/2 header value has been specified.
Used to indicate that an invalid HTTP2 header value has been specified.

This comment has been minimized.

@joyeecheung

joyeecheung Nov 3, 2017

Member

Uh, accidental...can be fixed later.

@joyeecheung

joyeecheung Nov 3, 2017

Member

Uh, accidental...can be fixed later.

@jasnell

jasnell approved these changes Nov 3, 2017

@lpinca

lpinca approved these changes Nov 5, 2017

err = new errors.TypeError('ERR_HTTP2_INVALID_HEADER_VALUE', value, name);
}
if (err !== undefined) {
Error.captureStackTrace(err, assertValidHeader);

This comment has been minimized.

@lpinca

lpinca Nov 5, 2017

Member

Is there a particular reason to remove assertValidHeader from the stack trace?

@lpinca

lpinca Nov 5, 2017

Member

Is there a particular reason to remove assertValidHeader from the stack trace?

This comment has been minimized.

@joyeecheung

joyeecheung Nov 5, 2017

Member

@lpinca I don't think that frame adds more value to the stacktrace because you can easily tell which line it would be by the error thrown, and the error codes themselves are clear enough to show the reason. Adding one more frame just expose more internal details that the user should not worry about..

@joyeecheung

joyeecheung Nov 5, 2017

Member

@lpinca I don't think that frame adds more value to the stacktrace because you can easily tell which line it would be by the error thrown, and the error codes themselves are clear enough to show the reason. Adding one more frame just expose more internal details that the user should not worry about..

This comment has been minimized.

@lpinca

lpinca Nov 5, 2017

Member

because you can easily tell which line it would be by the error thrown

Yes, but it should be inferred and it requires a little more effort. Internal details are useful for everyone when debugging. Anyway no problem, I can live with it :)

@lpinca

lpinca Nov 5, 2017

Member

because you can easily tell which line it would be by the error thrown

Yes, but it should be inferred and it requires a little more effort. Internal details are useful for everyone when debugging. Anyway no problem, I can live with it :)

joyeecheung added a commit that referenced this pull request Nov 6, 2017

http2: improve errors thrown in header validation
PR-URL: #16718
Reviewed-By: Anatoli Papirovski <apapirovski@mac.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
@joyeecheung

This comment has been minimized.

Show comment
Hide comment
@joyeecheung

joyeecheung Nov 6, 2017

Member

Landed in 11a9f36, thanks!

Member

joyeecheung commented Nov 6, 2017

Landed in 11a9f36, thanks!

@joyeecheung joyeecheung closed this Nov 6, 2017

cjihrig added a commit to cjihrig/node-1 that referenced this pull request Nov 6, 2017

http2: improve errors thrown in header validation
PR-URL: nodejs#16718
Reviewed-By: Anatoli Papirovski <apapirovski@mac.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>

@cjihrig cjihrig referenced this pull request Nov 6, 2017

Merged

v9.1.0 proposal #16851

gibfahn added a commit that referenced this pull request Nov 14, 2017

http2: improve errors thrown in header validation
PR-URL: #16718
Reviewed-By: Anatoli Papirovski <apapirovski@mac.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>

@gibfahn gibfahn referenced this pull request Nov 21, 2017

Merged

v8.9.2 proposal #17204

gibfahn added a commit that referenced this pull request Dec 5, 2017

2017-12-05, Version 8.9.2 'Carbon' (LTS)
Notable Changes:

- **console**:
  - avoid adding infinite error listeners (Matteo Collina) [#16770](https://github.com/nodejs/n
de/pull/16770)
- **http2**:
  - improve errors thrown in header validation (Joyee Cheung) [#16718](https://github.com/nodej
s/node/pull/16718)

PR-URL: #17204

gibfahn added a commit that referenced this pull request Dec 5, 2017

2017-12-05, Version 8.9.2 'Carbon' (LTS)
Notable Changes:

- **console**:
  - avoid adding infinite error listeners (Matteo Collina) [#16770](https://github.com/nodejs/n
de/pull/16770)
- **http2**:
  - improve errors thrown in header validation (Joyee Cheung) [#16718](https://github.com/nodej
s/node/pull/16718)

PR-URL: #17204

msoechting added a commit to hpicgs/node that referenced this pull request Feb 5, 2018

2017-12-05, Version 8.9.2 'Carbon' (LTS)
Notable Changes:

- **console**:
  - avoid adding infinite error listeners (Matteo Collina) [nodejs#16770](https://github.com/nodejs/n
de/pull/16770)
- **http2**:
  - improve errors thrown in header validation (Joyee Cheung) [nodejs#16718](https://github.com/nodej
s/node/pull/16718)

PR-URL: nodejs#17204

msoechting added a commit to hpicgs/node that referenced this pull request Feb 7, 2018

http2: improve errors thrown in header validation
PR-URL: nodejs#16718
Reviewed-By: Anatoli Papirovski <apapirovski@mac.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>

msoechting added a commit to hpicgs/node that referenced this pull request Feb 7, 2018

2017-12-05, Version 8.9.2 'Carbon' (LTS)
Notable Changes:

- **console**:
  - avoid adding infinite error listeners (Matteo Collina) [nodejs#16770](https://github.com/nodejs/n
de/pull/16770)
- **http2**:
  - improve errors thrown in header validation (Joyee Cheung) [nodejs#16718](https://github.com/nodej
s/node/pull/16718)

PR-URL: nodejs#17204
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment