2 nghttp2_submit_push_promise
3 ===========================
8 *#include <nghttp2/nghttp2.h>*
10 .. function:: int32_t nghttp2_submit_push_promise( nghttp2_session *session, uint8_t flags, int32_t stream_id, const nghttp2_nv *nva, size_t nvlen, void *promised_stream_user_data)
13 Submits PUSH_PROMISE frame.
15 The *flags* is currently ignored. The library handles the
16 CONTINUATION frame internally and it correctly sets END_HEADERS to
17 the last sequence of the PUSH_PROMISE or CONTINUATION frame.
19 The *stream_id* must be client initiated stream ID.
21 The *nva* is an array of name/value pair :type:`nghttp2_nv` with
22 *nvlen* elements. The application is responsible to include
23 required pseudo-header fields (header field whose name starts with
24 ":") in *nva* and must place pseudo-headers before regular header
27 This function creates copies of all name/value pairs in *nva*. It
28 also lower-cases all names in *nva*. The order of elements in
29 *nva* is preserved. For header fields with
30 :macro:`NGHTTP2_NV_FLAG_NO_COPY_NAME` and
31 :macro:`NGHTTP2_NV_FLAG_NO_COPY_VALUE` are set, header field name
32 and value are not copied respectively. With
33 :macro:`NGHTTP2_NV_FLAG_NO_COPY_NAME`, application is responsible to
34 pass header field name in lowercase. The application should
35 maintain the references to them until
36 :type:`nghttp2_on_frame_send_callback` or
37 :type:`nghttp2_on_frame_not_send_callback` is called.
39 The *promised_stream_user_data* is a pointer to an arbitrary data
40 which is associated to the promised stream this frame will open and
41 make it in reserved state. It is available using
42 `nghttp2_session_get_stream_user_data()`. The application can
43 access it in :type:`nghttp2_before_frame_send_callback` and
44 :type:`nghttp2_on_frame_send_callback` of this frame.
46 The client side is not allowed to use this function.
48 To submit response headers and data, use
49 `nghttp2_submit_response()`.
51 This function returns assigned promised stream ID if it succeeds,
52 or one of the following negative error codes:
54 :macro:`NGHTTP2_ERR_NOMEM`
56 :macro:`NGHTTP2_ERR_PROTO`
57 This function was invoked when *session* is initialized as
59 :macro:`NGHTTP2_ERR_STREAM_ID_NOT_AVAILABLE`
60 No stream ID is available because maximum stream ID was
62 :macro:`NGHTTP2_ERR_INVALID_ARGUMENT`
63 The *stream_id* is 0; The *stream_id* does not designate stream
65 :macro:`NGHTTP2_ERR_STREAM_CLOSED`
66 The stream was already closed; or the *stream_id* is invalid.
70 This function returns assigned promised stream ID if it succeeds.
71 As of 1.16.0, stream object for pushed resource is created when
72 this function succeeds. In that case, the application can submit
73 push response for the promised frame.
75 In 1.15.0 or prior versions, pushed stream is not opened yet when
76 this function succeeds. The application must not submit frame to
77 that stream ID before :type:`nghttp2_before_frame_send_callback`
78 is called for this frame.