32#include <nghttp2/nghttp2.h>
58 return "RESERVED_LOCAL";
60 return "RESERVED_REMOTE";
64 return "HALF_CLOSED_LOCAL";
66 return "HALF_CLOSED_REMOTE";
85#define S_IDL (H2_SS_IDL + 1)
86#define S_RS_L (H2_SS_RSVD_L + 1)
87#define S_RS_R (H2_SS_RSVD_R + 1)
88#define S_OPEN (H2_SS_OPEN + 1)
89#define S_CL_L (H2_SS_CLOSED_L + 1)
90#define S_CL_R (H2_SS_CLOSED_R + 1)
91#define S_CLS (H2_SS_CLOSED + 1)
92#define S_CLN (H2_SS_CLEANUP + 1)
176 return stream->
state;
283#if AP_HAS_RESPONSE_BUCKETS
285 stream->
pool,
c->bucket_alloc);
331 switch (stream->
state) {
434 H2_STRM_MSG(stream,
"invalid frame %d send"), ftype);
484 H2_STRM_MSG(stream,
"invalid frame %d recv"), ftype);
541 H2_STRM_MSG(stream,
"recv DATA, len=%d: -->%s<--"),
560 switch (stream->magic) {
563 H2_STRM_MSG(stream,
"was not destroyed explicitly"));
602#ifdef H2_NG2_LOCAL_WIN_SIZE
646 H2_STRM_MSG(stream,
"reset, error=%d"), error_code);
666 "set_request_rec %s host=%s://%s%s"),
704 "pseudo header in trailer"));
743 if (
name[0] ==
':') {
749 "Request pseudo header exceeds "
750 "LimitRequestFieldSize: %s"),
name);
790 "LimitRequestFieldSize: %.*s"),
808 "exceeds LimitRequestFields"));
837 if (strlen(
value) <=
ctx->maxlen)
return 1;
863 if (
ctx.failed_key) {
867 "LimitRequestFieldSize: %.*s"),
868 (
int)
H2MIN(strlen(
ctx.failed_key), 80),
ctx.failed_key);
888 || (req->
scheme[4] !=
'\0'
890 || req->
scheme[5] !=
'\0'))));
909 "without :scheme or :path, sending 400 answer"));
917 "':protocol: %s' header present in %s request",
926 "with :scheme or :path specified, sending 400 answer"));
935 "resource without :path, sending 400 answer"));
950 "path '%s' do not allow creating an absolute URL. Failing "
951 "request with 400."), req->
scheme, req->
path);
966 H2_STRM_MSG(stream,
"headers received from client:"));
983#if AP_HAS_RESPONSE_BUCKETS
1006 else if (
err >= 400) {
1049 H2_STRM_MSG(stream,
"out_buffer, already has %ld length"),
1065 H2_STRM_MSG(stream,
"out_buffer, receive unsuccessful"));
1088 else if (
b->length == 0) {
1103#if AP_HAS_RESPONSE_BUCKETS
1134#if AP_HAS_RESPONSE_BUCKETS
1148#if AP_HAS_RESPONSE_BUCKETS
1193 APLOGNO(02940)
"submit_response: %s",
1202#if AP_HAS_RESPONSE_BUCKETS
1218 for (
i = 0;
i < pushes->
nelts; ++
i) {
1236#if AP_HAS_RESPONSE_BUCKETS
1279 return stream->
state == state;
1297 return stream->
state == state;
1317#ifdef H2_NG2_LOCAL_WIN_SIZE
1320 session->
ngh2, stream->
id);
1324 const int win_max = 2*1024*1024;
1356 H2_STRM_MSG(stream,
"consumed %ld bytes, window now %d/%d"),
1379#if AP_HAS_RESPONSE_BUCKETS
1477 "need more (read len=%ld, %ld in buffer)"),
1482 "buffer_output_received"));
1505 "eof on receive (read len=%ld, %ld in buffer)"),
1533 "data_cb, error processing trailers"));
1548 H2_STRM_MSG(stream,
"data_cb, sending len=%ld, eos=%d"),
1572#if AP_HAS_RESPONSE_BUCKETS
1587#if AP_HAS_RESPONSE_BUCKETS
1628 if (
resp->status < 100) {
1641 "renegotiate forbidden, cause: %s"),
cause);
1649 "submit response %d"),
resp->status);
1670 && (
resp->status < 400)
1671 && (
resp->status != 304)
1688 if (
resp->status == 103
1695 if (
resp->status >= 200) {
1700 memset(&provider, 0,
sizeof(provider));
1701 provider.source.fd = stream->
id;
1721 APLOGNO(10402)
"submit_response: %s",
1749 "buffer_output_received2"));
1774 H2_STRM_MSG(stream,
"read_output, no output beam registered"));
const char apr_size_t len
APR general purpose library routines.
APR-UTIL string matching routines.
#define APLOG_C_IS_LEVEL(c, level)
const unsigned char * buf
#define AP_BUCKET_IS_ERROR(e)
int ap_ssl_conn_is_ssl(conn_rec *c)
ap_vhost_iterate_conn_cb void * baton
#define APR_STATUS_IS_EAGAIN(s)
#define APR_BUCKET_IS_FLUSH(e)
#define APR_BUCKET_REMOVE(e)
#define APR_BUCKET_IS_METADATA(e)
#define APR_BRIGADE_INSERT_TAIL(b, e)
#define APR_BUCKET_NEXT(e)
#define APR_BRIGADE_EMPTY(b)
#define APR_BRIGADE_SENTINEL(b)
#define APR_BUCKET_IS_EOS(e)
apr_brigade_flush void * ctx
#define APR_BRIGADE_FIRST(b)
#define apr_bucket_destroy(e)
apr_pool_t const char apr_dbd_t const char ** error
const char apr_ssize_t int flags
apr_memcache_server_t * ms
#define HTTP_REQUEST_URI_TOO_LARGE
#define HTTP_REQUEST_HEADER_FIELDS_TOO_LARGE
#define HTTP_NOT_IMPLEMENTED
int ap_cstr_casecmp(const char *s1, const char *s2)
char * ap_escape_logitem(apr_pool_t *p, const char *str)
#define AP_DEBUG_ASSERT(exp)
int ap_cstr_casecmpn(const char *s1, const char *s2, apr_size_t n)
const char int apr_pool_t * pool
void const char apr_status_t(* cleanup)(void *))
apr_vformatter_buff_t * c
apr_sockaddr_t apr_sockaddr_t apr_sockaddr_t * source
const char apr_uint32_t * id
#define apr_pcalloc(p, size)
#define APR_ARRAY_IDX(ary, i, type)
apr_int32_t apr_int32_t apr_int32_t err
#define apr_time_msec(time)
#define H2_ERR_HTTP_1_1_REQUIRED
#define H2_PUSH_MODE_NOTE
#define H2_ERR_STREAM_CLOSED
#define H2_ERR_ENHANCE_YOUR_CALM
#define H2_ERR_PROTOCOL_ERROR
#define H2_ERR_INTERNAL_ERROR
#define H2_HTTP_STATUS_UNSET
int h2_beam_empty(h2_bucket_beam *beam)
apr_status_t h2_beam_create(h2_bucket_beam **pbeam, conn_rec *from, apr_pool_t *pool, int id, const char *tag, apr_size_t max_buf_size, apr_interval_time_t timeout)
apr_status_t h2_beam_send(h2_bucket_beam *beam, conn_rec *from, apr_bucket_brigade *sender_bb, apr_read_type_e block, apr_off_t *pwritten)
int h2_beam_report_consumption(h2_bucket_beam *beam)
apr_status_t h2_beam_receive(h2_bucket_beam *beam, conn_rec *to, apr_bucket_brigade *bb, apr_read_type_e block, apr_off_t readbytes)
apr_status_t h2_c1_io_pass(h2_c1_io *io)
int h2_c1_io_needs_flush(h2_c1_io *io)
void h2_c2_abort(conn_rec *c2, conn_rec *from)
const struct h2_priority * h2_cconfig_get_priority(conn_rec *c, const char *content_type)
int h2_config_sgeti(server_rec *s, h2_config_var_t var)
#define h2_conn_ctx_get(c)
int h2_mplx_c1_stream_is_running(h2_mplx *m, h2_stream *stream)
apr_array_header_t * h2_push_collect_update(struct h2_stream *stream, const struct h2_request *req, const struct h2_headers *res)
apr_status_t h2_request_rcreate(h2_request **preq, apr_pool_t *pool, request_rec *r)
apr_status_t h2_request_add_header(h2_request *req, apr_pool_t *pool, const char *name, size_t nlen, const char *value, size_t vlen, size_t max_field_len, int *pwas_added)
h2_request * h2_request_create(int id, apr_pool_t *pool, const char *method, const char *scheme, const char *authority, const char *path, apr_table_t *header)
apr_status_t h2_request_end_headers(h2_request *req, apr_pool_t *pool, size_t raw_bytes)
h2_request * h2_request_clone(apr_pool_t *p, const h2_request *src)
int h2_session_push_enabled(h2_session *session)
apr_status_t h2_session_set_prio(h2_session *session, h2_stream *stream, const h2_priority *prio)
void h2_session_dispatch_event(h2_session *session, h2_session_event_t ev, apr_status_t arg, const char *msg)
struct h2_stream * h2_session_push(h2_session *session, h2_stream *is, h2_push *push)
@ H2_SESSION_EV_PROTO_ERROR
@ H2_SESSION_EV_CONN_ERROR
#define H2_SSSN_STRM_MSG(s, stream_id, msg)
static void H2_STREAM_OUT_LOG(int lvl, h2_stream *s, const char *tag)
static int trans_on_event[][H2_SS_MAX]
static int on_event(h2_stream *stream, h2_stream_event_t ev)
static int trans_on_recv[][H2_SS_MAX]
static void stream_do_responses(h2_stream *stream)
apr_status_t h2_stream_add_header(h2_stream *stream, const char *name, size_t nlen, const char *value, size_t vlen)
apr_status_t h2_stream_set_request_rec(h2_stream *stream, request_rec *r, int eos)
void h2_stream_dispatch(h2_stream *stream, h2_stream_event_t ev)
void h2_stream_set_request(h2_stream *stream, const h2_request *r)
static const char * h2_ss_str(const h2_stream_state_t state)
static apr_status_t add_trailer(h2_stream *stream, const char *name, size_t nlen, const char *value, size_t vlen, size_t max_field_len, int *pwas_added)
static apr_status_t transit(h2_stream *stream, int new_state)
h2_stream * h2_stream_create(int id, apr_pool_t *pool, h2_session *session, h2_stream_monitor *monitor, int initiated_on)
apr_status_t h2_stream_recv_DATA(h2_stream *stream, uint8_t flags, const uint8_t *data, size_t len)
apr_status_t h2_stream_send_frame(h2_stream *stream, int ftype, int flags, size_t frame_len)
const char * h2_stream_state_str(const h2_stream *stream)
const h2_priority * h2_stream_get_priority(h2_stream *stream, h2_headers *response)
static void set_error_response(h2_stream *stream, int http_status)
static int table_check_val_len(void *baton, const char *key, const char *value)
static int bucket_pass_to_c1(apr_bucket *b)
apr_status_t h2_stream_in_consumed(h2_stream *stream, apr_off_t amount)
int h2_stream_is_at(const h2_stream *stream, h2_stream_state_t state)
static void stream_setup_input(h2_stream *stream)
static void on_state_invalid(h2_stream *stream)
void h2_stream_destroy(h2_stream *stream)
void h2_stream_set_monitor(h2_stream *stream, h2_stream_monitor *monitor)
void h2_stream_cleanup(h2_stream *stream)
static apr_status_t close_input(h2_stream *stream)
void h2_stream_on_output_change(h2_stream *stream)
static apr_status_t input_flush(h2_stream *stream)
void h2_stream_rst(h2_stream *stream, int error_code)
static int input_buffer_is_empty(h2_stream *stream)
static ssize_t stream_data_cb(nghttp2_session *ng2s, int32_t stream_id, uint8_t *buf, size_t length, uint32_t *data_flags, nghttp2_data_source *source, void *puser)
apr_status_t h2_stream_end_headers(h2_stream *stream, int eos, size_t raw_bytes)
static apr_status_t stream_do_response(h2_stream *stream)
static void on_state_event(h2_stream *stream, h2_stream_event_t ev)
int h2_stream_is_at_or_past(const h2_stream *stream, h2_stream_state_t state)
static void on_state_enter(h2_stream *stream)
static void input_append_bucket(h2_stream *stream, apr_bucket *b)
static apr_off_t output_data_buffered(h2_stream *stream, int *peos, int *pheader_blocked)
void h2_stream_on_input_change(h2_stream *stream)
apr_status_t h2_stream_prepare_processing(h2_stream *stream)
int h2_stream_is_ready(h2_stream *stream)
int h2_stream_wants_send_data(h2_stream *stream)
static int on_frame_send(h2_stream_state_t state, int frame_type)
static int on_frame(h2_stream_state_t state, int frame_type, int frame_map[][H2_SS_MAX], apr_size_t maxlen)
apr_table_t * h2_stream_get_trailers(h2_stream *stream)
apr_status_t h2_stream_read_to(h2_stream *stream, apr_bucket_brigade *bb, apr_off_t *plen, int *peos)
static void set_policy_for(h2_stream *stream, h2_request *r)
static void stream_do_error_bucket(h2_stream *stream, apr_bucket *b)
static apr_status_t stream_do_trailers(h2_stream *stream)
static int on_frame_recv(h2_stream_state_t state, int frame_type)
apr_status_t h2_stream_submit_pushes(h2_stream *stream, h2_headers *response)
apr_status_t h2_stream_recv_frame(h2_stream *stream, int ftype, int flags, size_t frame_len)
static int on_map(h2_stream_state_t state, int map[H2_SS_MAX])
static apr_status_t buffer_output_receive(h2_stream *stream)
static void input_append_data(h2_stream *stream, const char *data, apr_size_t len)
static apr_bucket * get_first_response_bucket(apr_bucket_brigade *bb)
static int trans_on_send[][H2_SS_MAX]
#define H2_STRM_MSG(s, msg)
#define H2_STRM_ASSERT_MAGIC(s, m)
#define H2_STRM_ASSIGN_MAGIC(s, m)
#define H2_STRM_LOG(aplogno, s, msg)
apr_status_t h2_append_brigade(apr_bucket_brigade *to, apr_bucket_brigade *from, apr_off_t *plen, int *peos, h2_bucket_gate *should_append)
apr_status_t h2_res_create_ngheader(h2_ngheader **ph, apr_pool_t *p, h2_headers *headers)
int h2_ignore_req_trailer(const char *name, size_t len)
apr_status_t h2_res_create_ngtrailer(h2_ngheader **ph, apr_pool_t *p, h2_headers *headers)
void h2_util_camel_case_header(char *s, size_t len)
int h2_push_policy_determine(apr_table_t *headers, apr_pool_t *p, int push_enabled)
apr_off_t h2_brigade_mem_size(apr_bucket_brigade *bb)
apr_size_t h2_util_bb_print(char *buffer, apr_size_t bmax, const char *tag, const char *sep, apr_bucket_brigade *bb)
Apache connection library.
A bucket referring to an HTTP error.
Structure to store things which are per connection.
struct apr_bucket_alloc_t * bucket_alloc
unsigned int pushes_submitted
unsigned int responses_submitted
apr_size_t max_data_frame_len
apr_size_t max_stream_mem
struct nghttp2_session * ngh2
h2_stream_state_cb * on_state_enter
h2_stream_event_cb * on_state_event
h2_stream_event_cb * on_event
h2_stream_state_cb * on_state_invalid
struct h2_headers * response
struct h2_bucket_beam * output
unsigned int input_closed
apr_off_t in_trailer_octets
h2_stream_monitor * monitor
struct h2_bucket_beam * input
int request_headers_failed
const h2_priority * pref_priority
apr_table_t * trailers_in
apr_bucket_brigade * out_buffer
int request_headers_added
unsigned int sent_trailers
apr_off_t out_frame_octets
const struct h2_request * request
apr_bucket_brigade * in_buffer
struct h2_session * session
A structure that represents the current request.
apr_interval_time_t timeout
typedef int(WSAAPI *apr_winapi_fpt_WSAPoll)(IN OUT LPWSAPOLLFD fdArray