Session.upgrade

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_payload| is unpacked and its setting values will be submitted using submitSettings. 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. 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).

This function returns 0 if it succeeds, or one of the following negative error codes:

ErrorCode.INVALID_ARGUMENT The |settings_payload| is badly formed. ErrorCode.PROTO The stream ID 1 is already used or closed; or is not available.

class Session
upgrade
(
in ubyte[] settings_payload
,
void* stream_user_data = null
)

Meta