LibAwsHTTP

Documentation for LibAwsHTTP.

LibAwsHTTP.aws_http1_stream_write_chunk_complete_fnType

Invoked when the data of an outgoing HTTP/1.1 chunk is no longer in use. This is always invoked on the HTTP connection's event-loop thread.

Arguments

  • stream: HTTP-stream this chunk was submitted to.
  • error_code: If error_code is AWS_ERROR_SUCCESS (0), the data was successfully sent. Any other error_code indicates that the HTTP-stream is in the process of terminating. If the error_code is AWS_ERROR_HTTP_STREAM_HAS_COMPLETED, the stream's termination has nothing to do with this chunk. Any other non-zero error code indicates a problem with this particular chunk's data.
  • user_data: User data for this chunk.
source
LibAwsHTTP.aws_http2_on_change_settings_complete_fnType

Invoked when the HTTP/2 settings change is complete. If connection setup successfully this will always be invoked whether settings change successfully or unsuccessfully. If error_code is AWS_ERROR_SUCCESS (0), then the peer has acknowledged the settings and the change has been applied. If error_code is non-zero, then a connection error occurred before the settings could be fully acknowledged and applied. This is always invoked on the connection's event-loop thread.

source
LibAwsHTTP.aws_http2_on_goaway_received_fnType

Invoked when an HTTP/2 GOAWAY frame is received from peer. Implies that the peer has initiated shutdown, or encountered a serious error. Once a GOAWAY is received, no further streams may be created on this connection.

Arguments

  • http2_connection: This HTTP/2 connection.
  • last_stream_id: ID of the last locally-initiated stream that peer will process. Any locally-initiated streams with a higher ID are ignored by peer, and are safe to retry on another connection.
  • http2_error_code: The HTTP/2 error code (RFC-7540 section 7) sent by peer. enum [awshttp2error_code](@ref) lists official codes.
  • debug_data: The debug data sent by peer. It can be empty. (NOTE: this data is only valid for the lifetime of the callback. Make a deep copy if you wish to keep it longer.)
  • user_data: User-data passed to the callback.
source
LibAwsHTTP.aws_http2_on_ping_complete_fnType

Invoked when the HTTP/2 PING completes, whether peer has acknowledged it or not. If error_code is AWS_ERROR_SUCCESS (0), then the peer has acknowledged the PING and round_trip_time_ns will be the round trip time in nano seconds for the connection. If error_code is non-zero, then a connection error occurred before the PING get acknowledgment and round_trip_time_ns will be useless in this case.

source
LibAwsHTTP.aws_http2_on_remote_settings_change_fnType

Invoked when new HTTP/2 settings from peer have been applied. Settings_array is the array of aws_http2_settings that contains all the settings we just changed in the order we applied (the order settings arrived). Num_settings is the number of elements in that array.

source
LibAwsHTTP.aws_http2_stream_manager_on_stream_acquired_fnType

Always invoked asynchronously when the stream was created, successfully or not. When stream is NULL, error code will be set to indicate what happened. If there is a stream returned, you own the stream completely. Invoked on the same thread as other callback of the stream, which will be the thread of the connection, ideally. If there is no connection made, the callback will be invoked from a sperate thread.

source
LibAwsHTTP.aws_http2_stream_manager_optionsType
aws_http2_stream_manager_options

HTTP/2 stream manager configuration struct.

Contains all of the configuration needed to create an http2 connection as well as connection manager under the hood.

source
LibAwsHTTP.aws_http2_stream_write_data_complete_fnType

Invoked when the data of an outgoing HTTP2 data frame is no longer in use. This is always invoked on the HTTP connection's event-loop thread.

Arguments

  • stream: HTTP2-stream this write was submitted to.
  • error_code: If error_code is AWS_ERROR_SUCCESS (0), the data was successfully sent. Any other error_code indicates that the HTTP-stream is in the process of terminating. If the error_code is AWS_ERROR_HTTP_STREAM_HAS_COMPLETED, the stream's termination has nothing to do with this write. Any other non-zero error code indicates a problem with this particular write's data.
  • user_data: User data for this write.
source
LibAwsHTTP.aws_http_header_blockType
aws_http_header_block

Header block type. INFORMATIONAL: Header block for 1xx informational (interim) responses. MAIN: Main header block sent with request or response. TRAILING: Headers sent after the body of a request or response.

source
LibAwsHTTP.aws_http_header_compressionType
aws_http_header_compression

Controls whether a header's strings may be compressed by encoding the index of strings in a cache, rather than encoding the literal string.

This setting has no effect on HTTP/1.x connections. On HTTP/2 connections this controls HPACK behavior. See RFC-7541 Section 7.1 for security considerations.

source
LibAwsHTTP.aws_http_headersType

A transformable block of HTTP headers. Provides a nice API for getting/setting header names and values.

All strings are copied and stored within this datastructure. The index of a given header may change any time headers are modified. When iterating headers, the following ordering rules apply:

  • Headers with the same name will always be in the same order, relative to one another. If "A: one" is added before "A: two", then "A: one" will always precede "A: two".

  • Headers with different names could be in any order, relative to one another. If "A: one" is seen before "B: bee" in one iteration, you might see "B: bee" before "A: one" on the next.

source
LibAwsHTTP.aws_http_message_transform_fnType

A function that may modify a request or response before it is sent. The transformation may be asynchronous or immediate. The user MUST invoke the complete_fn when transformation is complete or the application will soft-lock. When invoking the complete_fn, pass along the message and complete_ctx provided here and an error code. The error code should be AWS_ERROR_SUCCESS if transformation was successful, otherwise pass a different AWS_ERROR_X value.

source
LibAwsHTTP.aws_http_on_client_connection_setup_fnType

Invoked when connect completes.

If unsuccessful, error_code will be set, connection will be NULL, and the on_shutdown callback will never be invoked.

If successful, error_code will be 0 and connection will be valid. The user is now responsible for the connection and must call aws_http_connection_release() when they are done with it.

The connection uses one event-loop thread to do all its work. The thread invoking this callback will be the same thread that invokes all future callbacks for this connection and its streams.

source
LibAwsHTTP.aws_http_on_incoming_body_fnType

Called repeatedly as body data is received. The data must be copied immediately if you wish to preserve it. This is always invoked on the HTTP connection's event-loop thread.

Note that, if the connection is using manual_window_management then the window size has shrunk by the amount of body data received. If the window size reaches 0 no further data will be received. Increment the window size with aws_http_stream_update_window().

Return AWS_OP_SUCCESS to continue processing the stream. Return aws_raise_error(E) to indicate failure and cancel the stream. The error you raise will be reflected in the error_code passed to the on_complete callback.

source
LibAwsHTTP.aws_http_on_incoming_header_block_done_fnType

Invoked when the incoming header block of this type(informational/main/trailing) has been completely read. This is always invoked on the HTTP connection's event-loop thread.

Return AWS_OP_SUCCESS to continue processing the stream. Return aws_raise_error(E) to indicate failure and cancel the stream. The error you raise will be reflected in the error_code passed to the on_complete callback.

source
LibAwsHTTP.aws_http_on_incoming_headers_fnType

Invoked repeatedly times as headers are received. At this point, aws_http_stream_get_incoming_response_status() can be called for the client. And aws_http_stream_get_incoming_request_method() and aws_http_stream_get_incoming_request_uri() can be called for the server. This is always invoked on the HTTP connection's event-loop thread.

Return AWS_OP_SUCCESS to continue processing the stream. Return aws_raise_error(E) to indicate failure and cancel the stream. The error you raise will be reflected in the error_code passed to the on_complete callback.

source
LibAwsHTTP.aws_http_on_incoming_request_done_fnType

Invoked when request has been completely read. This is always invoked on the HTTP connection's event-loop thread.

Return AWS_OP_SUCCESS to continue processing the stream. Return aws_raise_error(E) to indicate failure and cancel the stream. The error you raise will be reflected in the error_code passed to the on_complete callback.

source
LibAwsHTTP.aws_http_on_incoming_request_fnType

Invoked at the start of an incoming request. To process the request, the user must create a request handler stream and return it to the connection. If NULL is returned, the request will not be processed and the last error will be reported as the reason for failure.

source
LibAwsHTTP.aws_http_on_stream_complete_fnType

Invoked when a request/response stream is complete, whether successful or unsuccessful This is always invoked on the HTTP connection's event-loop thread. This will not be invoked if the stream is never activated.

source
LibAwsHTTP.aws_http_on_stream_destroy_fnType

Invoked when request/response stream destroy completely. This can be invoked within the same thead who release the refcount on http stream. This is invoked even if the stream is never activated.

source
LibAwsHTTP.aws_http_proxy_negotiation_http_request_transform_async_fnType

User-supplied transform callback which implements the proxy request flow and ultimately, across all execution pathways, invokes either the terminate function or the forward function appropriately.

For tunneling proxy connections, this request flow transform only applies to the CONNECT stage of proxy connection establishment.

For forwarding proxy connections, this request flow transform applies to every single http request that goes out on the connection.

Forwarding proxy connections cannot yet support a truly async request transform without major surgery on http stream creation, so for now, we split into an async version (for tunneling proxies) and a separate synchronous version for forwarding proxies. Also forwarding proxies are a kind of legacy dead-end in some sense.

source
LibAwsHTTP.aws_http_stream_write_complete_fnType

Invoked when the data stream of an outgoing HTTP write operation is no longer in use. This is always invoked on the HTTP connection's event-loop thread.

Arguments

  • stream: HTTP-stream this write operation was submitted to.
  • error_code: If error_code is AWS_ERROR_SUCCESS (0), the data was successfully sent. Any other error_code indicates that the HTTP-stream is in the process of terminating. If the error_code is AWS_ERROR_HTTP_STREAM_HAS_COMPLETED, the stream's termination has nothing to do with this write operation. Any other non-zero error code indicates a problem with this particular write operation's data.
  • user_data: User data for this write operation.
source
LibAwsHTTP.aws_websocket_on_connection_setup_dataType
aws_websocket_on_connection_setup_data

Data passed to the websocket on_connection_setup callback.

An error_code of zero indicates that setup was completely successful. You own the websocket pointer now and must call aws_websocket_release() when you are done with it. You can inspect the response headers, if you're interested.

A non-zero error_code indicates that setup failed. The websocket pointer will be NULL. If the server sent a response, you can inspect its status-code, headers, and body, but this data will NULL if setup failed before a full response could be received. If you wish to persist data from the response make a deep copy. The response data becomes invalid once the callback completes.

source
LibAwsHTTP.aws_websocket_on_incoming_frame_begin_fnType

Called when a new frame arrives. Invoked once per frame on the websocket's event-loop thread. Each incoming-frame-begin call will eventually be followed by an incoming-frame-complete call, before the next frame begins and before the websocket shuts down.

Return true to proceed normally. If false is returned, the websocket will read no further data, the frame will complete with an error-code, and the connection will close.

source
LibAwsHTTP.aws_websocket_on_incoming_frame_complete_fnType

Called when done processing an incoming frame. If error_code is non-zero, an error occurred and the payload may not have been completely received. Invoked once per frame on the websocket's event-loop thread.

Return true to proceed normally. If false is returned, the websocket will read no further data and the connection will close.

source
LibAwsHTTP.aws_websocket_on_incoming_frame_payload_fnType

Called repeatedly as payload data arrives. Invoked 0 or more times on the websocket's event-loop thread. Payload data will not be valid after this call, so copy if necessary. The payload data is always unmasked at this point.

NOTE: If you created the websocket with manual_window_management set true, you must maintain the read window. Whenever the read window reaches 0, you will stop receiving anything. The websocket's initial_window_size determines the starting size of the read window. The read window shrinks as you receive the payload from "data" frames (TEXT, BINARY, and CONTINUATION). Use aws_websocket_increment_read_window() to increment the window again and keep frames flowing. Maintain a larger window to keep up high throughput. You only need to worry about the payload from "data" frames. The websocket automatically increments the window to account for any other incoming bytes, including other parts of a frame (opcode, payload-length, etc) and the payload of other frame types (PING, PONG, CLOSE).

Return true to proceed normally. If false is returned, the websocket will read no further data, the frame will complete with an error-code, and the connection will close.

source
LibAwsHTTP.aws_websocket_send_frame_optionsType
aws_websocket_send_frame_options

Options for sending a websocket frame. This structure is copied immediately by aws_websocket_send(). For descriptions of opcode, fin, and payload_length see in RFC-6455 Section 5.2.

source
LibAwsHTTP.aws_websocket_stream_outgoing_payload_fnType

Called repeatedly as the websocket's payload is streamed out. The user should write payload data to out_buf, up to available capacity. The websocket will mask this data for you, if necessary. Invoked repeatedly on the websocket's event-loop thread.

Return true to proceed normally. If false is returned, the websocket will send no further data, the frame will complete with an error-code, and the connection will close.

source
LibAwsHTTP.aws_future_http_message_acquireMethod
aws_future_http_message_acquire(future)

Documentation not found.

Prototype

AWS_FUTURE_T_POINTER_WITH_RELEASE_DECLARATION(aws_future_http_message, struct aws_http_message, AWS_HTTP_API);
source
LibAwsHTTP.aws_future_http_message_is_doneMethod
aws_future_http_message_is_done(future)

Documentation not found.

Prototype

AWS_FUTURE_T_POINTER_WITH_RELEASE_DECLARATION(aws_future_http_message, struct aws_http_message, AWS_HTTP_API);
source
LibAwsHTTP.aws_future_http_message_newMethod
aws_future_http_message_new(alloc)

Documentation not found.

Prototype

AWS_FUTURE_T_POINTER_WITH_RELEASE_DECLARATION(aws_future_http_message, struct aws_http_message, AWS_HTTP_API);
source
LibAwsHTTP.aws_future_http_message_releaseMethod
aws_future_http_message_release(future)

Documentation not found.

Prototype

AWS_FUTURE_T_POINTER_WITH_RELEASE_DECLARATION(aws_future_http_message, struct aws_http_message, AWS_HTTP_API);
source
LibAwsHTTP.aws_future_http_message_set_errorMethod
aws_future_http_message_set_error(future, error_code)

Documentation not found.

Prototype

AWS_FUTURE_T_POINTER_WITH_RELEASE_DECLARATION(aws_future_http_message, struct aws_http_message, AWS_HTTP_API);
source
LibAwsHTTP.aws_future_http_message_waitMethod
aws_future_http_message_wait(future, timeout_ns)

Documentation not found.

Prototype

AWS_FUTURE_T_POINTER_WITH_RELEASE_DECLARATION(aws_future_http_message, struct aws_http_message, AWS_HTTP_API);
source
LibAwsHTTP.aws_http1_stream_add_chunked_trailerMethod
aws_http1_stream_add_chunked_trailer(http1_stream, trailing_headers)

Add a list of headers to be added as trailing headers sent after the last chunk is sent. a "Trailer" header field which indicates the fields present in the trailer.

Certain headers are forbidden in the trailer (e.g., Transfer-Encoding, Content-Length, Host). See RFC-7541 Section 4.1.2 for more details.

For client streams, activate() must be called before any chunks are submitted.

For server streams, the response must be submitted before the trailer can be added

aws_http1_stream_add_chunked_trailer must be called before the final size 0 chunk, and at the moment can only be called once, though this could change if need be.

Returns AWS_OP_SUCCESS if the chunk has been submitted.

Prototype

int aws_http1_stream_add_chunked_trailer( struct aws_http_stream *http1_stream, const struct aws_http_headers *trailing_headers);
source
LibAwsHTTP.aws_http1_stream_write_chunkMethod
aws_http1_stream_write_chunk(http1_stream, options)

Submit a chunk of data to be sent on an HTTP/1.1 stream. The stream must have specified "chunked" in a "transfer-encoding" header, and the aws_http_message must NOT have any body stream set. For client streams, activate() must be called before any chunks are submitted. For server streams, the response must be submitted before any chunks. A final chunk with size 0 must be submitted to successfully complete the HTTP-stream.

Returns AWS_OP_SUCCESS if the chunk has been submitted. The chunk's completion callback will be invoked when the HTTP-stream is done with the chunk data, whether or not it was successfully sent (see aws_http1_stream_write_chunk_complete_fn). The chunk data must remain valid until the completion callback is invoked.

Returns AWS_OP_ERR and raises an error if the chunk could not be submitted. In this case, the chunk's completion callback will never be invoked. Note that it is always possible for the HTTP-stream to terminate unexpectedly prior to this call being made, in which case the error raised is AWS_ERROR_HTTP_STREAM_HAS_COMPLETED.

Prototype

int aws_http1_stream_write_chunk( struct aws_http_stream *http1_stream, const struct aws_http1_chunk_options *options);
source
LibAwsHTTP.aws_http2_connection_change_settingsMethod
aws_http2_connection_change_settings(http2_connection, settings_array, num_settings, on_completed, user_data)

Send a SETTINGS frame (HTTP/2 only). SETTINGS will be applied locally when SETTINGS ACK is received from peer.

Arguments

  • http2_connection: HTTP/2 connection.
  • settings_array: The array of settings to change. Note: each setting has its boundary.
  • num_settings: The num of settings to change in settings_array.
  • on_completed: Optional callback, see aws_http2_on_change_settings_complete_fn.
  • user_data: User-data pass to on_completed callback.

Prototype

int aws_http2_connection_change_settings( struct aws_http_connection *http2_connection, const struct aws_http2_setting *settings_array, size_t num_settings, aws_http2_on_change_settings_complete_fn *on_completed, void *user_data);
source
LibAwsHTTP.aws_http2_connection_get_local_settingsMethod
aws_http2_connection_get_local_settings(http2_connection, out_settings)

Get the local settings we are using to affect the decoding.

Arguments

  • http2_connection: HTTP/2 connection.
  • out_settings: fixed size array of aws_http2_setting gets set to the local settings

Prototype

void aws_http2_connection_get_local_settings( const struct aws_http_connection *http2_connection, struct aws_http2_setting out_settings[AWS_HTTP2_SETTINGS_COUNT]);
source
LibAwsHTTP.aws_http2_connection_get_received_goawayMethod
aws_http2_connection_get_received_goaway(http2_connection, out_http2_error, out_last_stream_id)

Get data about the latest GOAWAY frame received from peer (HTTP/2 only). If no GOAWAY has been received, or the GOAWAY payload is still in transmitting, AWS_ERROR_HTTP_DATA_NOT_AVAILABLE will be raised.

Arguments

  • http2_connection: HTTP/2 connection.
  • out_http2_error: Gets set to HTTP/2 error code received in most recent GOAWAY.
  • out_last_stream_id: Gets set to Last-Stream-ID received in most recent GOAWAY.

Prototype

int aws_http2_connection_get_received_goaway( struct aws_http_connection *http2_connection, uint32_t *out_http2_error, uint32_t *out_last_stream_id);
source
LibAwsHTTP.aws_http2_connection_get_remote_settingsMethod
aws_http2_connection_get_remote_settings(http2_connection, out_settings)

Get the settings received from remote peer, which we are using to restricts the message to send.

Arguments

  • http2_connection: HTTP/2 connection.
  • out_settings: fixed size array of aws_http2_setting gets set to the remote settings

Prototype

void aws_http2_connection_get_remote_settings( const struct aws_http_connection *http2_connection, struct aws_http2_setting out_settings[AWS_HTTP2_SETTINGS_COUNT]);
source
LibAwsHTTP.aws_http2_connection_get_sent_goawayMethod
aws_http2_connection_get_sent_goaway(http2_connection, out_http2_error, out_last_stream_id)

Get data about the latest GOAWAY frame sent to peer (HTTP/2 only). If no GOAWAY has been sent, AWS_ERROR_HTTP_DATA_NOT_AVAILABLE will be raised. Note that GOAWAY frames are typically sent automatically by the connection during shutdown.

Arguments

  • http2_connection: HTTP/2 connection.
  • out_http2_error: Gets set to HTTP/2 error code sent in most recent GOAWAY.
  • out_last_stream_id: Gets set to Last-Stream-ID sent in most recent GOAWAY.

Prototype

int aws_http2_connection_get_sent_goaway( struct aws_http_connection *http2_connection, uint32_t *out_http2_error, uint32_t *out_last_stream_id);
source
LibAwsHTTP.aws_http2_connection_pingMethod
aws_http2_connection_ping(http2_connection, optional_opaque_data, on_completed, user_data)

Send a PING frame (HTTP/2 only). Round-trip-time is calculated when PING ACK is received from peer.

Arguments

  • http2_connection: HTTP/2 connection.
  • optional_opaque_data: Optional payload for PING frame. Must be NULL, or exactly 8 bytes (AWS_HTTP2_PING_DATA_SIZE). If NULL, the 8 byte payload will be all zeroes.
  • on_completed: Optional callback, invoked when PING ACK is received from peer, or when a connection error prevents the PING ACK from being received. Callback always fires on the connection's event-loop thread.
  • user_data: User-data pass to on_completed callback.

Prototype

int aws_http2_connection_ping( struct aws_http_connection *http2_connection, const struct aws_byte_cursor *optional_opaque_data, aws_http2_on_ping_complete_fn *on_completed, void *user_data);
source
LibAwsHTTP.aws_http2_connection_send_goawayMethod
aws_http2_connection_send_goaway(http2_connection, http2_error, allow_more_streams, optional_debug_data)

Send a custom GOAWAY frame (HTTP/2 only).

Note that the connection automatically attempts to send a GOAWAY during shutdown (unless a GOAWAY with a valid Last-Stream-ID has already been sent).

This call can be used to gracefully warn the peer of an impending shutdown (http2_error=0, allow_more_streams=true), or to customize the final GOAWAY frame that is sent by this connection.

The other end may not receive the goaway, if the connection already closed.

Arguments

  • http2_connection: HTTP/2 connection.
  • http2_error: The HTTP/2 error code (RFC-7540 section 7) to send. enum [awshttp2error_code](@ref) lists official codes.
  • allow_more_streams: If true, new peer-initiated streams will continue to be acknowledged and the GOAWAY's Last-Stream-ID will be set to a max value. If false, new peer-initiated streams will be ignored and the GOAWAY's Last-Stream-ID will be set to the latest acknowledged stream.
  • optional_debug_data: Optional debug data to send. Size must not exceed 16KB.

Prototype

void aws_http2_connection_send_goaway( struct aws_http_connection *http2_connection, uint32_t http2_error, bool allow_more_streams, const struct aws_byte_cursor *optional_debug_data);
source
LibAwsHTTP.aws_http2_connection_update_windowMethod
aws_http2_connection_update_window(http2_connection, increment_size)

Increment the connection's flow-control window to keep data flowing (HTTP/2 only).

If the connection was created with conn_manual_window_management set true, the flow-control window of the connection will shrink as body data is received for all the streams created on it. (headers, padding, and other metadata do not affect the window). The initial connection flow-control window is 65,535. Once the connection's flow-control window reaches to 0, all the streams on the connection stop receiving any further data.

If conn_manual_window_management is false, this call will have no effect. The connection maintains its flow-control windows such that no back-pressure is applied and data arrives as fast as possible.

If you are not connected, this call will have no effect.

Crashes when the connection is not http2 connection. The limit of the Maximum Size is 2**31 - 1. If the increment size cause the connection flow window exceeds the Maximum size, this call will result in the connection lost.

Arguments

  • http2_connection: HTTP/2 connection.
  • increment_size: The size to increment for the connection's flow control window

Prototype

void aws_http2_connection_update_window(struct aws_http_connection *http2_connection, uint32_t increment_size);
source
LibAwsHTTP.aws_http2_headers_get_request_authorityMethod
aws_http2_headers_get_request_authority(h2_headers, out_authority)

Documentation not found.

Prototype

int aws_http2_headers_get_request_authority( const struct aws_http_headers *h2_headers, struct aws_byte_cursor *out_authority);
source
LibAwsHTTP.aws_http2_headers_get_request_methodMethod
aws_http2_headers_get_request_method(h2_headers, out_method)

Get the :method value (HTTP/2 headers only).

Prototype

int aws_http2_headers_get_request_method(const struct aws_http_headers *h2_headers, struct aws_byte_cursor *out_method);
source
LibAwsHTTP.aws_http2_headers_get_request_pathMethod
aws_http2_headers_get_request_path(h2_headers, out_path)

Documentation not found.

Prototype

int aws_http2_headers_get_request_path(const struct aws_http_headers *h2_headers, struct aws_byte_cursor *out_path);
source
LibAwsHTTP.aws_http2_headers_get_request_schemeMethod
aws_http2_headers_get_request_scheme(h2_headers, out_scheme)

Documentation not found.

Prototype

int aws_http2_headers_get_request_scheme(const struct aws_http_headers *h2_headers, struct aws_byte_cursor *out_scheme);
source
LibAwsHTTP.aws_http2_headers_get_response_statusMethod
aws_http2_headers_get_response_status(h2_headers, out_status_code)

Get :status (response pseudo headers only). If no status is set, AWS_ERROR_HTTP_DATA_NOT_AVAILABLE is raised.

Prototype

int aws_http2_headers_get_response_status(const struct aws_http_headers *h2_headers, int *out_status_code);
source
LibAwsHTTP.aws_http2_headers_set_request_authorityMethod
aws_http2_headers_set_request_authority(h2_headers, authority)

Set :authority (request pseudo headers only). The pseudo headers makes its own copy of the underlying string.

Prototype

int aws_http2_headers_set_request_authority(struct aws_http_headers *h2_headers, struct aws_byte_cursor authority);
source
LibAwsHTTP.aws_http2_headers_set_request_methodMethod
aws_http2_headers_set_request_method(h2_headers, method)

Set :method (HTTP/2 headers only). The headers makes its own copy of the underlying string.

Prototype

int aws_http2_headers_set_request_method(struct aws_http_headers *h2_headers, struct aws_byte_cursor method);
source
LibAwsHTTP.aws_http2_headers_set_request_pathMethod
aws_http2_headers_set_request_path(h2_headers, path)

Set :path (request pseudo headers only). The pseudo headers makes its own copy of the underlying string.

Prototype

int aws_http2_headers_set_request_path(struct aws_http_headers *h2_headers, struct aws_byte_cursor path);
source
LibAwsHTTP.aws_http2_headers_set_request_schemeMethod
aws_http2_headers_set_request_scheme(h2_headers, scheme)

Set :scheme (request pseudo headers only). The pseudo headers makes its own copy of the underlying string.

Prototype

int aws_http2_headers_set_request_scheme(struct aws_http_headers *h2_headers, struct aws_byte_cursor scheme);
source
LibAwsHTTP.aws_http2_headers_set_response_statusMethod
aws_http2_headers_set_response_status(h2_headers, status_code)

Set :status (response pseudo headers only).

Prototype

int aws_http2_headers_set_response_status(struct aws_http_headers *h2_headers, int status_code);
source
LibAwsHTTP.aws_http2_message_new_from_http1Method
aws_http2_message_new_from_http1(alloc, http1_msg)

Create an HTTP/2 message from HTTP/1.1 message. pseudo headers will be created from the context and added to the headers of new message. Normal headers will be copied to the headers of new message. Note: - if host exist, it will be removed and :authority will be added using the information. - :scheme always defaults to "https". To use a different scheme create the HTTP/2 message directly

Prototype

struct aws_http_message *aws_http2_message_new_from_http1( struct aws_allocator *alloc, const struct aws_http_message *http1_msg);
source
LibAwsHTTP.aws_http2_message_new_requestMethod
aws_http2_message_new_request(allocator)

Create a new HTTP/2 request message. pseudo headers need to be set from aws_http2_headers_set_request_* to the headers of the aws_http_message. Will be errored out if used in HTTP/1.1 connection.

The caller has a hold on the object and must call aws_http_message_release() when they are done with it.

Prototype

struct aws_http_message *aws_http2_message_new_request(struct aws_allocator *allocator);
source
LibAwsHTTP.aws_http2_message_new_responseMethod
aws_http2_message_new_response(allocator)

Create a new HTTP/2 response message. pseudo headers need to be set from aws_http2_headers_set_response_status to the headers of the aws_http_message. Will be errored out if used in HTTP/1.1 connection.

The caller has a hold on the object and must call aws_http_message_release() when they are done with it.

Prototype

struct aws_http_message *aws_http2_message_new_response(struct aws_allocator *allocator);
source
LibAwsHTTP.aws_http2_stream_get_received_reset_error_codeMethod
aws_http2_stream_get_received_reset_error_code(http2_stream, out_http2_error)

Get the error code received in rst_stream. Only valid if the stream has completed, and an RST_STREAM frame has received.

Arguments

  • http2_stream: HTTP/2 stream.
  • out_http2_error: Gets to set to HTTP/2 error code received in rst_stream.

Prototype

int aws_http2_stream_get_received_reset_error_code(struct aws_http_stream *http2_stream, uint32_t *out_http2_error);
source
LibAwsHTTP.aws_http2_stream_get_sent_reset_error_codeMethod
aws_http2_stream_get_sent_reset_error_code(http2_stream, out_http2_error)

Get the HTTP/2 error code sent in the RST_STREAM frame (HTTP/2 only). Only valid if the stream has completed, and has sent an RST_STREAM frame.

Arguments

  • http2_stream: HTTP/2 stream.
  • out_http2_error: Gets to set to HTTP/2 error code sent in rst_stream.

Prototype

int aws_http2_stream_get_sent_reset_error_code(struct aws_http_stream *http2_stream, uint32_t *out_http2_error);
source
LibAwsHTTP.aws_http2_stream_manager_acquireMethod
aws_http2_stream_manager_acquire(manager)

Acquire a refcount from the stream manager, stream manager will start to destroy after the refcount drops to zero. NULL is acceptable. Initial refcount after new is 1.

Arguments

  • manager:

Returns

The same pointer acquiring.

Prototype

struct aws_http2_stream_manager *aws_http2_stream_manager_acquire(struct aws_http2_stream_manager *manager);
source
LibAwsHTTP.aws_http2_stream_manager_acquire_streamMethod
aws_http2_stream_manager_acquire_stream(http2_stream_manager, acquire_stream_option)

Acquire a stream from stream manager asynchronously.

Arguments

Prototype

void aws_http2_stream_manager_acquire_stream( struct aws_http2_stream_manager *http2_stream_manager, const struct aws_http2_stream_manager_acquire_stream_options *acquire_stream_option);
source
LibAwsHTTP.aws_http2_stream_manager_fetch_metricsMethod
aws_http2_stream_manager_fetch_metrics(http2_stream_manager, out_metrics)

Fetch the current metrics from stream manager.

Arguments

  • http2_stream_manager:
  • out_metrics: The metrics to be fetched

Prototype

void aws_http2_stream_manager_fetch_metrics( const struct aws_http2_stream_manager *http2_stream_manager, struct aws_http_manager_metrics *out_metrics);
source
LibAwsHTTP.aws_http2_stream_manager_newMethod
aws_http2_stream_manager_new(allocator, options)

Documentation not found.

Prototype

struct aws_http2_stream_manager *aws_http2_stream_manager_new( struct aws_allocator *allocator, const struct aws_http2_stream_manager_options *options);
source
LibAwsHTTP.aws_http2_stream_manager_releaseMethod
aws_http2_stream_manager_release(manager)

Release a refcount from the stream manager, stream manager will start to destroy after the refcount drops to zero. NULL is acceptable. Initial refcount after new is 1.

Arguments

  • manager:

Returns

NULL

Prototype

struct aws_http2_stream_manager *aws_http2_stream_manager_release(struct aws_http2_stream_manager *manager);
source
LibAwsHTTP.aws_http2_stream_resetMethod
aws_http2_stream_reset(http2_stream, http2_error)

Reset the HTTP/2 stream (HTTP/2 only). Note that if the stream closes before this async call is fully processed, the RST_STREAM frame will not be sent.

Arguments

Prototype

int aws_http2_stream_reset(struct aws_http_stream *http2_stream, uint32_t http2_error);
source
LibAwsHTTP.aws_http2_stream_write_dataMethod
aws_http2_stream_write_data(http2_stream, options)

The stream must have specified http2_use_manual_data_writes during request creation. For client streams, activate() must be called before any frames are submitted. For server streams, the response headers must be submitted before any frames. A write with options that has end_stream set to be true will end the stream and prevent any further write.

Typical usage will be something like: options.http2_use_manual_data_writes = true; stream = aws_http_connection_make_request(connection, &options); aws_http_stream_activate(stream); ... struct aws_http2_stream_write_data_options write; aws_http2_stream_write_data(stream, &write); ... struct aws_http2_stream_write_data_options last_write; last_write.end_stream = true; aws_http2_stream_write_data(stream, &write); ... aws_http_stream_release(stream);

Returns

AWS_OP_SUCCESS if the write was queued AWS_OP_ERROR indicating the attempt raised an error code. AWS_ERROR_INVALID_STATE will be raised for invalid usage. AWS_ERROR_HTTP_STREAM_HAS_COMPLETED will be raised if the stream ended for reasons behind the scenes.

Prototype

int aws_http2_stream_write_data( struct aws_http_stream *http2_stream, const struct aws_http2_stream_write_data_options *options);
source
LibAwsHTTP.aws_http_alpn_map_initMethod
aws_http_alpn_map_init(allocator, map)

Initialize an empty hash-table that maps struct aws\_string * to enum [awshttpversion](@ref). This map can used in aws_http_client_connections_options.alpn_string_map.

Prototype

int aws_http_alpn_map_init(struct aws_allocator *allocator, struct aws_hash_table *map);
source
LibAwsHTTP.aws_http_alpn_map_init_copyMethod
aws_http_alpn_map_init_copy(allocator, dest, src)

Initialize an map copied from the *src map, which maps struct aws\_string * to enum [awshttpversion](@ref).

Prototype

int aws_http_alpn_map_init_copy( struct aws_allocator *allocator, struct aws_hash_table *dest, struct aws_hash_table *src);
source
LibAwsHTTP.aws_http_client_connectMethod
aws_http_client_connect(options)

Asynchronously establish a client connection. The on_setup callback is invoked when the operation has created a connection or failed.

Prototype

int aws_http_client_connect(const struct aws_http_client_connection_options *options);
source
LibAwsHTTP.aws_http_connection_closeMethod
aws_http_connection_close(connection)

Begin shutdown sequence of the connection if it hasn't already started. This will schedule shutdown tasks on the EventLoop that may send HTTP/TLS/TCP shutdown messages to peers if necessary, and will eventually cause internal connection memory to stop being accessed and on_shutdown() callback to be called.

It's safe to call this function regardless of the connection state as long as you hold a reference to the connection.

Prototype

void aws_http_connection_close(struct aws_http_connection *connection);
source
LibAwsHTTP.aws_http_connection_configure_serverMethod
aws_http_connection_configure_server(connection, options)

Configure a server connection. This must be called from the server's on_incoming_connection callback.

Prototype

int aws_http_connection_configure_server( struct aws_http_connection *connection, const struct aws_http_server_connection_options *options);
source
LibAwsHTTP.aws_http_connection_get_channelMethod
aws_http_connection_get_channel(connection)

Returns the channel hosting the HTTP connection. Do not expose this function to language bindings.

Prototype

struct aws_channel *aws_http_connection_get_channel(struct aws_http_connection *connection);
source
LibAwsHTTP.aws_http_connection_get_remote_endpointMethod
aws_http_connection_get_remote_endpoint(connection)

Returns the remote endpoint of the HTTP connection.

Prototype

const struct aws_socket_endpoint *aws_http_connection_get_remote_endpoint(const struct aws_http_connection *connection);
source
LibAwsHTTP.aws_http_connection_is_clientMethod
aws_http_connection_is_client(connection)

Returns true if this is a client connection.

Prototype

bool aws_http_connection_is_client(const struct aws_http_connection *connection);
source
LibAwsHTTP.aws_http_connection_is_openMethod
aws_http_connection_is_open(connection)

Returns true unless the connection is closed or closing.

Prototype

bool aws_http_connection_is_open(const struct aws_http_connection *connection);
source
LibAwsHTTP.aws_http_connection_is_serverMethod
aws_http_connection_is_server(connection)

Returns true if this is a server connection.

Prototype

bool aws_http_connection_is_server(const struct aws_http_connection *connection);
source
LibAwsHTTP.aws_http_connection_make_requestMethod
aws_http_connection_make_request(client_connection, options)

Create a stream, with a client connection sending a request. The request does not start sending automatically once the stream is created. You must call aws_http_stream_activate to begin execution of the request.

The options are copied during this call.

Tip for language bindings: Do not bind the options struct. Use something more natural for your language, such as Builder Pattern in Java, or Python's ability to take many optional arguments by name.

Note: The header of the request will be sent as it is when the message to send protocol matches the protocol of the connection. - No user-agent will be added. - No security check will be enforced. eg: referer header privacy should be enforced by the user-agent who adds the header - When HTTP/1 message sent on HTTP/2 connection, aws_http2_message_new_from_http1 will be applied under the hood. - When HTTP/2 message sent on HTTP/1 connection, no change will be made.

Prototype

struct aws_http_stream *aws_http_connection_make_request( struct aws_http_connection *client_connection, const struct aws_http_make_request_options *options);
source
LibAwsHTTP.aws_http_connection_manager_acquire_connectionMethod
aws_http_connection_manager_acquire_connection(manager, callback, user_data)

Documentation not found.

Prototype

void aws_http_connection_manager_acquire_connection( struct aws_http_connection_manager *manager, aws_http_connection_manager_on_connection_setup_fn *callback, void *user_data);
source
LibAwsHTTP.aws_http_connection_manager_fetch_metricsMethod
aws_http_connection_manager_fetch_metrics(manager, out_metrics)

Fetch the current manager metrics from connection manager.

Prototype

void aws_http_connection_manager_fetch_metrics( const struct aws_http_connection_manager *manager, struct aws_http_manager_metrics *out_metrics);
source
LibAwsHTTP.aws_http_connection_manager_newMethod
aws_http_connection_manager_new(allocator, options)

Documentation not found.

Prototype

struct aws_http_connection_manager *aws_http_connection_manager_new( struct aws_allocator *allocator, const struct aws_http_connection_manager_options *options);
source
LibAwsHTTP.aws_http_connection_new_requests_allowedMethod
aws_http_connection_new_requests_allowed(connection)

Return whether the connection can make a new requests. If false, then a new connection must be established to make further requests.

Prototype

bool aws_http_connection_new_requests_allowed(const struct aws_http_connection *connection);
source
LibAwsHTTP.aws_http_connection_releaseMethod
aws_http_connection_release(connection)

Users must release the connection when they are done with it. The connection's memory cannot be reclaimed until this is done. If the connection was not already shutting down, it will be shut down.

Users should always wait for the on_shutdown() callback to be called before releasing any data passed to the http_connection (Eg aws_tls_connection_options, aws_socket_options) otherwise there will be race conditions between http_connection shutdown tasks and memory release tasks, causing Segfaults.

Prototype

void aws_http_connection_release(struct aws_http_connection *connection);
source
LibAwsHTTP.aws_http_connection_stop_new_requestsMethod
aws_http_connection_stop_new_requests(connection)

Stop accepting new requests for the connection. It will NOT start the shutdown process for the connection. The requests that are already open can still wait to be completed, but new requests will fail to be created,

Prototype

void aws_http_connection_stop_new_requests(struct aws_http_connection *connection);
source
LibAwsHTTP.aws_http_header_name_eqMethod
aws_http_header_name_eq(name_a, name_b)

Return whether both names are equivalent. This is a case-insensitive string comparison.

Example Matches: "Content-Length" == "content-length" // upper or lower case ok

Example Mismatches: "Content-Length" != " Content-Length" // leading whitespace bad

Prototype

bool aws_http_header_name_eq(struct aws_byte_cursor name_a, struct aws_byte_cursor name_b);
source
LibAwsHTTP.aws_http_headers_addMethod
aws_http_headers_add(headers, name, value)

Add a header. The underlying strings are copied.

Prototype

int aws_http_headers_add(struct aws_http_headers *headers, struct aws_byte_cursor name, struct aws_byte_cursor value);
source
LibAwsHTTP.aws_http_headers_add_arrayMethod
aws_http_headers_add_array(headers, array, count)

Add an array of headers. The underlying strings are copied.

Prototype

int aws_http_headers_add_array(struct aws_http_headers *headers, const struct aws_http_header *array, size_t count);
source
LibAwsHTTP.aws_http_headers_add_headerMethod
aws_http_headers_add_header(headers, header)

Add a header. The underlying strings are copied.

Prototype

int aws_http_headers_add_header(struct aws_http_headers *headers, const struct aws_http_header *header);
source
LibAwsHTTP.aws_http_headers_eraseMethod
aws_http_headers_erase(headers, name)

Remove all headers with this name. AWS_ERROR_HTTP_HEADER_NOT_FOUND is raised if no headers with this name are found.

Prototype

int aws_http_headers_erase(struct aws_http_headers *headers, struct aws_byte_cursor name);
source
LibAwsHTTP.aws_http_headers_erase_indexMethod
aws_http_headers_erase_index(headers, index)

Remove the header at the specified index.

AWS_ERROR_INVALID_INDEX is raised if the index is invalid.

Prototype

int aws_http_headers_erase_index(struct aws_http_headers *headers, size_t index);
source
LibAwsHTTP.aws_http_headers_erase_valueMethod
aws_http_headers_erase_value(headers, name, value)

Remove the first header found with this name and value. AWS_ERROR_HTTP_HEADER_NOT_FOUND is raised if no such header is found.

Prototype

int aws_http_headers_erase_value( struct aws_http_headers *headers, struct aws_byte_cursor name, struct aws_byte_cursor value);
source
LibAwsHTTP.aws_http_headers_getMethod
aws_http_headers_get(headers, name, out_value)

Get the first value for this name, ignoring any additional values. AWS_ERROR_HTTP_HEADER_NOT_FOUND is raised if the name is not found.

Prototype

int aws_http_headers_get( const struct aws_http_headers *headers, struct aws_byte_cursor name, struct aws_byte_cursor *out_value);
source
LibAwsHTTP.aws_http_headers_get_allMethod
aws_http_headers_get_all(headers, name)

Get all values with this name, combined into one new aws_string that you are responsible for destroying. If there are multiple headers with this name, their values are appended with comma-separators. If there are no headers with this name, NULL is returned and AWS_ERROR_HTTP_HEADER_NOT_FOUND is raised.

Prototype

struct aws_string *aws_http_headers_get_all(const struct aws_http_headers *headers, struct aws_byte_cursor name);
source
LibAwsHTTP.aws_http_headers_get_indexMethod
aws_http_headers_get_index(headers, index, out_header)

Get the header at the specified index. The index of a given header may change any time headers are modified. When iterating headers, the following ordering rules apply:

  • Headers with the same name will always be in the same order, relative to one another. If "A: one" is added before "A: two", then "A: one" will always precede "A: two".

  • Headers with different names could be in any order, relative to one another. If "A: one" is seen before "B: bee" in one iteration, you might see "B: bee" before "A: one" on the next.

AWS_ERROR_INVALID_INDEX is raised if the index is invalid.

Prototype

int aws_http_headers_get_index( const struct aws_http_headers *headers, size_t index, struct aws_http_header *out_header);
source
LibAwsHTTP.aws_http_headers_hasMethod
aws_http_headers_has(headers, name)

Test if header name exists or not in headers

Prototype

bool aws_http_headers_has(const struct aws_http_headers *headers, struct aws_byte_cursor name);
source
LibAwsHTTP.aws_http_headers_releaseMethod
aws_http_headers_release(headers)

Release a hold on the object. The object is deleted when all holds on it are released.

Prototype

void aws_http_headers_release(struct aws_http_headers *headers);
source
LibAwsHTTP.aws_http_headers_setMethod
aws_http_headers_set(headers, name, value)

Set a header value. The header is added if necessary and any existing values for this name are removed. The underlying strings are copied.

Prototype

int aws_http_headers_set(struct aws_http_headers *headers, struct aws_byte_cursor name, struct aws_byte_cursor value);
source
LibAwsHTTP.aws_http_library_clean_upMethod
aws_http_library_clean_up()

Clean up internal datastructures used by aws-c-http. Must not be called until application is done using functionality in aws-c-http.

Prototype

void aws_http_library_clean_up(void);
source
LibAwsHTTP.aws_http_library_initMethod
aws_http_library_init(alloc)

Initializes internal datastructures used by aws-c-http. Must be called before using any functionality in aws-c-http.

Prototype

void aws_http_library_init(struct aws_allocator *alloc);
source
LibAwsHTTP.aws_http_message_acquireMethod
aws_http_message_acquire(message)

Acquire a hold on the object, preventing it from being deleted until aws_http_message_release() is called by all those with a hold on it.

This function returns the passed in message (possibly NULL) so that acquire-and-assign can be done with a single statement.

Prototype

struct aws_http_message *aws_http_message_acquire(struct aws_http_message *message);
source
LibAwsHTTP.aws_http_message_add_headerMethod
aws_http_message_add_header(message, header)

Add a header to the end of the array. The message makes its own copy of the underlying strings.

Prototype

int aws_http_message_add_header(struct aws_http_message *message, struct aws_http_header header);
source
LibAwsHTTP.aws_http_message_add_header_arrayMethod
aws_http_message_add_header_array(message, headers, num_headers)

Add an array of headers to the end of the header array. The message makes its own copy of the underlying strings.

This is a helper function useful when it's easier to define headers as a stack array, rather than calling add_header repeatedly.

Prototype

int aws_http_message_add_header_array( struct aws_http_message *message, const struct aws_http_header *headers, size_t num_headers);
source
LibAwsHTTP.aws_http_message_erase_headerMethod
aws_http_message_erase_header(message, index)

Remove the header at the specified index. Headers after this index are all shifted back one position.

This function cannot fail if a valid index is provided. Otherwise, AWS_ERROR_INVALID_INDEX will be raised.

Prototype

int aws_http_message_erase_header(struct aws_http_message *message, size_t index);
source
LibAwsHTTP.aws_http_message_get_body_streamMethod
aws_http_message_get_body_stream(message)

Get the body stream. Returns NULL if no body stream is set.

Prototype

struct aws_input_stream *aws_http_message_get_body_stream(const struct aws_http_message *message);
source
LibAwsHTTP.aws_http_message_get_headerMethod
aws_http_message_get_header(message, out_header, index)

Get the header at the specified index. This function cannot fail if a valid index is provided. Otherwise, AWS_ERROR_INVALID_INDEX will be raised.

The underlying strings are stored within the message.

Prototype

int aws_http_message_get_header( const struct aws_http_message *message, struct aws_http_header *out_header, size_t index);
source
LibAwsHTTP.aws_http_message_get_headersMethod
aws_http_message_get_headers(message)

This datastructure has more functions for inspecting and modifying headers than are available on the aws_http_message datastructure.

Prototype

struct aws_http_headers *aws_http_message_get_headers(const struct aws_http_message *message);
source
LibAwsHTTP.aws_http_message_get_request_methodMethod
aws_http_message_get_request_method(request_message, out_method)

Get the method (request messages only).

Prototype

int aws_http_message_get_request_method( const struct aws_http_message *request_message, struct aws_byte_cursor *out_method);
source
LibAwsHTTP.aws_http_message_get_request_pathMethod
aws_http_message_get_request_path(request_message, out_path)

Documentation not found.

Prototype

int aws_http_message_get_request_path(const struct aws_http_message *request_message, struct aws_byte_cursor *out_path);
source
LibAwsHTTP.aws_http_message_get_response_statusMethod
aws_http_message_get_response_status(response_message, out_status_code)

Get the status code (response messages only). If no status is set, AWS_ERROR_HTTP_DATA_NOT_AVAILABLE is raised.

Prototype

int aws_http_message_get_response_status(const struct aws_http_message *response_message, int *out_status_code);
source
LibAwsHTTP.aws_http_message_new_requestMethod
aws_http_message_new_request(allocator)

Create a new HTTP/1.1 request message. The message is blank, all properties (method, path, etc) must be set individually. If HTTP/1.1 message used in HTTP/2 connection, the transformation will be automatically applied. A HTTP/2 message will created and sent based on the HTTP/1.1 message.

The caller has a hold on the object and must call aws_http_message_release() when they are done with it.

Prototype

struct aws_http_message *aws_http_message_new_request(struct aws_allocator *allocator);
source
LibAwsHTTP.aws_http_message_new_responseMethod
aws_http_message_new_response(allocator)

Create a new HTTP/1.1 response message. The message is blank, all properties (status, headers, etc) must be set individually.

The caller has a hold on the object and must call aws_http_message_release() when they are done with it.

Prototype

struct aws_http_message *aws_http_message_new_response(struct aws_allocator *allocator);
source
LibAwsHTTP.aws_http_message_new_websocket_handshake_requestMethod
aws_http_message_new_websocket_handshake_request(allocator, path, host)

Create request with all required fields for a websocket upgrade request. The method and path are set, and the the following headers are added:

Host: <host> Upgrade: websocket Connection: Upgrade Sec-WebSocket-Key: <base64 encoding of 16 random bytes> Sec-WebSocket-Version: 13

Prototype

struct aws_http_message *aws_http_message_new_websocket_handshake_request( struct aws_allocator *allocator, struct aws_byte_cursor path, struct aws_byte_cursor host);
source
LibAwsHTTP.aws_http_message_releaseMethod
aws_http_message_release(message)

Release a hold on the object. The object is deleted when all holds on it are released.

This function always returns NULL so that release-and-assign-NULL can be done with a single statement.

Prototype

struct aws_http_message *aws_http_message_release(struct aws_http_message *message);
source
LibAwsHTTP.aws_http_message_set_body_streamMethod
aws_http_message_set_body_stream(message, body_stream)

Set the body stream. NULL is an acceptable value for messages with no body. Note: The message does NOT take ownership of the body stream. The stream must not be destroyed until the message is complete.

Prototype

void aws_http_message_set_body_stream(struct aws_http_message *message, struct aws_input_stream *body_stream);
source
LibAwsHTTP.aws_http_message_set_request_methodMethod
aws_http_message_set_request_method(request_message, method)

Set the method (request messages only). The request makes its own copy of the underlying string.

Prototype

int aws_http_message_set_request_method(struct aws_http_message *request_message, struct aws_byte_cursor method);
source
LibAwsHTTP.aws_http_message_set_request_pathMethod
aws_http_message_set_request_path(request_message, path)

Set the path-and-query value (request messages only). The request makes its own copy of the underlying string.

Prototype

int aws_http_message_set_request_path(struct aws_http_message *request_message, struct aws_byte_cursor path);
source
LibAwsHTTP.aws_http_message_set_response_statusMethod
aws_http_message_set_response_status(response_message, status_code)

Set the status code (response messages only).

Prototype

int aws_http_message_set_response_status(struct aws_http_message *response_message, int status_code);
source
LibAwsHTTP.aws_http_proxy_config_destroyMethod
aws_http_proxy_config_destroy(config)

Destroys an http proxy configuration

Arguments

  • config: http proxy configuration to destroy

Prototype

void aws_http_proxy_config_destroy(struct aws_http_proxy_config *config);
source
LibAwsHTTP.aws_http_proxy_config_new_cloneMethod
aws_http_proxy_config_new_clone(allocator, proxy_config)

Clones an existing proxy configuration. A refactor could remove this (do a "move" between the old and new user data in the one spot it's used) but that should wait until we have better test cases for the logic where this gets invoked (ntlm/kerberos chains).

Arguments

  • allocator: memory allocator to use
  • proxy_config: http proxy configuration to clone

Returns

Prototype

struct aws_http_proxy_config *aws_http_proxy_config_new_clone( struct aws_allocator *allocator, const struct aws_http_proxy_config *proxy_config);
source
LibAwsHTTP.aws_http_proxy_config_new_from_connection_optionsMethod
aws_http_proxy_config_new_from_connection_options(allocator, options)

Create a persistent proxy configuration from http connection options

Arguments

  • allocator: memory allocator to use
  • options: http connection options to source proxy configuration from

Returns

Prototype

struct aws_http_proxy_config *aws_http_proxy_config_new_from_connection_options( struct aws_allocator *allocator, const struct aws_http_client_connection_options *options);
source
LibAwsHTTP.aws_http_proxy_config_new_from_manager_optionsMethod
aws_http_proxy_config_new_from_manager_options(allocator, options)

Create a persistent proxy configuration from http connection manager options

Arguments

  • allocator: memory allocator to use
  • options: http connection manager options to source proxy configuration from

Returns

Prototype

struct aws_http_proxy_config *aws_http_proxy_config_new_from_manager_options( struct aws_allocator *allocator, const struct aws_http_connection_manager_options *options);
source
LibAwsHTTP.aws_http_proxy_config_new_from_proxy_optionsMethod
aws_http_proxy_config_new_from_proxy_options(allocator, options)

Create a persistent proxy configuration from non-persistent proxy options. Legacy connection type of proxy options will be rejected.

Arguments

  • allocator: memory allocator to use
  • options: http proxy options to source proxy configuration from

Returns

Prototype

struct aws_http_proxy_config *aws_http_proxy_config_new_from_proxy_options( struct aws_allocator *allocator, const struct aws_http_proxy_options *options);
source
LibAwsHTTP.aws_http_proxy_config_new_from_proxy_options_with_tls_infoMethod
aws_http_proxy_config_new_from_proxy_options_with_tls_info(allocator, proxy_options, is_tls_connection)

Create a persistent proxy configuration from non-persistent proxy options.

Arguments

  • allocator: memory allocator to use
  • options: http proxy options to source proxy configuration from
  • is_tls_connection: tls connection info of the main connection to determine connection_type when the connection_type is legacy.

Returns

Prototype

struct aws_http_proxy_config *aws_http_proxy_config_new_from_proxy_options_with_tls_info( struct aws_allocator *allocator, const struct aws_http_proxy_options *proxy_options, bool is_tls_connection);
source
LibAwsHTTP.aws_http_proxy_config_new_tunneling_from_proxy_optionsMethod
aws_http_proxy_config_new_tunneling_from_proxy_options(allocator, options)

Create a persistent proxy configuration from non-persistent proxy options. The resulting proxy configuration assumes a tunneling connection type.

Arguments

  • allocator: memory allocator to use
  • options: http proxy options to source proxy configuration from

Returns

Prototype

struct aws_http_proxy_config *aws_http_proxy_config_new_tunneling_from_proxy_options( struct aws_allocator *allocator, const struct aws_http_proxy_options *options);
source
LibAwsHTTP.aws_http_proxy_negotiator_acquireMethod
aws_http_proxy_negotiator_acquire(proxy_negotiator)

Take a reference to an http proxy negotiator

Arguments

  • proxy_negotiator: negotiator to take a reference to

Returns

the strategy

Prototype

struct aws_http_proxy_negotiator *aws_http_proxy_negotiator_acquire(struct aws_http_proxy_negotiator *proxy_negotiator);
source
LibAwsHTTP.aws_http_proxy_negotiator_releaseMethod
aws_http_proxy_negotiator_release(proxy_negotiator)

Release a reference to an http proxy negotiator

Arguments

  • proxy_negotiator: negotiator to release a reference to

Prototype

void aws_http_proxy_negotiator_release(struct aws_http_proxy_negotiator *proxy_negotiator);
source
LibAwsHTTP.aws_http_proxy_new_socket_channelMethod
aws_http_proxy_new_socket_channel(channel_options, proxy_options)

Establish an arbitrary protocol connection through an http proxy via tunneling CONNECT. Alpn is not required for this connection process to succeed, but we encourage its use if available.

Arguments

  • channel_options: configuration options for the socket level connection
  • proxy_options: configuration options for the proxy connection

Returns

AWS_OP_SUCCESS if the asynchronous channel kickoff succeeded, AWS_OP_ERR otherwise

Prototype

int aws_http_proxy_new_socket_channel( struct aws_socket_channel_bootstrap_options *channel_options, const struct aws_http_proxy_options *proxy_options);
source
LibAwsHTTP.aws_http_proxy_options_init_from_configMethod
aws_http_proxy_options_init_from_config(options, config)

Initializes non-persistent http proxy options from a persistent http proxy configuration

Arguments

  • options: http proxy options to initialize
  • config: the http proxy config to use as an initialization source

Prototype

void aws_http_proxy_options_init_from_config( struct aws_http_proxy_options *options, const struct aws_http_proxy_config *config);
source
LibAwsHTTP.aws_http_proxy_strategy_acquireMethod
aws_http_proxy_strategy_acquire(proxy_strategy)

Take a reference to an http proxy strategy

Arguments

  • proxy_strategy: strategy to take a reference to

Returns

the strategy

Prototype

struct aws_http_proxy_strategy *aws_http_proxy_strategy_acquire(struct aws_http_proxy_strategy *proxy_strategy);
source
LibAwsHTTP.aws_http_proxy_strategy_create_negotiatorMethod
aws_http_proxy_strategy_create_negotiator(strategy, allocator)

Creates a new proxy negotiator from a proxy strategy

Arguments

  • allocator: memory allocator to use
  • strategy: strategy to creation a new negotiator for

Returns

a new proxy negotiator if successful, otherwise NULL

Prototype

struct aws_http_proxy_negotiator *aws_http_proxy_strategy_create_negotiator( struct aws_http_proxy_strategy *strategy, struct aws_allocator *allocator);
source
LibAwsHTTP.aws_http_proxy_strategy_new_basic_authMethod
aws_http_proxy_strategy_new_basic_auth(allocator, config)

A constructor for a proxy strategy that performs basic authentication by adding the appropriate header and header value to requests or CONNECT requests.

Arguments

  • allocator: memory allocator to use
  • config: basic authentication configuration info

Returns

a new proxy strategy if successfully constructed, otherwise NULL

Prototype

struct aws_http_proxy_strategy *aws_http_proxy_strategy_new_basic_auth( struct aws_allocator *allocator, struct aws_http_proxy_strategy_basic_auth_options *config);
source
LibAwsHTTP.aws_http_proxy_strategy_new_tunneling_adaptiveMethod
aws_http_proxy_strategy_new_tunneling_adaptive(allocator, config)

Constructor for an adaptive tunneling proxy strategy. This strategy attempts a vanilla CONNECT and if that fails it may make followup CONNECT attempts using kerberos or ntlm tokens, based on configuration and proxy response properties.

Arguments

  • allocator: memory allocator to use
  • config: configuration options for the strategy

Returns

a new proxy strategy if successfully constructed, otherwise NULL

Prototype

struct aws_http_proxy_strategy *aws_http_proxy_strategy_new_tunneling_adaptive( struct aws_allocator *allocator, struct aws_http_proxy_strategy_tunneling_adaptive_options *config);
source
LibAwsHTTP.aws_http_proxy_strategy_releaseMethod
aws_http_proxy_strategy_release(proxy_strategy)

Release a reference to an http proxy strategy

Arguments

  • proxy_strategy: strategy to release a reference to

Prototype

void aws_http_proxy_strategy_release(struct aws_http_proxy_strategy *proxy_strategy);
source
LibAwsHTTP.aws_http_server_get_listener_endpointMethod
aws_http_server_get_listener_endpoint(server)

Returns the local listener endpoint of the HTTP server. Only valid as long as the server remains valid.

Prototype

const struct aws_socket_endpoint *aws_http_server_get_listener_endpoint(const struct aws_http_server *server);
source
LibAwsHTTP.aws_http_server_newMethod
aws_http_server_new(options)

Create server, a listening socket that accepts incoming connections.

Prototype

struct aws_http_server *aws_http_server_new(const struct aws_http_server_options *options);
source
LibAwsHTTP.aws_http_server_releaseMethod
aws_http_server_release(server)

Release the server. It will close the listening socket and all the connections existing in the server. The on_destroy_complete will be invoked when the destroy operation completes

Prototype

void aws_http_server_release(struct aws_http_server *server);
source
LibAwsHTTP.aws_http_status_textMethod
aws_http_status_text(status_code)

Returns the description of common status codes. Ex: 404 -> "Not Found" An empty string is returned if the status code is not recognized.

Prototype

const char *aws_http_status_text(int status_code);
source
LibAwsHTTP.aws_http_stream_acquireMethod
aws_http_stream_acquire(stream)

Acquire refcount on the stream to prevent it from being cleaned up until it is released.

Prototype

struct aws_http_stream *aws_http_stream_acquire(struct aws_http_stream *stream);
source
LibAwsHTTP.aws_http_stream_cancelMethod
aws_http_stream_cancel(stream, error_code)

Cancel the stream in flight. For HTTP/1.1 streams, it's equivalent to closing the connection. For HTTP/2 streams, it's equivalent to calling reset on the stream with AWS_HTTP2_ERR_CANCEL.

the stream will complete with the error code provided, unless the stream is already completing for other reasons, or the stream is not activated, in which case this call will have no impact.

Prototype

void aws_http_stream_cancel(struct aws_http_stream *stream, int error_code);
source
LibAwsHTTP.aws_http_stream_get_idMethod
aws_http_stream_get_id(stream)

Gets the HTTP/2 id associated with a stream. Even h1 streams have an id (using the same allocation procedure as http/2) for easier tracking purposes. For client streams, this will only be non-zero after a successful call to aws_http_stream_activate()

Prototype

uint32_t aws_http_stream_get_id(const struct aws_http_stream *stream);
source
LibAwsHTTP.aws_http_stream_releaseMethod
aws_http_stream_release(stream)

Users must release the stream when they are done with it, or its memory will never be cleaned up. This will not cancel the stream, its callbacks will still fire if the stream is still in progress.

Tips for language bindings: - Invoke this from the wrapper class's finalizer/destructor. - Do not let the wrapper class be destroyed until on_complete() has fired.

Prototype

void aws_http_stream_release(struct aws_http_stream *stream);
source
LibAwsHTTP.aws_http_stream_send_responseMethod
aws_http_stream_send_response(stream, response)

Send response (only callable from "request handler" streams) The response object must stay alive at least until the stream's on_complete is called.

Prototype

int aws_http_stream_send_response(struct aws_http_stream *stream, struct aws_http_message *response);
source
LibAwsHTTP.aws_http_stream_update_windowMethod
aws_http_stream_update_window(stream, increment_size)

Increment the stream's flow-control window to keep data flowing.

If the connection was created with manual_window_management set true, the flow-control window of each stream will shrink as body data is received (headers, padding, and other metadata do not affect the window). The connection's initial_window_size determines the starting size of each stream's window. If a stream's flow-control window reaches 0, no further data will be received.

If manual_window_management is false, this call will have no effect. The connection maintains its flow-control windows such that no back-pressure is applied and data arrives as fast as possible.

Prototype

void aws_http_stream_update_window(struct aws_http_stream *stream, size_t increment_size);
source
LibAwsHTTP.aws_websocket_acquireMethod
aws_websocket_acquire(websocket)

Increment the websocket's ref-count, preventing it from being destroyed.

Returns

Always returns the same pointer that is passed in.

Prototype

struct aws_websocket *aws_websocket_acquire(struct aws_websocket *websocket);
source
LibAwsHTTP.aws_websocket_client_connectMethod
aws_websocket_client_connect(options)

Asynchronously establish a client websocket connection. The on_connection_setup callback is invoked when the operation has finished creating a connection, or failed.

Prototype

int aws_websocket_client_connect(const struct aws_websocket_client_connection_options *options);
source
LibAwsHTTP.aws_websocket_closeMethod
aws_websocket_close(websocket, free_scarce_resources_immediately)

Close the websocket connection. It is safe to call this, even if the connection is already closed or closing. The websocket will attempt to send a CLOSE frame during normal shutdown. If free_scarce_resources_immediately is true, the connection will be torn down as quickly as possible. This function may be called from any thread.

Prototype

void aws_websocket_close(struct aws_websocket *websocket, bool free_scarce_resources_immediately);
source
LibAwsHTTP.aws_websocket_convert_to_midchannel_handlerMethod
aws_websocket_convert_to_midchannel_handler(websocket)

Convert the websocket into a mid-channel handler. The websocket will stop being usable via its public API and become just another handler in the channel. The caller will likely install a channel handler to the right. This must not be called in the middle of an incoming frame (between "frame begin" and "frame complete" callbacks). This MUST be called from the websocket's thread.

If successful: - Other than aws_websocket_release(), all calls to aws_websocket_x() functions are ignored. - The websocket will no longer invoke any "incoming frame" callbacks. - aws_io_messages written by a downstream handler will be wrapped in binary data frames and sent upstream. The data may be split/combined as it is sent along. - aws_io_messages read from upstream handlers will be scanned for binary data frames. The payloads of these frames will be sent downstream. The payloads may be split/combined as they are sent along. - An incoming close frame will automatically result in channel-shutdown. - aws_websocket_release() must still be called or the websocket and its channel will never be cleaned up. - The websocket will still invoke its "on connection shutdown" callback when channel shutdown completes.

If unsuccessful, NULL is returned and the websocket is unchanged.

Prototype

int aws_websocket_convert_to_midchannel_handler(struct aws_websocket *websocket);
source
LibAwsHTTP.aws_websocket_get_channelMethod
aws_websocket_get_channel(websocket)

Returns the websocket's underlying I/O channel.

Prototype

struct aws_channel *aws_websocket_get_channel(const struct aws_websocket *websocket);
source
LibAwsHTTP.aws_websocket_increment_read_windowMethod
aws_websocket_increment_read_window(websocket, size)

Manually increment the read window to keep frames flowing.

If the websocket was created with manual_window_management set true, then whenever the read window reaches 0 you will stop receiving data. The websocket's initial_window_size determines the starting size of the read window. The read window shrinks as you receive the payload from "data" frames (TEXT, BINARY, and CONTINUATION). Use aws_websocket_increment_read_window() to increment the window again and keep frames flowing. Maintain a larger window to keep up high throughput. You only need to worry about the payload from "data" frames. The websocket automatically increments the window to account for any other incoming bytes, including other parts of a frame (opcode, payload-length, etc) and the payload of other frame types (PING, PONG, CLOSE).

If the websocket was created with manual_window_management set false, this function does nothing.

This function may be called from any thread.

Prototype

void aws_websocket_increment_read_window(struct aws_websocket *websocket, size_t size);
source
LibAwsHTTP.aws_websocket_is_data_frameMethod
aws_websocket_is_data_frame(opcode)

Return true if opcode is for a data frame, false if opcode if for a control frame.

Prototype

bool aws_websocket_is_data_frame(uint8_t opcode);
source
LibAwsHTTP.aws_websocket_releaseMethod
aws_websocket_release(websocket)

Decrement the websocket's ref-count. When the ref-count reaches zero, the connection will shut down, if it hasn't already. Users must release the websocket when they are done with it. The websocket's memory cannot be reclaimed until this is done. Callbacks may continue firing after this is called, with "shutdown" being the final callback. This function may be called from any thread.

It is safe to pass NULL, nothing will happen.

Prototype

void aws_websocket_release(struct aws_websocket *websocket);
source
LibAwsHTTP.aws_websocket_send_frameMethod
aws_websocket_send_frame(websocket, options)

Send a websocket frame. The options struct is copied. A callback will be invoked when the operation completes. This function may be called from any thread.

Prototype

int aws_websocket_send_frame(struct aws_websocket *websocket, const struct aws_websocket_send_frame_options *options);
source