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)¶
Submits PUSH_PROMISE frame.
The flags is currently ignored. The library handles the CONTINUATION frame internally and it correctly sets END_HEADERS to the last sequence of the PUSH_PROMISE or CONTINUATION frame.
The stream_id must be client initiated stream ID.
The nva is an array of name/value pair
nghttp2_nvwith nvlen elements. The application is responsible to include required pseudo-header fields (header field whose name starts with ":") in nva and must place pseudo-headers before regular header fields.
This function creates copies of all name/value pairs in nva. It also lower-cases all names in nva. The order of elements in nva is preserved. For header fields with
nghttp2_nv_flag.NGHTTP2_NV_FLAG_NO_COPY_VALUEare set, header field name and value are not copied respectively. With
nghttp2_nv_flag.NGHTTP2_NV_FLAG_NO_COPY_NAME, application is responsible to pass header field name in lowercase. The application should maintain the references to them until
The promised_stream_user_data is a pointer to an arbitrary data which is associated to the promised stream this frame will open and make it in reserved state. It is available using
nghttp2_session_get_stream_user_data(). The application can access it in
nghttp2_on_frame_send_callbackof this frame.
The client side is not allowed to use this function.
To submit response headers and data, use
This function returns assigned promised stream ID if it succeeds, or one of the following negative error codes:
Out of memory.
This function was invoked when session is initialized as client.
No stream ID is available because maximum stream ID was reached.
The stream_id is 0; The stream_id does not designate stream that peer initiated.
The stream was already closed; or the stream_id is invalid.
This function returns assigned promised stream ID if it succeeds. As of 1.16.0, stream object for pushed resource is created when this function succeeds. In that case, the application can submit push response for the promised frame.
In 1.15.0 or prior versions, pushed stream is not opened yet when this function succeeds. The application must not submit frame to that stream ID before
nghttp2_before_frame_send_callbackis called for this frame.