comparison src/http/v3/ngx_http_v3.h @ 8769:9ec3e71f8a61 quic

HTTP/3: reference h3c directly from ngx_http_connection_t. Previously, an ngx_http_v3_connection_t object was created for HTTP/3 and then assinged to c->data instead of the generic ngx_http_connection_t object. Now a direct reference is added to ngx_http_connection_t, which is less confusing and does not require a flag for http3.
author Roman Arutyunyan <arut@nginx.com>
date Wed, 05 May 2021 14:53:36 +0300
parents 40d710a66aef
children 67f0eb150047
comparison
equal deleted inserted replaced
8768:40d710a66aef 8769:9ec3e71f8a61
72 #define NGX_HTTP_V3_ERR_DECOMPRESSION_FAILED 0x200 72 #define NGX_HTTP_V3_ERR_DECOMPRESSION_FAILED 0x200
73 #define NGX_HTTP_V3_ERR_ENCODER_STREAM_ERROR 0x201 73 #define NGX_HTTP_V3_ERR_ENCODER_STREAM_ERROR 0x201
74 #define NGX_HTTP_V3_ERR_DECODER_STREAM_ERROR 0x202 74 #define NGX_HTTP_V3_ERR_DECODER_STREAM_ERROR 0x202
75 75
76 76
77 #define ngx_http_v3_get_session(c) \ 77 #define ngx_http_v3_get_session(c) ngx_http_quic_get_connection(c)->v3_session
78 ((ngx_http_v3_connection_t *) (c)->quic->parent->data)
79 78
80 #define ngx_http_v3_get_module_loc_conf(c, module) \ 79 #define ngx_http_v3_get_module_loc_conf(c, module) \
81 ngx_http_get_module_loc_conf( \ 80 ngx_http_get_module_loc_conf(ngx_http_quic_get_connection(c)->conf_ctx, \
82 ((ngx_http_v3_connection_t *) c->quic->parent->data)->hc.conf_ctx, \ 81 module)
83 module)
84 82
85 #define ngx_http_v3_get_module_srv_conf(c, module) \ 83 #define ngx_http_v3_get_module_srv_conf(c, module) \
86 ngx_http_get_module_srv_conf( \ 84 ngx_http_get_module_srv_conf(ngx_http_quic_get_connection(c)->conf_ctx, \
87 ((ngx_http_v3_connection_t *) c->quic->parent->data)->hc.conf_ctx, \ 85 module)
88 module)
89 86
90 #define ngx_http_v3_finalize_connection(c, code, reason) \ 87 #define ngx_http_v3_finalize_connection(c, code, reason) \
91 ngx_quic_finalize_connection(c->quic->parent, code, reason) 88 ngx_quic_finalize_connection(c->quic->parent, code, reason)
92 89
93 #define ngx_http_v3_shutdown_connection(c, code, reason) \ 90 #define ngx_http_v3_shutdown_connection(c, code, reason) \
128 size_t size; 125 size_t size;
129 size_t capacity; 126 size_t capacity;
130 } ngx_http_v3_dynamic_table_t; 127 } ngx_http_v3_dynamic_table_t;
131 128
132 129
133 typedef struct { 130 struct ngx_http_v3_connection_s {
134 /* the http connection must be first */
135 ngx_http_connection_t hc;
136 ngx_http_v3_dynamic_table_t table; 131 ngx_http_v3_dynamic_table_t table;
137 132
138 ngx_event_t keepalive; 133 ngx_event_t keepalive;
139 ngx_uint_t nrequests; 134 ngx_uint_t nrequests;
140 135
147 uint64_t max_push_id; 142 uint64_t max_push_id;
148 143
149 ngx_uint_t goaway; /* unsigned goaway:1; */ 144 ngx_uint_t goaway; /* unsigned goaway:1; */
150 145
151 ngx_connection_t *known_streams[NGX_HTTP_V3_MAX_KNOWN_STREAM]; 146 ngx_connection_t *known_streams[NGX_HTTP_V3_MAX_KNOWN_STREAM];
152 } ngx_http_v3_connection_t; 147 };
153 148
154 149
155 void ngx_http_v3_init(ngx_connection_t *c); 150 void ngx_http_v3_init(ngx_connection_t *c);
156 ngx_int_t ngx_http_v3_read_request_body(ngx_http_request_t *r); 151 ngx_int_t ngx_http_v3_read_request_body(ngx_http_request_t *r);
157 ngx_int_t ngx_http_v3_read_unbuffered_request_body(ngx_http_request_t *r); 152 ngx_int_t ngx_http_v3_read_unbuffered_request_body(ngx_http_request_t *r);