2 nghttp2_session_mem_recv
3 ========================
8 *#include <nghttp2/nghttp2.h>*
10 .. function:: ssize_t nghttp2_session_mem_recv(nghttp2_session *session, const uint8_t *in, size_t inlen)
13 Processes data *in* as an input from the remote endpoint. The
14 *inlen* indicates the number of bytes to receive in the *in*.
16 This function behaves like `nghttp2_session_recv()` except that it
17 does not use :type:`nghttp2_recv_callback` to receive data; the
18 *in* is the only data for the invocation of this function. If all
19 bytes are processed, this function returns. The other callbacks
20 are called in the same way as they are in `nghttp2_session_recv()`.
22 In the current implementation, this function always tries to
23 processes *inlen* bytes of input data unless either an error occurs or
24 :macro:`nghttp2_error.NGHTTP2_ERR_PAUSE` is returned from
25 :type:`nghttp2_on_header_callback` or
26 :type:`nghttp2_on_data_chunk_recv_callback`. If
27 :macro:`nghttp2_error.NGHTTP2_ERR_PAUSE` is used, the return value
28 includes the number of bytes which was used to produce the data or
29 frame for the callback.
31 This function returns the number of processed bytes, or one of the
32 following negative error codes:
34 :macro:`nghttp2_error.NGHTTP2_ERR_NOMEM`
36 :macro:`nghttp2_error.NGHTTP2_ERR_CALLBACK_FAILURE`
37 The callback function failed.
38 :macro:`nghttp2_error.NGHTTP2_ERR_BAD_CLIENT_MAGIC`
39 Invalid client magic was detected. This error only returns
40 when *session* was configured as server and
41 `nghttp2_option_set_no_recv_client_magic()` is not used with
43 :macro:`nghttp2_error.NGHTTP2_ERR_FLOODED`
44 Flooding was detected in this HTTP/2 session, and it must be
45 closed. This is most likely caused by misbehaviour of peer.