Uh oh!
There was an error while loading. Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork 34.2k
http2: add aligned padding strategy#17938
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
Uh oh!
There was an error while loading. Please reload this page.
Conversation
Add a padding strategy option that makes a best attempt to ensure that total frame length for DATA and HEADERS frames are aligned on multiples of 8-bytes.
jasnell commented Jan 1, 2018
Ping @addaleax ... for some reason I'm not able to open a new issue in the repo... but I can comment on issues and I can add PRs... very strange... In any case, I came across an issue you may want to look at: @addaleax ... heads up... when using the That is, modifying 'use strict';constcommon=require('../common');if(!common.hasCrypto)common.skip('missing crypto');constassert=require('assert');consthttp2=require('http2');constmakeDuplexPair=require('../common/duplexpair');{consttestData='<h1>Hello World</h1>';constserver=http2.createServer();server.on('stream',common.mustCall((stream,headers)=>{stream.respond({'content-type': 'text/html',':status': 200});stream.end(testData);}));const{ clientSide, serverSide }=makeDuplexPair();server.emit('connection',serverSide);serverSide.on('data',()=>{throw'something';});constclient=http2.connect('http://localhost:80',{createConnection: common.mustCall(()=>clientSide)});constreq=client.request({':path': '/'});req.on('response',common.mustCall((headers)=>{assert.strictEqual(headers[':status'],200);}));req.setEncoding('utf8');// Note: This is checking that this small amount of data is passed through in// a single chunk, which is unusual for our test suite but seems like a// reasonable assumption here.req.on('data',common.mustCall((data)=>{assert.strictEqual(data,testData);}));req.on('end',common.mustCall(()=>{clientSide.destroy();clientSide.end();}));req.end();}results in: |
addaleax commented Jan 1, 2018
@jasnell I can’t open issues either. :/ Thanks for the pointer though! |
| *`http2.constants.PADDING_STRATEGY_ALIGNED` - Will *attempt* to apply | ||
| enough padding to ensure that the total frame length, including the | ||
| 9-byte header, is a multiple of 8. For each frame, however, there is a | ||
| maxmimum allowed number of padding bytes that is determined by current |
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.
A nit: maxmimum -> maximum.
mcollina commented Jan 2, 2018
when it is better to use one strategy or another? In other terms, should this be the default? |
jasnell commented Jan 2, 2018
That's still unclear and needs to be benchmarked to determine the best strategy. |
mcollina left a comment
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.
LGTM
mcollina commented Jan 2, 2018
@jasnell after this is landed, can you open up a new issue for picking the best strategy? |
jasnell commented Jan 2, 2018
Yep, definitely. The "best" is going to depend on a number of factors and may be difficult to nail down. Padding is supposed to be a security mechanism (see https://tools.ietf.org/html/rfc7540#section-10.7) but it's use really depends on a number of very data-specific and use-case-specific factors. For instance, one reason why the aligned strategy might not make the best default is this particular passage in the RFC: In other words, aligned padding might may buffer allocation easier, but it also makes frame sizes more predictable. |
jasnell commented Jan 3, 2018
jasnell commented Jan 3, 2018
CI is good |
Add a padding strategy option that makes a best attempt to ensure that total frame length for DATA and HEADERS frames are aligned on multiples of 8-bytes. PR-URL: #17938 Reviewed-By: Anna Henningsen <[email protected]> Reviewed-By: Matteo Collina <[email protected]>
jasnell commented Jan 3, 2018
Landed in efdadcc |
Since these are executing JS code, and in particular parts of that code may be provided by userland, handle such exceptions in C++. Ref: nodejs#17938 (comment)
Add a padding strategy option that makes a best attempt to ensure that total frame length for DATA and HEADERS frames are aligned on multiples of 8-bytes. PR-URL: nodejs#17938 Reviewed-By: Anna Henningsen <[email protected]> Reviewed-By: Matteo Collina <[email protected]>
Add a padding strategy option that makes a best attempt to ensure that total frame length for DATA and HEADERS frames are aligned on multiples of 8-bytes. Backport-PR-URL: #18050 PR-URL: #17938 Reviewed-By: Anna Henningsen <[email protected]> Reviewed-By: Matteo Collina <[email protected]>
Add a padding strategy option that makes a best attempt to ensure that total frame length for DATA and HEADERS frames are aligned on multiples of 8-bytes. Backport-PR-URL: #18050 PR-URL: #17938 Reviewed-By: Anna Henningsen <[email protected]> Reviewed-By: Matteo Collina <[email protected]>
Since these are executing JS code, and in particular parts of that code may be provided by userland, handle such exceptions in C++. Refs: #17938 (comment) PR-URL: #18028 Reviewed-By: Ben Noordhuis <[email protected]> Reviewed-By: Colin Ihrig <[email protected]> Reviewed-By: James M Snell <[email protected]> Reviewed-By: Daniel Bevenius <[email protected]> Reviewed-By: Tiancheng "Timothy" Gu <[email protected]>
Since these are executing JS code, and in particular parts of that code may be provided by userland, handle such exceptions in C++. Refs: #17938 (comment) PR-URL: #18028 Reviewed-By: Ben Noordhuis <[email protected]> Reviewed-By: Colin Ihrig <[email protected]> Reviewed-By: James M Snell <[email protected]> Reviewed-By: Daniel Bevenius <[email protected]> Reviewed-By: Tiancheng "Timothy" Gu <[email protected]>
Add a padding strategy option that makes a best attempt to ensure that total frame length for DATA and HEADERS frames are aligned on multiples of 8-bytes. Backport-PR-URL: nodejs#18050 PR-URL: nodejs#17938 Reviewed-By: Anna Henningsen <[email protected]> Reviewed-By: Matteo Collina <[email protected]>
Add a padding strategy option that makes a best attempt to ensure that total frame length for DATA and HEADERS frames are aligned on multiples of 8-bytes. Backport-PR-URL: #18050 Backport-PR-URL: #20456 PR-URL: #17938 Reviewed-By: Anna Henningsen <[email protected]> Reviewed-By: Matteo Collina <[email protected]>
Since these are executing JS code, and in particular parts of that code may be provided by userland, handle such exceptions in C++. Refs: #17938 (comment) PR-URL: #18028 Reviewed-By: Ben Noordhuis <[email protected]> Reviewed-By: Colin Ihrig <[email protected]> Reviewed-By: James M Snell <[email protected]> Reviewed-By: Daniel Bevenius <[email protected]> Reviewed-By: Tiancheng "Timothy" Gu <[email protected]>
Since these are executing JS code, and in particular parts of that code may be provided by userland, handle such exceptions in C++. Refs: #17938 (comment) PR-URL: #18028 Reviewed-By: Ben Noordhuis <[email protected]> Reviewed-By: Colin Ihrig <[email protected]> Reviewed-By: James M Snell <[email protected]> Reviewed-By: Daniel Bevenius <[email protected]> Reviewed-By: Tiancheng "Timothy" Gu <[email protected]>
Since these are executing JS code, and in particular parts of that code may be provided by userland, handle such exceptions in C++. Refs: #17938 (comment) PR-URL: #18028 Reviewed-By: Ben Noordhuis <[email protected]> Reviewed-By: Colin Ihrig <[email protected]> Reviewed-By: James M Snell <[email protected]> Reviewed-By: Daniel Bevenius <[email protected]> Reviewed-By: Tiancheng "Timothy" Gu <[email protected]>
Add a padding strategy option that makes a best attempt to ensure
that total frame length for DATA and HEADERS frames are aligned
on multiples of 8-bytes.
Ping @nodejs/http2
Checklist
make -j4 test(UNIX), orvcbuild test(Windows) passesAffected core subsystem(s)
http2