2 * nghttp2 - HTTP/2 C Library
4 * Copyright (c) 2015 Tatsuhiro Tsujikawa
6 * Permission is hereby granted, free of charge, to any person obtaining
7 * a copy of this software and associated documentation files (the
8 * "Software"), to deal in the Software without restriction, including
9 * without limitation the rights to use, copy, modify, merge, publish,
10 * distribute, sublicense, and/or sell copies of the Software, and to
11 * permit persons to whom the Software is furnished to do so, subject to
12 * the following conditions:
14 * The above copyright notice and this permission notice shall be
15 * included in all copies or substantial portions of the Software.
17 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
18 * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
19 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
20 * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
21 * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
22 * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
23 * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
25 #ifndef NGHTTP2_HTTP_H
26 #define NGHTTP2_HTTP_H
30 #endif /* HAVE_CONFIG_H */
32 #include <nghttp2/nghttp2.h>
33 #include "nghttp2_session.h"
34 #include "nghttp2_stream.h"
37 * This function is called when HTTP header field |nv| in |frame| is
38 * received for |stream|. This function will validate |nv| against
39 * the current state of stream. The |token| is nghttp2_token value
40 * for nv->name, or -1 if we don't have enum value for the name.
42 * This function returns 0 if it succeeds, or one of the following
43 * negative error codes:
45 * NGHTTP2_ERR_HTTP_HEADER
46 * Invalid HTTP header field was received.
47 * NGHTTP2_ERR_IGN_HTTP_HEADER
48 * Invalid HTTP header field was received but it can be treated as
49 * if it was not received because of compatibility reasons.
51 int nghttp2_http_on_header(nghttp2_session *session, nghttp2_stream *stream,
52 nghttp2_frame *frame, nghttp2_nv *nv, int token,
56 * This function is called when request header is received. This
57 * function performs validation and returns 0 if it succeeds, or -1.
59 int nghttp2_http_on_request_headers(nghttp2_stream *stream,
60 nghttp2_frame *frame);
63 * This function is called when response header is received. This
64 * function performs validation and returns 0 if it succeeds, or -1.
66 int nghttp2_http_on_response_headers(nghttp2_stream *stream);
69 * This function is called trailer header (for both request and
70 * response) is received. This function performs validation and
71 * returns 0 if it succeeds, or -1.
73 int nghttp2_http_on_trailer_headers(nghttp2_stream *stream,
74 nghttp2_frame *frame);
77 * This function is called when END_STREAM flag is seen in incoming
78 * frame. This function performs validation and returns 0 if it
81 int nghttp2_http_on_remote_end_stream(nghttp2_stream *stream);
84 * This function is called when chunk of data is received. This
85 * function performs validation and returns 0 if it succeeds, or -1.
87 int nghttp2_http_on_data_chunk(nghttp2_stream *stream, size_t n);
90 * This function inspects header field in |frame| and records its
91 * method in stream->http_flags. If frame->hd.type is neither
92 * NGHTTP2_HEADERS nor NGHTTP2_PUSH_PROMISE, this function does
95 void nghttp2_http_record_request_method(nghttp2_stream *stream,
96 nghttp2_frame *frame);
98 #endif /* NGHTTP2_HTTP_H */