fuchsia.net.http

Added: 7

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

NameType
request Request

Response

NameType
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

NameType
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

NameType
response Response

Response

<EMPTY>

STRUCTS

Defined in fuchsia.net.http/client.fidl

An HTTP header field.

FieldTypeDescriptionDefault
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.

NameValueDescription
1

Some other problem occurred that cannot be classified using one of the more specific statuses. Retry is optional.

2

An HTTP parse error.

3

Indicates a channel (client or body sender) is closed.

4

Error occurred while connecting.

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.

OrdinalFieldTypeDescription
method Method

The HTTP method the server suggested for the redirect.

url fuchsia.url/Url

The URL the server suggested for the redirect.

referrer fuchsia.url/Url

The referrer the server suggested for the redirect.

Request resource

Defined in fuchsia.net.http/client.fidl

An HTTP request.

OrdinalFieldTypeDescription
method Method

The HTTP method if applicable.

Defaults to "GET".

url fuchsia.url/Url

The URL to load.

Required.

headers vector<Header>

Additional HTTP request headers.

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.

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.

OrdinalFieldTypeDescription
error Error

If the response resulted in a network level error, this field will be set.

body handle<socket>

The response body.

final_url fuchsia.url/Url

The final URL of the response, after redirects have been followed.

status_code uint32

The HTTP status code.

status_line vector<uint8>

The HTTP status line.

headers vector<Header>

The HTTP response headers.

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.

OrdinalVariantTypeDescription
buffer fuchsia.mem/Buffer

A buffer that will contain the complete request or response body.

stream handle<socket>

A socket that will contain the streaming request or response body.

ALIASES

NameValueDescription
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]