Skip to content

Commit 6beb38d

Browse files
yutakahiranoannevk
authored andcommitted
Specify "transmit body for a request"
Fixes #441.
1 parent 744ccb1 commit 6beb38d

File tree

1 file changed

+47
-14
lines changed

1 file changed

+47
-14
lines changed

fetch.bs

+47-14
Original file line numberDiff line numberDiff line change
@@ -213,18 +213,6 @@ of:
213213
<a>queue a fetch task</a> on <var>request</var> to <a>process request end-of-body</a>
214214
for <var>request</var>.
215215

216-
<hr>
217-
218-
<p>To <dfn>read a <var>request</var></dfn>, if <var>request</var>'s
219-
<a for=request>body</a> is non-null, whenever
220-
<var>request</var>'s <a for=request>body</a> is read from (i.e.
221-
is transmitted or read by script), increase <var>request</var>'s
222-
<a for=request>body</a>'s
223-
<a for=body>transmitted bytes</a> with the amount of payload body
224-
bytes transmitted and then <a>queue a fetch task</a> on <var>request</var> to
225-
<a>process request body</a> for <var>request</var>.
226-
<!-- XXX xref "read", "payload body" -->
227-
228216

229217
<h3 id=http>HTTP</h3>
230218

@@ -1106,6 +1094,8 @@ or "<code>worker</code>".
11061094
<p class=note>See <a for=/>handle fetch</a> for usage of these terms.
11071095
[[!SW]]
11081096

1097+
<hr>
1098+
11091099
<p>To <dfn export for=request id=concept-request-clone>clone</dfn> a
11101100
<a for=/>request</a> <var>request</var>, run these steps:
11111101

@@ -1121,6 +1111,49 @@ or "<code>worker</code>".
11211111
<li><p>Return <var>newRequest</var>.
11221112
</ol>
11231113

1114+
<hr>
1115+
1116+
<p>To <dfn export for=request id=concept-request-transmit-body>transmit body</dfn> for a
1117+
<a for=/>request</a> <var>request</var>, run these steps:
1118+
1119+
<ol>
1120+
<li>Let <var>body</var> be <var>request</var>'s <a for=request>body</a>.
1121+
1122+
<li><p>If <var>body</var> is null, then <a>queue a fetch task</a> on <var>request</var> to
1123+
<a>process request end-of-body</a> for <var>request</var> and abort these steps.
1124+
1125+
<li>
1126+
<p>Let <var>read</var> be the result of <a lt="read a chunk" for=ReadableStream>reading a
1127+
chunk</a> from <var>body</var>'s <a for=body>stream</a>.
1128+
1129+
<ul>
1130+
<li>
1131+
<p>When <var>read</var> is fulfilled with an object whose <code>done</code>
1132+
property is false and whose <code>value</code> property is a
1133+
<code>Uint8Array</code> object, run these substeps:
1134+
1135+
<ol>
1136+
<li><p>Let <var>bytes</var> be the <a>byte sequence</a> represented by the
1137+
<code>Uint8Array</code> object.
1138+
1139+
<li><p>Transmit <var>bytes</var>.
1140+
1141+
<li><p>Increase <var>body</var>'s <a for=body>transmitted bytes</a> by <var>bytes</var>'s
1142+
length.
1143+
1144+
<li><p>Run the above step again.
1145+
</ol>
1146+
1147+
<li><p>When <var>read</var> is fulfilled with an object whose <code>done</code>
1148+
property is true, <a>queue a fetch task</a> on <var>request</var> to
1149+
<a>process request end-of-body</a> for <var>request</var>.
1150+
1151+
<li><p>When <var>read</var> is fulfilled with a value that matches with neither of the
1152+
above patterns, or <var>read</var> is rejected, <a lt=terminated for=fetch>terminate</a> the
1153+
ongoing fetch with reason <i>fatal</i>.
1154+
</ul>
1155+
</ol>
1156+
11241157

11251158
<h4 id=responses>Responses</h4>
11261159

@@ -2791,7 +2824,7 @@ optional <i>CORS flag</i> and <i>CORS-preflight flag</i>, run these steps:
27912824
<p>If <var>response</var> is not null, then run these substeps:
27922825

27932826
<ol>
2794-
<li><p><a lt="Read a request">Read <var>request</var></a>.
2827+
<li><p><a for=request>Transmit body</a> for <var>request</var>.
27952828

27962829
<li><p>Set <var>actualResponse</var> to <var>response</var>, if <var>response</var> is not a
27972830
<a>filtered response</a>, and to <var>response</var>'s
@@ -3457,7 +3490,7 @@ steps:
34573490
"<code>deprecated</code>" state value ought to be a temporary and last resort kind
34583491
of option.
34593492

3460-
<p><a lt="Read a request">Read <var>request</var></a>.
3493+
<p><a for=request>Transmit body</a> for <var>request</var>.
34613494

34623495
<li>
34633496
<p>Let <var>strategy</var> be an object. The user agent may choose any object.

0 commit comments

Comments
 (0)