Join GitHub today
GitHub is home to over 50 million developers working together to host and review code, manage projects, and build software together.
Sign upIntegrate streams into HTTP redirect #26686
Comments
|
I think it's a good way to learn about, or look more into, the whole IPC/event-loop integration and |
|
This is partially addressed by the "partially integrate streaming request bodies with http re-direct" commit in #25873, although not by actually re-extracting a stream(it only works with sources that have already been read into memory), and it won't work with file-based blobs. So the goal of this issue would be to replace the implementation of that commit with something that would actually queue a task and re-extract a stream from the Dom object. The IPC setup is already largely done. cc @jdm (so we don't have any regressions from that PR anymore) |
Follow-up on #25873 (comment)
The current integration means the request body is "lost" in the case of a re-direct, I think because it has been streamed already and therefore the stream is "done".
So the spec actually says we should "re-extract" a new stream from the original source object, see Step 12 of https://fetch.spec.whatwg.org/#ref-for-concept-http-redirect-fetch
I think this would require storing the original object in a
Trusted<OriginalSource>on theTransmitBodyConnectHandler(whereOriginalSourceis probably an enum for the various sources), and then add another IPC message toBodyChunkRequest, say aReExtract<(IpcReceiver<BodyChunkRequest>>one, that would be handled in script by:IpcReceiver<BodyChunkRequest>to essentially dointo_net_request_bodyexcept that it wouldn't produce a body, and it would use the receiver to setup the route and create a newTransmitBodyConnectHandlerto then later transmit the body for the re-direct.On the net side of things, you would have to create an IPC channel, and then set the receiver to replace the exiting
streamof theRequestBody, and then send the receiver over IPC back to script, using the original sender found onstream.I think this roughly describes what needs to be done, but it might require some additional looking into.