2 nghttp2_session_upgrade2
3 ========================
8 *#include <nghttp2/nghttp2.h>*
10 .. function:: int nghttp2_session_upgrade2(nghttp2_session *session, const uint8_t *settings_payload, size_t settings_payloadlen, int head_request, void *stream_user_data)
13 Performs post-process of HTTP Upgrade request. This function can
14 be called from both client and server, but the behavior is very
15 different in each other.
17 If called from client side, the *settings_payload* must be the
18 value sent in ``HTTP2-Settings`` header field and must be decoded
19 by base64url decoder. The *settings_payloadlen* is the length of
20 *settings_payload*. The *settings_payload* is unpacked and its
21 setting values will be submitted using `nghttp2_submit_settings()`.
22 This means that the client application code does not need to submit
23 SETTINGS by itself. The stream with stream ID=1 is opened and the
24 *stream_user_data* is used for its stream_user_data. The opened
25 stream becomes half-closed (local) state.
27 If called from server side, the *settings_payload* must be the
28 value received in ``HTTP2-Settings`` header field and must be
29 decoded by base64url decoder. The *settings_payloadlen* is the
30 length of *settings_payload*. It is treated as if the SETTINGS
31 frame with that payload is received. Thus, callback functions for
32 the reception of SETTINGS frame will be invoked. The stream with
33 stream ID=1 is opened. The *stream_user_data* is ignored. The
34 opened stream becomes half-closed (remote).
36 If the request method is HEAD, pass nonzero value to
37 *head_request*. Otherwise, pass 0.
39 This function returns 0 if it succeeds, or one of the following
42 :macro:`nghttp2_error.NGHTTP2_ERR_NOMEM`
44 :macro:`nghttp2_error.NGHTTP2_ERR_INVALID_ARGUMENT`
45 The *settings_payload* is badly formed.
46 :macro:`nghttp2_error.NGHTTP2_ERR_PROTO`
47 The stream ID 1 is already used or closed; or is not available.