PROTOCOLS
Loader
Defined in fuchsia.net.http/client.fidl
An HTTP and HTTPS loader.
The loader can service many HTTP or HTTPS requests concurrently. The loader tracks all the outstanding requests and will cancel them all if the client closes the loader interface.
Fetch
Initiate the given HTTP or HTTPS request, follow redirects, and return the final response.
The loader will follow redirects (up to an implementation-defined limit)
and return the final response as a reply to this message. To cancel the
request, either close the loader interface or close the peer to the
event
included in the request
.
Request
Name | Type |
---|---|
request |
Request
|
Response
Name | Type |
---|---|
response |
Response
|
Start
Initiate the given HTTP or HTTPS request and return all intermediate responses to the given client.
Unlike Fetch
, Start
does not automatically follow all redirects.
Instead, each individual response along the redirect chain is delivered
to the LoaderClient
.
Request
Name | Type |
---|---|
request |
Request
|
client |
client_end:LoaderClient
|
LoaderClient
Defined in fuchsia.net.http/client.fidl
A client interface used with Loader.Start
.
Closing the underlying channel will cancel the associated HTTP transaction.
OnResponse
Called by the loader when the loader receives an HTTP response.
If the server has requested a redirect, then redirect
in response
table will describe the target the server requested. To follow the
redirect, reply to this message. To not follow the redirect, close the
underlying channel.
Request
Name | Type |
---|---|
response |
Response
|
Response
<EMPTY>
STRUCTS
Header
Defined in fuchsia.net.http/client.fidl
An HTTP header field.
Field | Type | Description | Default |
---|---|---|---|
name |
HeaderName
|
The name of the header field. |
No default |
value |
HeaderValue
|
The value of the header field. |
No default |
ENUMS
Error strict
Type: uint32
Defined in fuchsia.net.http/client.fidl
An error occurred during the HTTP transaction.
Name | Value | Description |
---|---|---|
INTERNAL |
1 |
Some other problem occurred that cannot be classified using one of the more specific statuses. Retry is optional. |
UNABLE_TO_PARSE |
2 |
An HTTP parse error. |
CHANNEL_CLOSED |
3 |
Indicates a channel (client or body sender) is closed. |
CONNECT |
4 |
Error occurred while connecting. |
DEADLINE_EXCEEDED |
5 |
The deadline specified in Request has passed |
TABLES
RedirectTarget
Defined in fuchsia.net.http/client.fidl
A description of the redirect the server requested.
The semantics of an HTTP redirect vary according to the status code use to generate the redirect. This structure ensures that the loader and its client agree on the interpretation of the redirect response from the server.
Ordinal | Field | Type | Description |
---|---|---|---|
1 |
method |
Method
|
The HTTP method the server suggested for the redirect. |
2 |
url |
fuchsia.url/Url
|
The URL the server suggested for the redirect. |
3 |
referrer |
fuchsia.url/Url
|
The referrer the server suggested for the redirect. |
Request resource
Defined in fuchsia.net.http/client.fidl
An HTTP request.
Ordinal | Field | Type | Description |
---|---|---|---|
1 |
method |
Method
|
The HTTP method if applicable. Defaults to "GET". |
2 |
url |
fuchsia.url/Url
|
The URL to load. Required. |
3 |
headers |
vector<Header>
|
Additional HTTP request headers. |
4 |
body |
Body
|
The payload for the request body. For HTTP requests, the method must be set to "POST" or "PUT". If a buffer is used for the body, a Content-Length header will automatically be added. |
5 |
deadline |
zx/Time
|
Determines when to give up on waiting for a response from the server. If no deadline is provided, the implementation will provide a reasonable default. |
Response resource
Defined in fuchsia.net.http/client.fidl
A response to an HTTP request.
Ordinal | Field | Type | Description |
---|---|---|---|
1 |
error |
Error
|
If the response resulted in a network level error, this field will be set. |
2 |
body |
handle<socket>
|
The response body. |
3 |
final_url |
fuchsia.url/Url
|
The final URL of the response, after redirects have been followed. |
4 |
status_code |
uint32
|
The HTTP status code. |
5 |
status_line |
vector<uint8>
|
The HTTP status line. |
6 |
headers |
vector<Header>
|
The HTTP response headers. |
7 |
redirect |
RedirectTarget
|
A description of the redirect the server requested, if any. |
UNIONS
Body strict resource
Defined in fuchsia.net.http/client.fidl
The body of an HTTP request.
Ordinal | Variant | Type | Description |
---|---|---|---|
1 |
buffer |
fuchsia.mem/Buffer
|
A buffer that will contain the complete request or response body. |
2 |
stream |
handle<socket>
|
A socket that will contain the streaming request or response body. |
ALIASES
Name | Value | Description |
---|---|---|
HeaderName |
vector [fidl/MAX ] |
Friendly alias for a vector of bytes containing a header name. |
HeaderValue |
vector [fidl/MAX ] |
Friendly alias for a vector of bytes containing a header value. |
Method |
string [1024 ] |