1 2nghttp2_submit_altsvc 3===================== 4 5Synopsis 6-------- 7 8*#include <nghttp2/nghttp2.h>* 9 10.. function:: int nghttp2_submit_altsvc(nghttp2_session *session, uint8_t flags, int32_t stream_id, const uint8_t *origin, size_t origin_len, const uint8_t *field_value, size_t field_value_len) 11 12 13 Submits ALTSVC frame. 14 15 ALTSVC frame is a non-critical extension to HTTP/2, and defined in 16 `RFC 7383 <https://tools.ietf.org/html/rfc7838#section-4>`_. 17 18 The *flags* is currently ignored and should be 19 :macro:`nghttp2_flag.NGHTTP2_FLAG_NONE`. 20 21 The *origin* points to the origin this alternative service is 22 associated with. The *origin_len* is the length of the origin. If 23 *stream_id* is 0, the origin must be specified. If *stream_id* is 24 not zero, the origin must be empty (in other words, *origin_len* 25 must be 0). 26 27 The ALTSVC frame is only usable from server side. If this function 28 is invoked with client side session, this function returns 29 :macro:`nghttp2_error.NGHTTP2_ERR_INVALID_STATE`. 30 31 This function returns 0 if it succeeds, or one of the following 32 negative error codes: 33 34 :macro:`nghttp2_error.NGHTTP2_ERR_NOMEM` 35 Out of memory 36 :macro:`nghttp2_error.NGHTTP2_ERR_INVALID_STATE` 37 The function is called from client side session 38 :macro:`nghttp2_error.NGHTTP2_ERR_INVALID_ARGUMENT` 39 The sum of *origin_len* and *field_value_len* is larger than 40 16382; or *origin_len* is 0 while *stream_id* is 0; or 41 *origin_len* is not 0 while *stream_id* is not 0. 42