[Webkit-unassigned] [Bug 265331] New: Can not determine disconnected vs finished/completed chunked response body

bugzilla-daemon at webkit.org bugzilla-daemon at webkit.org
Fri Nov 24 18:40:30 PST 2023


https://bugs.webkit.org/show_bug.cgi?id=265331

            Bug ID: 265331
           Summary: Can not determine disconnected vs finished/completed
                    chunked response body
           Product: WebKit
           Version: Safari 15
          Hardware: Mac (Intel)
                OS: macOS 12
            Status: NEW
          Severity: Blocker
          Priority: P2
         Component: WebCore JavaScript
          Assignee: webkit-unassigned at lists.webkit.org
          Reporter: benjamin.hindman at gmail.com

It does not appear to be possible to differentiate between a disconnected stream and a finished/completed stream.

Consider:

---------------------------------------------

const response = await fetch(...);

const reader = response.body.getReader();

try {
  while (true) {
    const { done, value } = await reader.read();
    if (done) {
      // Safari always goes here if the server crashes.
      break;
    } else {
      // ...
    }
  }
} catch (e) {
  // Chrome and Firefox always goes here if the server crashes.
  console.log(e);
}

---------------------------------------------

If the server crashes while reading from the `ReadableStream` reader, Safari will tell us that we are done while Chrome and Firefox will correctly tell us that the connection was disconnected. Safari should only tell us that we are done if it has received '0\r\n\r\n', which it most definitely has not.

Or is there some other way to differentiate this case that is cross-browser?

-- 
You are receiving this mail because:
You are the assignee for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.webkit.org/pipermail/webkit-unassigned/attachments/20231125/9ca095c0/attachment.htm>


More information about the webkit-unassigned mailing list