-
Notifications
You must be signed in to change notification settings - Fork 340
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
Question about stream handling around fetch requests with integrity metadata #1754
Comments
Oh no. I hope @ricea and @MattiasBuelens can help out here. Thanks for raising this! |
I think the key point is this step:
This replaces |
But that happens after the pipe operation - the body's stream gets set to the result of piping its current stream through |
The stream that we read in
|
Hi all - thanks for the help on this one, we traced the issue down to a subtle bug where the stream created from extracting the body as bytes was not being used later on in the fetch response handover. Apologies for taking anyone's time on this one! |
Hello - we've slowly been making the Ladybird browser use the streams spec for fetch, and ran into a couple issues with fetch requests that have integrity metadata.
In main fetch step 22, we have (abbreviated here):
Where, in fetch response handover, we create a transform stream to pipe the request's body through:
The first issue we hit is that when we fully read the response body, we acquire a reader for the body's stream. This locks the stream. I might be missing something, but I don't see anywhere that releases this acquired reader (and thus unlocks the stream). This causes an assertion failure later when the fetch response handover is run - the first step of piping through states:
So should the steps for fully reading the body include releasing the acquired reader in its success / error steps?
(Incremental reading appears to leave the stream locked as well).
The second issue we hit is that the body's stream is actually closed by the time we get to piping through to the transform stream. This happens after the body is extracted:
The stream isn't closed right away there, because we just enqueued some data - rather, it gets marked with as "close requested". When we fully read the response body from main-fetch, we receive the queued data, and then the stream is actually closed.
So then when we enter the transform stream steps, the response body's stream is closed, which prevents the pipe-through operation from actually doing anything (as far as I can tell), because there's no queued data (it was taken by fully-read) and no way to pull more data.
The text was updated successfully, but these errors were encountered: