diff --git a/fetch.bs b/fetch.bs index 17e833703..7152bb5f6 100644 --- a/fetch.bs +++ b/fetch.bs @@ -15,7 +15,7 @@ Markup Shorthands: css off !Commits: [SNAPSHOT-LINK] !Commits: @fetchstandard !Translation (non-normative): 日本語 -Translate IDs: typedefdef-bodyinit bodyinit,typedefdef-responsebodyinit responsebodyinit,dictdef-requestinit requestinit,typedefdef-requestinfo requestinfo,enumdef-requesttype requesttype,enumdef-requestdestination requestdestination,enumdef-requestmode requestmode,enumdef-requestcredentials requestcredentials,enumdef-requestcache requestcache,enumdef-requestredirect requestredirect,dictdef-responseinit responseinit,enumdef-responsetype responsetype +Translate IDs: typedefdef-bodyinit bodyinit,dictdef-requestinit requestinit,typedefdef-requestinfo requestinfo,enumdef-requesttype requesttype,enumdef-requestdestination requestdestination,enumdef-requestmode requestmode,enumdef-requestcredentials requestcredentials,enumdef-requestcache requestcache,enumdef-requestredirect requestredirect,dictdef-responseinit responseinit,enumdef-responsetype responsetype @@ -571,13 +571,16 @@ user-agent-defined value for the
A body consists of:
A stream (a {{ReadableStream}} object). +
A stream (null or a {{ReadableStream}} + object).
A transmitted bytes (an integer), initially 0.
A total bytes (an integer), initially 0. + +
A source, initially null.
A body body is said to be @@ -2984,6 +2987,10 @@ in addition to HTTP fetch above. includes credentials, then return a network error. +
If actualResponse's status is not 303
,
+ request's body is non-null, and request's
+ body's source is null, then return a network error.
+
If CORS flag is set and actualResponse's
location URL
@@ -3008,6 +3015,15 @@ in addition to HTTP fetch above.
to `GET
` and request's body
to null.
+
If request's body is non-null, then set request's + body to the first part of extracting + request's body's source. + +
request's body's source's + nullity has already been checked. The extracting operation cannot + throw as it was called for the same source before. +
Append actualResponse's location URL to request's url list. @@ -3035,17 +3051,34 @@ steps: authentication-fetch flag.
Let httpRequest be null. + +
If request's window is "no-window
" and
+ request's redirect mode is "error
", then set
+ httpRequest to request.
+
Let httpRequest be request if
- request's window is "no-window
"
- and request's redirect mode is
- "error
", and the result of cloning
- request otherwise.
+
Otherwise, run these substeps: + +
Set httpRequest to a copy of request except for its + body. + +
Let body be request's body. -
A request is typically cloned as it needs to be possible to - add headers and read its - body without affecting request. As - request is reused with redirects, authentication, and proxy authentication. +
Set httpRequest's body to body. + +
If body is non-null, then set request's body to a + new body whose stream is null and whose source is + body's source. +
request is copied as httpRequest here as we need + to be able to add headers to httpRequest and read its body without + affecting request. Namely, request can be reused with redirects, + authentication, and proxy authentication. We copy rather than clone in order to reduce memory + consumption. In case request's body's source is + null, redirects and authentication will end up failing the fetch.
Let credentials flag be set if one of
@@ -3068,10 +3101,10 @@ steps:
`0
`.
-
If httpRequest's body is non-null, set +
If httpRequest's body is non-null and httpRequest's + body's source is non-null, then set contentLengthValue to httpRequest's body's total bytes, UTF-8 encoded. -
If contentLengthValue is non-null, append @@ -3079,7 +3112,7 @@ steps: httpRequest's header list. -
If contentLengthValue is non-null, httpRequest's keepalive flag is set, and contentLengthValue is greater than a user-agent-defined maximum, then return a network error. @@ -3088,7 +3121,6 @@ steps: allowed to outlive the environment settings object and contain a body, have a bounded size and are not allowed to stay alive indefinitely. -
If httpRequest's referrer is a URL, then
append `Referer
`/httpRequest's
referrer, serialized and UTF-8 encoded, to
@@ -3326,6 +3358,22 @@ steps:
Needs testing: multiple `WWW-Authenticate
` headers, missing,
parsing issues.
+
If request's body is non-null, then run these subsubsteps: + +
If request's body's source is null, + then return a network error. + +
Set request's body to the first part of + extracting request's body's + source. + +
The extracting operation cannot + throw as it was called for the same source before. +
If request's use-URL-credentials flag is unset or @@ -3407,6 +3455,12 @@ steps:
If connection is failure, return a network error. +
If connection is not an HTTP/2 connection, request's
+ body is non-null, and request's body's
+ source is null, then append
+ `Transfer-Encoding
`/`chunked
` to request's
+ header list.
+
Let response be the result of making an HTTP request over connection using request with the following caveats: @@ -3434,6 +3488,10 @@ steps: therefore response represents both a response and an HTTP response here. +
If request's header list contains
+ `Transfer-Encoding
`/`chunked
` and response is transferred
+ via HTTP/1.0 or older, then return a network error.
+
If the HTTP request results in a TLS client certificate dialog, run these substeps:
-typedef (Blob or BufferSource or FormData or URLSearchParams or USVString) BodyInit; - -typedef (BodyInit or ReadableStream) ResponseBodyInit;+typedef (Blob or BufferSource or FormData or URLSearchParams or ReadableStream or USVString) BodyInit;
To extract a body and a
`Content-Type
` value from
@@ -4199,7 +4255,9 @@ typedef (BodyInit or ReadableStream) ResponseBodyInit;
Let Content-Type be null. -
Let action be null. +
Let action be null. + +
Let source be null.
Switch on object's type: @@ -4212,6 +4270,8 @@ typedef (BodyInit or ReadableStream) ResponseBodyInit;
If object's {{Blob/type}} attribute is not the empty byte sequence, set Content-Type to its value. +
Set source to object. +
BufferSource
Enqueue a Uint8Array
object
@@ -4220,6 +4280,8 @@ typedef (BodyInit or ReadableStream) ResponseBodyInit;
stream. If that threw an exception,
error stream with that exception.
+
Set source to object. +
Set action to an action that runs the
@@ -4232,6 +4294,8 @@ typedef (BodyInit or ReadableStream) ResponseBodyInit;
multipart/form-data
boundary string generated by the
multipart/form-data
encoding algorithm.
+
Set source to object. +
Set action to an action that runs the @@ -4243,12 +4307,16 @@ typedef (BodyInit or ReadableStream) ResponseBodyInit;
Set Content-Type to
`application/x-www-form-urlencoded;charset=UTF-8
`.
+
Set source to object. +
USVString
Set action to an action that runs UTF-8 encode on object.
Set Content-Type to `text/plain;charset=UTF-8
`.
+
Set source to object. +
Set stream to object. @@ -4272,8 +4340,8 @@ typedef (BodyInit or ReadableStream) ResponseBodyInit; close stream.
Let body be a body whose stream is + stream and whose source is source.
Return body and Content-Type.
If inputBody is non-null and inputBody's source is + null, then run these substeps: + +
If r's request's mode is neither
+ "same-origin
" nor "cors
", then throw a TypeError
.
+
+
Set r's request's + use-CORS-preflight flag. +
Set r's request's body to inputBody. @@ -4914,7 +4994,7 @@ run these steps:
[Constructor(optional ResponseBodyInit? body = null, optional ResponseInit init), +[Constructor(optional BodyInit? body = null, optional ResponseInit init), Exposed=(Window,Worker)] interface Response { [NewObject] static Response error();