pub unsafe extern "C" fn nghttp2_session_upgrade2(
    session: *mut nghttp2_session,
    settings_payload: *const u8,
    settings_payloadlen: usize,
    head_request: c_int,
    stream_user_data: *mut c_void
) -> c_int
Expand description

@function

Performs post-process of HTTP Upgrade request. This function can be called from both client and server, but the behavior is very different in each other.

If called from client side, the |settings_payload| must be the value sent in HTTP2-Settings header field and must be decoded by base64url decoder. The |settings_payloadlen| is the length of |settings_payload|. The |settings_payload| is unpacked and its setting values will be submitted using nghttp2_submit_settings(). This means that the client application code does not need to submit SETTINGS by itself. The stream with stream ID=1 is opened and the |stream_user_data| is used for its stream_user_data. The opened stream becomes half-closed (local) state.

If called from server side, the |settings_payload| must be the value received in HTTP2-Settings header field and must be decoded by base64url decoder. The |settings_payloadlen| is the length of |settings_payload|. It is treated as if the SETTINGS frame with that payload is received. Thus, callback functions for the reception of SETTINGS frame will be invoked. The stream with stream ID=1 is opened. The |stream_user_data| is ignored. The opened stream becomes half-closed (remote).

If the request method is HEAD, pass nonzero value to |head_request|. Otherwise, pass 0.

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_ARGUMENT The |settings_payload| is badly formed. :enum:NGHTTP2_ERR_PROTO The stream ID 1 is already used or closed; or is not available.