Comments (4)
Hm, what we lose with this is the guarantee that frames are sent (and received) in the order they are written in the stream. I looked this up in the spec and it says:
The order in which frames are sent on a stream is significant. Recipients process frames in the order they are received. In particular, the order of HEADERS, and DATA frames is semantically significant.
So I don't think we can optimize this.
from node-http2-protocol.
I'm not so sure about that. It may not be as simple as I was originally thinking, but I think it's doable. When I was looking at this, I wasn't thinking about HEADERS or DATA particularly, this came up when I was implementing ALTSVC. Here are some things that we would need to guard against:
- Sending any DATA before we've sent the full header block (HEADERS|PUSH_PROMISE CONTINUATION*) (because duh)
- Reordering frames within a header block or a sequence of DATA frames (because duh)
- Sending a SETTINGS that updates the compression context out-of-order with a header block (since the header block would depend on the previous max header table size)
- Sending a RST_STREAM if we have any data waiting (since it's possible that the other endpoint may want to do something with the data that we've sent, such as saving a partial download for a later range request)
The only other one that could get a little weird is sending a PRIORITY, though if we're sending DATA on an particular stream, we're probably not the one that should be sending PRIORITY frames for that stream, anyway. (Obviously we wouldn't want to send PRIORITY before HEADERS.)
I don't see any issues sending, for example, ALTSVC on a stream that's blocked on flow control. I can even see a reason to actually do so - if you believe the client isn't going to be opening its window any time soon but that it's not malicious (not an incredibly likely scenario, but still...), you may want to try to redirect it to get a new connection with a new flow control window.
from node-http2-protocol.
Yeah, it's doable in certain scenarios. I'm OK with handling the cases we know are safe specially, but I'm afraid of using very complicated logic to do this. How about implementing a _pushUpstreamWithoutFlowControl()
method on the Stream class as an alternative to _pushUpstream()
which could be used in cases when we know this can not cause trouble (like ALTSVC)?
It would look like this:
Stream.prototype._pushUpstreamWithoutFlowControl = function _pushUpstreamWithoutFlowControl(frame) {
this.upstream._parentPush(frame); // Logs the frame and pushed directly into the output queue
this._transition(true, frame);
};
from node-http2-protocol.
Yeah, I think that seems like a reasonable way to go about it. Once draft14 lands (which should be as soon as Martin has the spec revision ready, unless he surprises me with some last-minute changes), I'll work on adding this.
from node-http2-protocol.
Related Issues (14)
- Upgrade to the -07 draft HOT 1
- Sending frames on already closed stream should raise RST_STREAM HOT 1
- Reserved bits are treated as part of frame length
- Unknown frame types must be ignored HOT 1
- Use simple-streams internally for data flow
- Sending BLOCKED frame HOT 1
- Compression: implement a real streaming decompressor
- Forbid sending a promise when the peer disables it
- Update examples to use node-http2-protocol instead of node-http2 HOT 1
- header compression error HOT 4
- SETTINGS frame with ACK flag set and non-zero length HOT 1
- WINDOW_UPDATE frame with oversized payload or without payload should raise error of type FRAME_SIZE_ERROR HOT 1
- PING frame with a length field value other than 8 must raise FRAME_SIZE_ERROR HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from node-http2-protocol.