fuchsia.net.http

PROTOCOLS

Loader

Defined in fuchsia.net.http/client.fidl

An HTTP loader.

The loader can service many HTTP 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 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 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 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

NameType

STRUCTS

Defined in fuchsia.net.http/client.fidl

An HTTP header field.

NameTypeDescriptionDefault
name vector<uint8>

The name of the header field.

No default
value vector<uint8>

The value of the header field.

No default

ENUMS

Error

Type: uint32

Defined in fuchsia.net.http/client.fidl

An error occurred during the HTTP transaction.

NameValueDescription
INTERNAL 1

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

TABLES

Request

Defined in fuchsia.net.http/client.fidl

An HTTP request.

OrdinalNameTypeDescription
1 method Method

The HTTP method if applicable.

Defaults to "GET".

2 url vector<uint8>

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.

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.

OrdinalNameTypeDescription
1 method Method

The HTTP method the server suggested for the redirect.

2 url vector<uint8>

The URL the server suggested for the redirect.

3 referrer vector<uint8>

The referrer the server suggested for the redirect.

Response

Defined in fuchsia.net.http/client.fidl

A response to an HTTP request.

OrdinalNameTypeDescription
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 vector<uint8>

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

Defined in fuchsia.net.http/client.fidl

The body of an HTTP request.

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

TYPE ALIASES

NameValueDescription
Method string