Re: [whatwg/fetch] Add a limited size buffer for streaming upload in HTTP request. (#1204)

@annevk commented on this pull request.

Thanks, this looks good modulo a couple tiny nits.

> @@ -5063,14 +5063,13 @@ optional boolean <var>forceNewConnection</var> (default false), run these steps:
 
      <li>
       <p>If <var>request</var>'s <a for=request>body</a> is non-null, and <var>request</var>'s
-      <a for=request>body</a>'s <a for=body>source</a> is null, the user agent may have a buffer of
-      <a>implementation-defined</a> size and store a part of <var>request</var>'s
-      <a for=request>body</a> to the buffer. The buffer is used to resend <var>request</var>'s
-      <a for=request>body</a> to the network. If the user agent sent more than the buffer size and
-      is required to resend, return a <a>network error</a>.
+      <a for=request>body</a>'s <a for=body>source</a> is null, the user agent may have a buffer up
+      to 64k bytes and store a part of <var>request</var>'s <a for=request>body</a> to the buffer.

Please write this out as we do elsewhere, "64 kibibytes" (I'm assuming we don't want literal kilobytes in this instance).

> @@ -5061,6 +5061,25 @@ optional boolean <var>forceNewConnection</var> (default false), run these steps:
     <ul>
      <li><p>Follow the relevant requirements from HTTP. [[!HTTP]] [[!HTTP-SEMANTICS]] [[!HTTP-COND]] [[!HTTP-CACHING]] [[!HTTP-AUTH]]
 
+     <li>
+      <p>If <var>request</var>'s <a for=request>body</a> is non-null, and <var>request</var>'s
+      <a for=request>body</a>'s <a for=body>source</a> is null, the user agent may have a buffer up
+      to 64k bytes and store a part of <var>request</var>'s <a for=request>body</a> to the buffer.
+      If the user agent reads from <var>request</var>'s <a for=request>body</a> beyond the buffer
+      size, <var>request</var> is no longer eligible for resending.
+
+      <div class="note no-backref">
+       <p>The resending is needed when the connection is timed out, for example.
+
+       <p>The buffer is not needed when request's <a for=request>body</a>'s
+       <a for=body>source</a> is non-null, because the <a for=request>body</a> can be re-created

```suggestion
       <a for=body>source</a> is non-null, because the <a for=request>body</a> can be recreated
```

> +      <p>If <var>request</var>'s <a for=request>body</a> is non-null, and <var>request</var>'s
+      <a for=request>body</a>'s <a for=body>source</a> is null, the user agent may have a buffer up
+      to 64k bytes and store a part of <var>request</var>'s <a for=request>body</a> to the buffer.
+      If the user agent reads from <var>request</var>'s <a for=request>body</a> beyond the buffer
+      size, <var>request</var> is no longer eligible for resending.
+
+      <div class="note no-backref">
+       <p>The resending is needed when the connection is timed out, for example.
+
+       <p>The buffer is not needed when request's <a for=request>body</a>'s
+       <a for=body>source</a> is non-null, because the <a for=request>body</a> can be re-created
+       from <var>request</var>'s <a for=request>body</a>'s <a for=body>source</a>.
+
+       <p>When <var>request</var>'s <a for=request>body</a>'s source is null, it means
+       <a for=request>body</a> is created from {{ReadableStream}}, which means
+       <a for=request>body</a> can not be re-created and that's because why the buffer is needed.

```suggestion
       <a for=request>body</a> cannot be recreated and that is why the buffer is needed.
```

> @@ -5061,6 +5061,25 @@ optional boolean <var>forceNewConnection</var> (default false), run these steps:
     <ul>
      <li><p>Follow the relevant requirements from HTTP. [[!HTTP]] [[!HTTP-SEMANTICS]] [[!HTTP-COND]] [[!HTTP-CACHING]] [[!HTTP-AUTH]]
 
+     <li>
+      <p>If <var>request</var>'s <a for=request>body</a> is non-null, and <var>request</var>'s
+      <a for=request>body</a>'s <a for=body>source</a> is null, the user agent may have a buffer up
+      to 64k bytes and store a part of <var>request</var>'s <a for=request>body</a> to the buffer.
+      If the user agent reads from <var>request</var>'s <a for=request>body</a> beyond the buffer
+      size, <var>request</var> is no longer eligible for resending.
+
+      <div class="note no-backref">
+       <p>The resending is needed when the connection is timed out, for example.
+
+       <p>The buffer is not needed when request's <a for=request>body</a>'s
+       <a for=body>source</a> is non-null, because the <a for=request>body</a> can be re-created
+       from <var>request</var>'s <a for=request>body</a>'s <a for=body>source</a>.
+
+       <p>When <var>request</var>'s <a for=request>body</a>'s source is null, it means

xref source

> @@ -5061,6 +5061,25 @@ optional boolean <var>forceNewConnection</var> (default false), run these steps:
     <ul>
      <li><p>Follow the relevant requirements from HTTP. [[!HTTP]] [[!HTTP-SEMANTICS]] [[!HTTP-COND]] [[!HTTP-CACHING]] [[!HTTP-AUTH]]
 
+     <li>
+      <p>If <var>request</var>'s <a for=request>body</a> is non-null, and <var>request</var>'s
+      <a for=request>body</a>'s <a for=body>source</a> is null, the user agent may have a buffer up
+      to 64k bytes and store a part of <var>request</var>'s <a for=request>body</a> to the buffer.
+      If the user agent reads from <var>request</var>'s <a for=request>body</a> beyond the buffer
+      size, <var>request</var> is no longer eligible for resending.
+
+      <div class="note no-backref">
+       <p>The resending is needed when the connection is timed out, for example.
+
+       <p>The buffer is not needed when request's <a for=request>body</a>'s

request in `<var>`

> @@ -5061,6 +5061,25 @@ optional boolean <var>forceNewConnection</var> (default false), run these steps:
     <ul>
      <li><p>Follow the relevant requirements from HTTP. [[!HTTP]] [[!HTTP-SEMANTICS]] [[!HTTP-COND]] [[!HTTP-CACHING]] [[!HTTP-AUTH]]
 
+     <li>
+      <p>If <var>request</var>'s <a for=request>body</a> is non-null, and <var>request</var>'s
+      <a for=request>body</a>'s <a for=body>source</a> is null, the user agent may have a buffer up
+      to 64k bytes and store a part of <var>request</var>'s <a for=request>body</a> to the buffer.
+      If the user agent reads from <var>request</var>'s <a for=request>body</a> beyond the buffer
+      size, <var>request</var> is no longer eligible for resending.
+
+      <div class="note no-backref">
+       <p>The resending is needed when the connection is timed out, for example.
+
+       <p>The buffer is not needed when request's <a for=request>body</a>'s
+       <a for=body>source</a> is non-null, because the <a for=request>body</a> can be re-created
+       from <var>request</var>'s <a for=request>body</a>'s <a for=body>source</a>.

from it* would also work here.

-- 
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/whatwg/fetch/pull/1204#pullrequestreview-636297983

Received on Thursday, 15 April 2021 06:08:55 UTC