Function libnghttp2_sys::nghttp2_submit_altsvc
source · pub unsafe extern "C" fn nghttp2_submit_altsvc(
session: *mut nghttp2_session,
flags: u8,
stream_id: i32,
origin: *const u8,
origin_len: usize,
field_value: *const u8,
field_value_len: usize
) -> c_int
Expand description
@function
Submits ALTSVC frame.
ALTSVC frame is a non-critical extension to HTTP/2, and defined in
RFC 7383 <https://tools.ietf.org/html/rfc7838#section-4>
_.
The |flags| is currently ignored and should be
:enum:NGHTTP2_FLAG_NONE
.
The |origin| points to the origin this alternative service is associated with. The |origin_len| is the length of the origin. If |stream_id| is 0, the origin must be specified. If |stream_id| is not zero, the origin must be empty (in other words, |origin_len| must be 0).
The ALTSVC frame is only usable from server side. If this function
is invoked with client side session, this function returns
:enum:NGHTTP2_ERR_INVALID_STATE
.
This function returns 0 if it succeeds, or one of the following negative error codes:
:enum:NGHTTP2_ERR_NOMEM
Out of memory
:enum:NGHTTP2_ERR_INVALID_STATE
The function is called from client side session
:enum:NGHTTP2_ERR_INVALID_ARGUMENT
The sum of |origin_len| and |field_value_len| is larger than
16382; or |origin_len| is 0 while |stream_id| is 0; or
|origin_len| is not 0 while |stream_id| is not 0.