8 *#include <nghttp2/nghttp2.h>*
10 .. function:: int32_t nghttp2_submit_headers(nghttp2_session *session, uint8_t flags, int32_t stream_id, const nghttp2_priority_spec *pri_spec, const nghttp2_nv *nva, size_t nvlen, void *stream_user_data)
13 Submits HEADERS frame. The *flags* is bitwise OR of the
16 * :macro:`NGHTTP2_FLAG_END_STREAM`
18 If *flags* includes :macro:`NGHTTP2_FLAG_END_STREAM`, this frame has
21 The library handles the CONTINUATION frame internally and it
22 correctly sets END_HEADERS to the last sequence of the PUSH_PROMISE
23 or CONTINUATION frame.
25 If the *stream_id* is -1, this frame is assumed as request (i.e.,
26 request HEADERS frame which opens new stream). In this case, the
27 assigned stream ID will be returned. Otherwise, specify stream ID
30 The *pri_spec* is priority specification of this request. ``NULL``
31 means the default priority (see
32 `nghttp2_priority_spec_default_init()`). To specify the priority,
33 use `nghttp2_priority_spec_init()`. If *pri_spec* is not ``NULL``,
34 this function will copy its data members.
36 The ``pri_spec->weight`` must be in [:macro:`NGHTTP2_MIN_WEIGHT`,
37 :macro:`NGHTTP2_MAX_WEIGHT`], inclusive. If ``pri_spec->weight`` is
38 strictly less than :macro:`NGHTTP2_MIN_WEIGHT`, it becomes
39 :macro:`NGHTTP2_MIN_WEIGHT`. If it is strictly greater than
40 :macro:`NGHTTP2_MAX_WEIGHT`, it becomes :macro:`NGHTTP2_MAX_WEIGHT`.
42 The *nva* is an array of name/value pair :type:`nghttp2_nv` with
43 *nvlen* elements. The application is responsible to include
44 required pseudo-header fields (header field whose name starts with
45 ":") in *nva* and must place pseudo-headers before regular header
48 This function creates copies of all name/value pairs in *nva*. It
49 also lower-cases all names in *nva*. The order of elements in
52 The *stream_user_data* is a pointer to an arbitrary data which is
53 associated to the stream this frame will open. Therefore it is
54 only used if this frame opens streams, in other words, it changes
55 stream state from idle or reserved to open.
57 This function is low-level in a sense that the application code can
58 specify flags directly. For usual HTTP request,
59 `nghttp2_submit_request()` is useful.
61 This function returns newly assigned stream ID if it succeeds and
62 *stream_id* is -1. Otherwise, this function returns 0 if it
63 succeeds, or one of the following negative error codes:
65 :macro:`NGHTTP2_ERR_NOMEM`
67 :macro:`NGHTTP2_ERR_STREAM_ID_NOT_AVAILABLE`
68 No stream ID is available because maximum stream ID was
70 :macro:`NGHTTP2_ERR_INVALID_ARGUMENT`
75 This function returns assigned stream ID if it succeeds and
76 *stream_id* is -1. But that stream is not opened yet. The
77 application must not submit frame to that stream ID before
78 :type:`nghttp2_before_frame_send_callback` is called for this