Line | Count | Source (jump to first uncovered line) |
1 | | /* |
2 | | * Copyright (c) 2014-2016 DeNA Co., Ltd., Kazuho Oku, Fastly, Inc. |
3 | | * |
4 | | * Permission is hereby granted, free of charge, to any person obtaining a copy |
5 | | * of this software and associated documentation files (the "Software"), to |
6 | | * deal in the Software without restriction, including without limitation the |
7 | | * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or |
8 | | * sell copies of the Software, and to permit persons to whom the Software is |
9 | | * furnished to do so, subject to the following conditions: |
10 | | * |
11 | | * The above copyright notice and this permission notice shall be included in |
12 | | * all copies or substantial portions of the Software. |
13 | | * |
14 | | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR |
15 | | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
16 | | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE |
17 | | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER |
18 | | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING |
19 | | * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS |
20 | | * IN THE SOFTWARE. |
21 | | */ |
22 | | #ifndef h2o_h |
23 | | #define h2o_h |
24 | | |
25 | | #ifdef __cplusplus |
26 | | extern "C" { |
27 | | #endif |
28 | | |
29 | | #include <assert.h> |
30 | | #include <stddef.h> |
31 | | #include <stdint.h> |
32 | | #include <string.h> |
33 | | #include <stdlib.h> |
34 | | #include <sys/time.h> |
35 | | #include <sys/socket.h> |
36 | | #include <time.h> |
37 | | #include <unistd.h> |
38 | | #include <openssl/ssl.h> |
39 | | #include "h2o/filecache.h" |
40 | | #include "h2o/header.h" |
41 | | #include "h2o/hostinfo.h" |
42 | | #include "h2o/memcached.h" |
43 | | #include "h2o/redis.h" |
44 | | #include "h2o/linklist.h" |
45 | | #include "h2o/httpclient.h" |
46 | | #include "h2o/memory.h" |
47 | | #include "h2o/multithread.h" |
48 | | #include "h2o/rand.h" |
49 | | #include "h2o/socket.h" |
50 | | #include "h2o/string_.h" |
51 | | #include "h2o/time_.h" |
52 | | #include "h2o/token.h" |
53 | | #include "h2o/url.h" |
54 | | #include "h2o/balancer.h" |
55 | | #include "h2o/http2_common.h" |
56 | | #include "h2o/send_state.h" |
57 | | |
58 | | #ifndef H2O_USE_BROTLI |
59 | | /* disabled for all but the standalone server, since the encoder is written in C++ */ |
60 | | #define H2O_USE_BROTLI 0 |
61 | | #endif |
62 | | |
63 | | #ifndef H2O_MAX_HEADERS |
64 | 666 | #define H2O_MAX_HEADERS 100 |
65 | | #endif |
66 | | #ifndef H2O_MAX_REQLEN |
67 | 666 | #define H2O_MAX_REQLEN (8192 + 4096 * (H2O_MAX_HEADERS)) |
68 | | #endif |
69 | | |
70 | | #ifndef H2O_SOMAXCONN |
71 | | /* simply use a large value, and let the kernel clip it to the internal max */ |
72 | | #define H2O_SOMAXCONN 65535 |
73 | | #endif |
74 | | |
75 | 24.3k | #define H2O_HTTP2_MIN_STREAM_WINDOW_SIZE 65535 |
76 | 17.7k | #define H2O_HTTP2_MAX_STREAM_WINDOW_SIZE 16777216 |
77 | | |
78 | 1 | #define H2O_DEFAULT_MAX_REQUEST_ENTITY_SIZE (1024 * 1024 * 1024) |
79 | 1 | #define H2O_DEFAULT_MAX_DELEGATIONS 5 |
80 | 1 | #define H2O_DEFAULT_MAX_REPROCESSES 5 |
81 | 1 | #define H2O_DEFAULT_HANDSHAKE_TIMEOUT_IN_SECS 10 |
82 | 1 | #define H2O_DEFAULT_HANDSHAKE_TIMEOUT (H2O_DEFAULT_HANDSHAKE_TIMEOUT_IN_SECS * 1000) |
83 | 1 | #define H2O_DEFAULT_HTTP1_REQ_TIMEOUT_IN_SECS 10 |
84 | 1 | #define H2O_DEFAULT_HTTP1_REQ_TIMEOUT (H2O_DEFAULT_HTTP1_REQ_TIMEOUT_IN_SECS * 1000) |
85 | 1 | #define H2O_DEFAULT_HTTP1_REQ_IO_TIMEOUT_IN_SECS 5 |
86 | 1 | #define H2O_DEFAULT_HTTP1_REQ_IO_TIMEOUT (H2O_DEFAULT_HTTP1_REQ_IO_TIMEOUT_IN_SECS * 1000) |
87 | 1 | #define H2O_DEFAULT_HTTP1_UPGRADE_TO_HTTP2 1 |
88 | 1 | #define H2O_DEFAULT_HTTP2_IDLE_TIMEOUT_IN_SECS 10 |
89 | 1 | #define H2O_DEFAULT_HTTP2_IDLE_TIMEOUT (H2O_DEFAULT_HTTP2_IDLE_TIMEOUT_IN_SECS * 1000) |
90 | 1 | #define H2O_DEFAULT_HTTP2_GRACEFUL_SHUTDOWN_TIMEOUT_IN_SECS 0 /* no timeout */ |
91 | 1 | #define H2O_DEFAULT_HTTP2_GRACEFUL_SHUTDOWN_TIMEOUT (H2O_DEFAULT_HTTP2_GRACEFUL_SHUTDOWN_TIMEOUT_IN_SECS * 1000) |
92 | 2 | #define H2O_DEFAULT_HTTP2_ACTIVE_STREAM_WINDOW_SIZE H2O_HTTP2_MAX_STREAM_WINDOW_SIZE |
93 | 1 | #define H2O_DEFAULT_HTTP3_ACTIVE_STREAM_WINDOW_SIZE H2O_DEFAULT_HTTP2_ACTIVE_STREAM_WINDOW_SIZE |
94 | 3 | #define H2O_DEFAULT_PROXY_IO_TIMEOUT_IN_SECS 30 |
95 | 3 | #define H2O_DEFAULT_PROXY_IO_TIMEOUT (H2O_DEFAULT_PROXY_IO_TIMEOUT_IN_SECS * 1000) |
96 | | #define H2O_DEFAULT_HAPPY_EYEBALLS_NAME_RESOLUTION_DELAY 50 |
97 | | #define H2O_DEFAULT_HAPPY_EYEBALLS_CONNECTION_ATTEMPT_DELAY 250 |
98 | | #define H2O_DEFAULT_PROXY_SSL_SESSION_CACHE_CAPACITY 4096 |
99 | | #define H2O_DEFAULT_PROXY_SSL_SESSION_CACHE_DURATION 86400000 /* 24 hours */ |
100 | | #define H2O_DEFAULT_PROXY_HTTP2_MAX_CONCURRENT_STREAMS 100 |
101 | | |
102 | | typedef struct st_h2o_conn_t h2o_conn_t; |
103 | | typedef struct st_h2o_context_t h2o_context_t; |
104 | | typedef struct st_h2o_req_t h2o_req_t; |
105 | | typedef struct st_h2o_ostream_t h2o_ostream_t; |
106 | | typedef struct st_h2o_configurator_command_t h2o_configurator_command_t; |
107 | | typedef struct st_h2o_configurator_t h2o_configurator_t; |
108 | | typedef struct st_h2o_pathconf_t h2o_pathconf_t; |
109 | | typedef struct st_h2o_hostconf_t h2o_hostconf_t; |
110 | | typedef struct st_h2o_globalconf_t h2o_globalconf_t; |
111 | | typedef struct st_h2o_mimemap_t h2o_mimemap_t; |
112 | | typedef struct st_h2o_logconf_t h2o_logconf_t; |
113 | | typedef struct st_h2o_headers_command_t h2o_headers_command_t; |
114 | | |
115 | | /** |
116 | | * basic structure of a handler (an object that MAY generate a response) |
117 | | * The handlers should register themselves to h2o_context_t::handlers. |
118 | | */ |
119 | | typedef struct st_h2o_handler_t { |
120 | | size_t _config_slot; |
121 | | void (*on_context_init)(struct st_h2o_handler_t *self, h2o_context_t *ctx); |
122 | | void (*on_context_dispose)(struct st_h2o_handler_t *self, h2o_context_t *ctx); |
123 | | void (*dispose)(struct st_h2o_handler_t *self); |
124 | | int (*on_req)(struct st_h2o_handler_t *self, h2o_req_t *req); |
125 | | /** |
126 | | * If the flag is set, protocol handler may invoke the request handler before receiving the end of the request body. The request |
127 | | * handler can determine if the protocol handler has actually done so by checking if `req->proceed_req` is set to non-NULL. |
128 | | * In such case, the handler should replace `req->write_req.cb` (and ctx) with its own callback to receive the request body |
129 | | * bypassing the buffer of the protocol handler. Parts of the request body being received before the handler replacing the |
130 | | * callback is accessible via `req->entity`. |
131 | | * The request handler can delay replacing the callback to a later moment. In such case, the handler can determine if |
132 | | * `req->entity` already contains a complete request body by checking if `req->proceed_req` is NULL. |
133 | | */ |
134 | | unsigned supports_request_streaming : 1; |
135 | | } h2o_handler_t; |
136 | | |
137 | | /** |
138 | | * basic structure of a filter (an object that MAY modify a response) |
139 | | * The filters should register themselves to h2o_context_t::filters. |
140 | | */ |
141 | | typedef struct st_h2o_filter_t { |
142 | | size_t _config_slot; |
143 | | void (*on_context_init)(struct st_h2o_filter_t *self, h2o_context_t *ctx); |
144 | | void (*on_context_dispose)(struct st_h2o_filter_t *self, h2o_context_t *ctx); |
145 | | void (*dispose)(struct st_h2o_filter_t *self); |
146 | | void (*on_setup_ostream)(struct st_h2o_filter_t *self, h2o_req_t *req, h2o_ostream_t **slot); |
147 | | void (*on_informational)(struct st_h2o_filter_t *self, h2o_req_t *req); |
148 | | } h2o_filter_t; |
149 | | |
150 | | /** |
151 | | * basic structure of a logger (an object that MAY log a request) |
152 | | * The loggers should register themselves to h2o_context_t::loggers. |
153 | | */ |
154 | | typedef struct st_h2o_logger_t { |
155 | | size_t _config_slot; |
156 | | void (*on_context_init)(struct st_h2o_logger_t *self, h2o_context_t *ctx); |
157 | | void (*on_context_dispose)(struct st_h2o_logger_t *self, h2o_context_t *ctx); |
158 | | void (*dispose)(struct st_h2o_logger_t *self); |
159 | | void (*log_access)(struct st_h2o_logger_t *self, h2o_req_t *req); |
160 | | } h2o_logger_t; |
161 | | |
162 | | /** |
163 | | * contains stringified representations of a timestamp |
164 | | */ |
165 | | typedef struct st_h2o_timestamp_string_t { |
166 | | char rfc1123[H2O_TIMESTR_RFC1123_LEN + 1]; |
167 | | char log[H2O_TIMESTR_LOG_LEN + 1]; |
168 | | } h2o_timestamp_string_t; |
169 | | |
170 | | /** |
171 | | * a timestamp. |
172 | | * Applications should call h2o_get_timestamp to obtain a timestamp. |
173 | | */ |
174 | | typedef struct st_h2o_timestamp_t { |
175 | | struct timeval at; |
176 | | h2o_timestamp_string_t *str; |
177 | | } h2o_timestamp_t; |
178 | | |
179 | | typedef struct st_h2o_casper_conf_t { |
180 | | /** |
181 | | * capacity bits (0 to disable casper) |
182 | | */ |
183 | | unsigned capacity_bits; |
184 | | /** |
185 | | * whether if all type of files should be tracked (or only the blocking assets) |
186 | | */ |
187 | | int track_all_types; |
188 | | } h2o_casper_conf_t; |
189 | | |
190 | | typedef struct st_h2o_envconf_t { |
191 | | /** |
192 | | * parent |
193 | | */ |
194 | | struct st_h2o_envconf_t *parent; |
195 | | /** |
196 | | * list of names to be unset |
197 | | */ |
198 | | h2o_iovec_vector_t unsets; |
199 | | /** |
200 | | * list of name-value pairs to be set |
201 | | */ |
202 | | h2o_iovec_vector_t sets; |
203 | | } h2o_envconf_t; |
204 | | |
205 | | struct st_h2o_pathconf_t { |
206 | | /** |
207 | | * globalconf to which the pathconf belongs |
208 | | */ |
209 | | h2o_globalconf_t *global; |
210 | | /** |
211 | | * pathname in lower case, may or may not have "/" at last, NULL terminated, or is {NULL,0} if is fallback or extension-level |
212 | | */ |
213 | | h2o_iovec_t path; |
214 | | /** |
215 | | * list of handlers |
216 | | */ |
217 | | H2O_VECTOR(h2o_handler_t *) handlers; |
218 | | /** |
219 | | * list of filters to be applied unless when processing a subrequest. |
220 | | * The address of the list is set in `req->filters` and used when processing a request. |
221 | | */ |
222 | | H2O_VECTOR(h2o_filter_t *) _filters; |
223 | | /** |
224 | | * list of loggers to be applied unless when processing a subrequest. |
225 | | * The address of the list is set in `req->loggers` and used when processing a request. |
226 | | */ |
227 | | H2O_VECTOR(h2o_logger_t *) _loggers; |
228 | | /** |
229 | | * mimemap |
230 | | */ |
231 | | h2o_mimemap_t *mimemap; |
232 | | /** |
233 | | * env |
234 | | */ |
235 | | h2o_envconf_t *env; |
236 | | /** |
237 | | * error-log |
238 | | */ |
239 | | struct { |
240 | | /** |
241 | | * if request-level errors should be emitted to stderr |
242 | | */ |
243 | | unsigned emit_request_errors : 1; |
244 | | } error_log; |
245 | | }; |
246 | | |
247 | | struct st_h2o_hostconf_t { |
248 | | /** |
249 | | * reverse reference to the global configuration |
250 | | */ |
251 | | h2o_globalconf_t *global; |
252 | | /** |
253 | | * host and port |
254 | | */ |
255 | | struct { |
256 | | /** |
257 | | * host and port (in lower-case; base is NULL-terminated) |
258 | | */ |
259 | | h2o_iovec_t hostport; |
260 | | /** |
261 | | * in lower-case; base is NULL-terminated |
262 | | */ |
263 | | h2o_iovec_t host; |
264 | | /** |
265 | | * port number (or 65535 if default) |
266 | | */ |
267 | | uint16_t port; |
268 | | } authority; |
269 | | /** |
270 | | * A boolean indicating that this hostconf can only be used for a request with the ":authority" pseudo-header field / "Host" |
271 | | * that matches hostport. When strict_match is false, then this hostconf is eligible for use as the fallback hostconf for a |
272 | | * request that does not match any applicable hostconf. |
273 | | */ |
274 | | uint8_t strict_match; |
275 | | /** |
276 | | * list of path configurations |
277 | | */ |
278 | | H2O_VECTOR(h2o_pathconf_t *) paths; |
279 | | /** |
280 | | * catch-all path configuration |
281 | | */ |
282 | | h2o_pathconf_t fallback_path; |
283 | | /** |
284 | | * mimemap |
285 | | */ |
286 | | h2o_mimemap_t *mimemap; |
287 | | /** |
288 | | * http2 |
289 | | */ |
290 | | struct { |
291 | | /** |
292 | | * whether if blocking assets being pulled should be given highest priority in case of clients that do not implement |
293 | | * dependency-based prioritization |
294 | | */ |
295 | | unsigned reprioritize_blocking_assets : 1; |
296 | | /** |
297 | | * if server push should be used |
298 | | */ |
299 | | unsigned push_preload : 1; |
300 | | /** |
301 | | * if cross origin pushes should be authorized |
302 | | */ |
303 | | unsigned allow_cross_origin_push : 1; |
304 | | /** |
305 | | * casper settings |
306 | | */ |
307 | | h2o_casper_conf_t casper; |
308 | | } http2; |
309 | | }; |
310 | | |
311 | | typedef h2o_iovec_t (*final_status_handler_cb)(void *ctx, h2o_globalconf_t *gconf, h2o_req_t *req); |
312 | | typedef const struct st_h2o_status_handler_t { |
313 | | h2o_iovec_t name; |
314 | | h2o_iovec_t (*final)(void *ctx, h2o_globalconf_t *gconf, h2o_req_t *req); /* mandatory, will be passed the optional context */ |
315 | | void *(*init)(void); /* optional callback, allocates a context that will be passed to per_thread() */ |
316 | | void (*per_thread)(void *priv, h2o_context_t *ctx); /* optional callback, will be called for each thread */ |
317 | | } h2o_status_handler_t; |
318 | | |
319 | | typedef H2O_VECTOR(h2o_status_handler_t *) h2o_status_callbacks_t; |
320 | | |
321 | | typedef enum h2o_send_informational_mode { |
322 | | H2O_SEND_INFORMATIONAL_MODE_EXCEPT_H1, |
323 | | H2O_SEND_INFORMATIONAL_MODE_NONE, |
324 | | H2O_SEND_INFORMATIONAL_MODE_ALL |
325 | | } h2o_send_informational_mode_t; |
326 | | |
327 | | /** |
328 | | * If zero copy should be used. "Always" indicates to the proxy handler that pipe-backed vectors should be used even when the http |
329 | | * protocol handler does not support zerocopy. This mode delays the load of content to userspace, at the cost of moving around |
330 | | * memory page between the socket connected to the origin and the pipe. |
331 | | */ |
332 | | typedef enum h2o_proxy_zerocopy_mode { |
333 | | H2O_PROXY_ZEROCOPY_DISABLED, |
334 | | H2O_PROXY_ZEROCOPY_ENABLED, |
335 | | H2O_PROXY_ZEROCOPY_ALWAYS |
336 | | } h2o_proxy_zerocopy_mode_t; |
337 | | |
338 | | struct st_h2o_globalconf_t { |
339 | | /** |
340 | | * a NULL-terminated list of host contexts (h2o_hostconf_t) |
341 | | */ |
342 | | h2o_hostconf_t **hosts; |
343 | | /** |
344 | | * The hostconf that will be used when none of the hostconfs for the listener match the request and they all have strict-match: |
345 | | * ON. |
346 | | */ |
347 | | h2o_hostconf_t *fallback_host; |
348 | | /** |
349 | | * list of configurators |
350 | | */ |
351 | | h2o_linklist_t configurators; |
352 | | /** |
353 | | * name of the server (not the hostname) |
354 | | */ |
355 | | h2o_iovec_t server_name; |
356 | | /** |
357 | | * formated "sf-token" or "sf-string" for the proxy-status header |
358 | | */ |
359 | | h2o_iovec_t proxy_status_identity; |
360 | | /** |
361 | | * maximum size of the accepted request entity (e.g. POST data) |
362 | | */ |
363 | | size_t max_request_entity_size; |
364 | | /** |
365 | | * maximum count for delegations |
366 | | */ |
367 | | unsigned max_delegations; |
368 | | /** |
369 | | * maximum count for reprocesses |
370 | | */ |
371 | | unsigned max_reprocesses; |
372 | | /** |
373 | | * setuid user (or NULL) |
374 | | */ |
375 | | char *user; |
376 | | /** |
377 | | * sets up the h2o_return map if true. |
378 | | */ |
379 | | int usdt_selective_tracing; |
380 | | |
381 | | /** |
382 | | * SSL handshake timeout |
383 | | */ |
384 | | uint64_t handshake_timeout; |
385 | | |
386 | | struct { |
387 | | /** |
388 | | * request timeout (in milliseconds) |
389 | | */ |
390 | | uint64_t req_timeout; |
391 | | /** |
392 | | * request io timeout (in milliseconds) |
393 | | */ |
394 | | uint64_t req_io_timeout; |
395 | | /** |
396 | | * a boolean value indicating whether or not to upgrade to HTTP/2 |
397 | | */ |
398 | | int upgrade_to_http2; |
399 | | } http1; |
400 | | |
401 | | struct { |
402 | | /** |
403 | | * idle timeout (in milliseconds) |
404 | | */ |
405 | | uint64_t idle_timeout; |
406 | | /** |
407 | | * graceful shutdown timeout (in milliseconds) |
408 | | */ |
409 | | uint64_t graceful_shutdown_timeout; |
410 | | /** |
411 | | * maximum number of HTTP2 requests (per connection) to be handled simultaneously internally. |
412 | | * H2O accepts at most 256 requests over HTTP/2, but internally limits the number of in-flight requests to the value |
413 | | * specified by this property in order to limit the resources allocated to a single connection. |
414 | | */ |
415 | | size_t max_concurrent_requests_per_connection; |
416 | | /** |
417 | | * maximum number of HTTP2 streaming requests (per connection) to be handled simultaneously internally. |
418 | | */ |
419 | | size_t max_concurrent_streaming_requests_per_connection; |
420 | | /** |
421 | | * maximum nuber of streams (per connection) to be allowed in IDLE / CLOSED state (used for tracking dependencies). |
422 | | */ |
423 | | size_t max_streams_for_priority; |
424 | | /** |
425 | | * size of the stream-level flow control window (once it becomes active) |
426 | | */ |
427 | | uint32_t active_stream_window_size; |
428 | | /** |
429 | | * conditions for latency optimization |
430 | | */ |
431 | | h2o_socket_latency_optimization_conditions_t latency_optimization; |
432 | | /* */ |
433 | | h2o_iovec_t origin_frame; |
434 | | } http2; |
435 | | |
436 | | struct { |
437 | | /** |
438 | | * idle timeout (in milliseconds) |
439 | | */ |
440 | | uint64_t idle_timeout; |
441 | | /** |
442 | | * graceful shutdown timeout (in milliseconds) |
443 | | */ |
444 | | uint64_t graceful_shutdown_timeout; |
445 | | /** |
446 | | * receive window size of the unblocked request stream |
447 | | */ |
448 | | uint32_t active_stream_window_size; |
449 | | /** |
450 | | * See quicly_context_t::ack_frequency |
451 | | */ |
452 | | uint16_t ack_frequency; |
453 | | /** |
454 | | * a boolean indicating if the delayed ack extension should be used (default true) |
455 | | */ |
456 | | uint8_t allow_delayed_ack : 1; |
457 | | /** |
458 | | * a boolean indicating if UDP GSO should be used when possible |
459 | | */ |
460 | | uint8_t use_gso : 1; |
461 | | } http3; |
462 | | |
463 | | struct { |
464 | | /** |
465 | | * io timeout (in milliseconds) |
466 | | */ |
467 | | uint64_t io_timeout; |
468 | | /** |
469 | | * io timeout (in milliseconds) |
470 | | */ |
471 | | uint64_t connect_timeout; |
472 | | /** |
473 | | * io timeout (in milliseconds) |
474 | | */ |
475 | | uint64_t first_byte_timeout; |
476 | | /** |
477 | | * keepalive timeout (in milliseconds) |
478 | | */ |
479 | | uint64_t keepalive_timeout; |
480 | | /** |
481 | | * a boolean flag if set to true, instructs the proxy to preserve the x-forwarded-proto header passed by the client |
482 | | */ |
483 | | unsigned preserve_x_forwarded_proto : 1; |
484 | | /** |
485 | | * a boolean flag if set to true, instructs the proxy to preserve the server header passed by the origin |
486 | | */ |
487 | | unsigned preserve_server_header : 1; |
488 | | /** |
489 | | * a boolean flag if set to true, instructs the proxy to emit x-forwarded-proto and x-forwarded-for headers |
490 | | */ |
491 | | unsigned emit_x_forwarded_headers : 1; |
492 | | /** |
493 | | * a boolean flag if set to true, instructs the proxy to emit a via header |
494 | | */ |
495 | | unsigned emit_via_header : 1; |
496 | | /** |
497 | | * a boolean flag if set to true, instructs the proxy to emit a date header, if it's missing from the upstream response |
498 | | */ |
499 | | unsigned emit_missing_date_header : 1; |
500 | | /** |
501 | | * maximum size to buffer for the response |
502 | | */ |
503 | | size_t max_buffer_size; |
504 | | /** |
505 | | * a boolean flag if set to true, instructs to use zero copy (i.e., splice to pipe then splice to socket) if possible |
506 | | */ |
507 | | h2o_proxy_zerocopy_mode_t zerocopy; |
508 | | |
509 | | struct { |
510 | | uint32_t max_concurrent_streams; |
511 | | } http2; |
512 | | |
513 | | /** |
514 | | * See the documentation of `h2o_httpclient_t::protocol_selector.ratio`. |
515 | | */ |
516 | | struct { |
517 | | int8_t http2; |
518 | | int8_t http3; |
519 | | } protocol_ratio; |
520 | | |
521 | | /** |
522 | | * global socketpool |
523 | | */ |
524 | | h2o_socketpool_t global_socketpool; |
525 | | } proxy; |
526 | | |
527 | | /** |
528 | | * enum indicating to what clients h2o sends 1xx response |
529 | | */ |
530 | | h2o_send_informational_mode_t send_informational_mode; |
531 | | |
532 | | /** |
533 | | * mimemap |
534 | | */ |
535 | | h2o_mimemap_t *mimemap; |
536 | | |
537 | | /** |
538 | | * filecache |
539 | | */ |
540 | | struct { |
541 | | /* capacity of the filecache */ |
542 | | size_t capacity; |
543 | | } filecache; |
544 | | |
545 | | /* status */ |
546 | | h2o_status_callbacks_t statuses; |
547 | | |
548 | | size_t _num_config_slots; |
549 | | }; |
550 | | |
551 | | enum { |
552 | | H2O_COMPRESS_HINT_AUTO = 0, /* default: let h2o negociate compression based on the configuration */ |
553 | | H2O_COMPRESS_HINT_DISABLE, /* compression was explicitly disabled for this request */ |
554 | | H2O_COMPRESS_HINT_ENABLE, /* compression was explicitly enabled for this request */ |
555 | | H2O_COMPRESS_HINT_ENABLE_GZIP, /* compression was explicitly enabled for this request, asking for gzip */ |
556 | | H2O_COMPRESS_HINT_ENABLE_BR, /* compression was explicitly enabled for this request, asking for br */ |
557 | | }; |
558 | | |
559 | | /** |
560 | | * holds various attributes related to the mime-type |
561 | | */ |
562 | | typedef struct st_h2o_mime_attributes_t { |
563 | | /** |
564 | | * whether if the content can be compressed by using gzip |
565 | | */ |
566 | | char is_compressible; |
567 | | /** |
568 | | * how the resource should be prioritized |
569 | | */ |
570 | | enum { H2O_MIME_ATTRIBUTE_PRIORITY_NORMAL = 0, H2O_MIME_ATTRIBUTE_PRIORITY_HIGHEST } priority; |
571 | | } h2o_mime_attributes_t; |
572 | | |
573 | | extern h2o_mime_attributes_t h2o_mime_attributes_as_is; |
574 | | |
575 | | /** |
576 | | * represents either a mime-type (and associated info), or contains pathinfo in case of a dynamic type (e.g. .php files) |
577 | | */ |
578 | | typedef struct st_h2o_mimemap_type_t { |
579 | | enum { H2O_MIMEMAP_TYPE_MIMETYPE = 0, H2O_MIMEMAP_TYPE_DYNAMIC = 1 } type; |
580 | | union { |
581 | | struct { |
582 | | h2o_iovec_t mimetype; |
583 | | h2o_mime_attributes_t attr; |
584 | | }; |
585 | | struct { |
586 | | h2o_pathconf_t pathconf; |
587 | | } dynamic; |
588 | | } data; |
589 | | } h2o_mimemap_type_t; |
590 | | |
591 | | enum { |
592 | | /* http1 protocol errors */ |
593 | | H2O_STATUS_ERROR_400 = 0, |
594 | | H2O_STATUS_ERROR_401, |
595 | | H2O_STATUS_ERROR_403, |
596 | | H2O_STATUS_ERROR_404, |
597 | | H2O_STATUS_ERROR_405, |
598 | | H2O_STATUS_ERROR_413, |
599 | | H2O_STATUS_ERROR_416, |
600 | | H2O_STATUS_ERROR_417, |
601 | | H2O_STATUS_ERROR_421, |
602 | | H2O_STATUS_ERROR_500, |
603 | | H2O_STATUS_ERROR_502, |
604 | | H2O_STATUS_ERROR_503, |
605 | | H2O_STATUS_ERROR_MAX, |
606 | | }; |
607 | | |
608 | | /** |
609 | | * holds various data related to the context |
610 | | */ |
611 | | typedef struct st_h2o_context_storage_item_t { |
612 | | void (*dispose)(void *data); |
613 | | void *data; |
614 | | } h2o_context_storage_item_t; |
615 | | |
616 | | typedef H2O_VECTOR(h2o_context_storage_item_t) h2o_context_storage_t; |
617 | | |
618 | | typedef enum h2o_conn_state { |
619 | | H2O_CONN_STATE_IDLE, |
620 | | H2O_CONN_STATE_ACTIVE, |
621 | | H2O_CONN_STATE_SHUTDOWN, |
622 | | } h2o_conn_state_t; |
623 | | |
624 | | /** |
625 | | * context of the http server. |
626 | | */ |
627 | | struct st_h2o_context_t { |
628 | | /** |
629 | | * points to the loop (either uv_loop_t or h2o_evloop_t, depending on the value of H2O_USE_LIBUV) |
630 | | */ |
631 | | h2o_loop_t *loop; |
632 | | /** |
633 | | * pointer to the global configuration |
634 | | */ |
635 | | h2o_globalconf_t *globalconf; |
636 | | /** |
637 | | * queue for receiving messages from other contexts |
638 | | */ |
639 | | h2o_multithread_queue_t *queue; |
640 | | /** |
641 | | * receivers |
642 | | */ |
643 | | struct { |
644 | | h2o_multithread_receiver_t hostinfo_getaddr; |
645 | | } receivers; |
646 | | /** |
647 | | * open file cache |
648 | | */ |
649 | | h2o_filecache_t *filecache; |
650 | | /** |
651 | | * context scope storage for general use |
652 | | */ |
653 | | h2o_context_storage_t storage; |
654 | | /** |
655 | | * flag indicating if shutdown has been requested |
656 | | */ |
657 | | int shutdown_requested; |
658 | | /** |
659 | | * connection states |
660 | | */ |
661 | | struct { |
662 | | /** |
663 | | * link-list of h2o_conn_t |
664 | | * |
665 | | * list of connections in each state |
666 | | * |
667 | | * idle: |
668 | | * - newly created connections are `idle` |
669 | | * - `idle` connections become `active` as they receive requests |
670 | | * - `active` connections become `idle` when there are no pending requests |
671 | | * active: |
672 | | * - connections that contain pending requests |
673 | | * shutdown: |
674 | | * - connections that are shutting down |
675 | | */ |
676 | | h2o_linklist_t idle, active, shutdown; |
677 | | /** |
678 | | * number of connections in each state |
679 | | */ |
680 | | union { |
681 | | /** |
682 | | * counters (the order MUST match that of h2o_connection_state_t; it is accessed by index via the use of counters[]) |
683 | | */ |
684 | | struct { |
685 | | size_t idle, active, shutdown; |
686 | | }; |
687 | | size_t counters[1]; |
688 | | } num_conns; |
689 | | } _conns; |
690 | | struct { |
691 | | |
692 | | struct { |
693 | | uint64_t request_timeouts; |
694 | | uint64_t request_io_timeouts; |
695 | | } events; |
696 | | } http1; |
697 | | |
698 | | struct { |
699 | | struct { |
700 | | /** |
701 | | * counter for http2 errors internally emitted by h2o |
702 | | */ |
703 | | uint64_t protocol_level_errors[H2O_HTTP2_ERROR_MAX]; |
704 | | /** |
705 | | * premature close on read |
706 | | */ |
707 | | uint64_t read_closed; |
708 | | /** |
709 | | * premature close on write |
710 | | */ |
711 | | uint64_t write_closed; |
712 | | /** |
713 | | * counter for http2 idle timeouts |
714 | | */ |
715 | | uint64_t idle_timeouts; |
716 | | /** |
717 | | * streaming request counter |
718 | | */ |
719 | | uint64_t streaming_requests; |
720 | | } events; |
721 | | } http2; |
722 | | |
723 | | struct { |
724 | | struct { |
725 | | /** |
726 | | * number of packets forwarded to another node in a cluster |
727 | | */ |
728 | | uint64_t packet_forwarded; |
729 | | /** |
730 | | * number of forwarded packets received from another node in a cluster |
731 | | */ |
732 | | uint64_t forwarded_packet_received; |
733 | | } events; |
734 | | } http3; |
735 | | |
736 | | struct { |
737 | | /** |
738 | | * the default client context for proxy |
739 | | */ |
740 | | h2o_httpclient_ctx_t client_ctx; |
741 | | /** |
742 | | * the default connection pool for proxy |
743 | | */ |
744 | | h2o_httpclient_connection_pool_t connpool; |
745 | | } proxy; |
746 | | |
747 | | struct { |
748 | | /** |
749 | | * counter for SSL errors |
750 | | */ |
751 | | uint64_t errors; |
752 | | /** |
753 | | * counter for selected ALPN protocols |
754 | | */ |
755 | | uint64_t alpn_h1; |
756 | | uint64_t alpn_h2; |
757 | | /** |
758 | | * counter for handshakes |
759 | | */ |
760 | | uint64_t handshake_full; |
761 | | uint64_t handshake_resume; |
762 | | /** |
763 | | * summations of handshake latency in microsecond |
764 | | */ |
765 | | uint64_t handshake_accum_time_full; |
766 | | uint64_t handshake_accum_time_resume; |
767 | | } ssl; |
768 | | |
769 | | /** |
770 | | * aggregated quic stats |
771 | | */ |
772 | | h2o_quic_stats_t quic_stats; |
773 | | |
774 | | /** |
775 | | * connection stats |
776 | | */ |
777 | | struct { |
778 | | uint64_t idle_closed; |
779 | | } connection_stats; |
780 | | |
781 | | /** |
782 | | * pointer to per-module configs |
783 | | */ |
784 | | void **_module_configs; |
785 | | |
786 | | struct { |
787 | | struct timeval tv_at; |
788 | | h2o_timestamp_string_t *value; |
789 | | } _timestamp_cache; |
790 | | |
791 | | /** |
792 | | * counter for http1 error status internally emitted by h2o |
793 | | */ |
794 | | uint64_t emitted_error_status[H2O_STATUS_ERROR_MAX]; |
795 | | |
796 | | H2O_VECTOR(h2o_pathconf_t *) _pathconfs_inited; |
797 | | }; |
798 | | |
799 | | /** |
800 | | * an object that generates a response. |
801 | | * The object is typically constructed by handlers calling the h2o_start_response function. |
802 | | */ |
803 | | typedef struct st_h2o_generator_t { |
804 | | /** |
805 | | * called by the core to request new data to be pushed via the h2o_send function. |
806 | | */ |
807 | | void (*proceed)(struct st_h2o_generator_t *self, h2o_req_t *req); |
808 | | /** |
809 | | * called by the core when there is a need to terminate the response abruptly |
810 | | */ |
811 | | void (*stop)(struct st_h2o_generator_t *self, h2o_req_t *req); |
812 | | } h2o_generator_t; |
813 | | |
814 | | /** |
815 | | * an output stream that may alter the output. |
816 | | * The object is typically constructed by filters calling the h2o_prepend_ostream function. |
817 | | */ |
818 | | struct st_h2o_ostream_t { |
819 | | /** |
820 | | * points to the next output stream |
821 | | */ |
822 | | struct st_h2o_ostream_t *next; |
823 | | /** |
824 | | * called by the core to send output. |
825 | | * Intermediary output streams should process the given output and call the h2o_ostream_send_next function if any data can be |
826 | | * sent. |
827 | | */ |
828 | | void (*do_send)(struct st_h2o_ostream_t *self, h2o_req_t *req, h2o_sendvec_t *bufs, size_t bufcnt, h2o_send_state_t state); |
829 | | /** |
830 | | * called by the core when there is a need to terminate the response abruptly |
831 | | */ |
832 | | void (*stop)(struct st_h2o_ostream_t *self, h2o_req_t *req); |
833 | | /** |
834 | | * called by the core via h2o_send_informational |
835 | | */ |
836 | | void (*send_informational)(struct st_h2o_ostream_t *self, h2o_req_t *req); |
837 | | }; |
838 | | |
839 | | /** |
840 | | * a HTTP response |
841 | | */ |
842 | | typedef struct st_h2o_res_t { |
843 | | /** |
844 | | * status code |
845 | | */ |
846 | | int status; |
847 | | /** |
848 | | * reason phrase |
849 | | */ |
850 | | const char *reason; |
851 | | /** |
852 | | * length of the content (that is sent as the Content-Length header). |
853 | | * The default value is SIZE_MAX, which means that the length is indeterminate. |
854 | | * Generators should set this value whenever possible. |
855 | | */ |
856 | | size_t content_length; |
857 | | /** |
858 | | * list of response headers |
859 | | */ |
860 | | h2o_headers_t headers; |
861 | | /** |
862 | | * mime-related attributes (may be NULL) |
863 | | */ |
864 | | h2o_mime_attributes_t *mime_attr; |
865 | | /** |
866 | | * retains the original response header before rewritten by ostream filters |
867 | | */ |
868 | | struct { |
869 | | int status; |
870 | | h2o_headers_t headers; |
871 | | } original; |
872 | | } h2o_res_t; |
873 | | |
874 | | /** |
875 | | * debug state (currently only for HTTP/2) |
876 | | */ |
877 | | typedef struct st_h2o_http2_debug_state_t { |
878 | | h2o_iovec_vector_t json; |
879 | | ssize_t conn_flow_in; |
880 | | ssize_t conn_flow_out; |
881 | | } h2o_http2_debug_state_t; |
882 | | |
883 | | typedef struct st_h2o_conn_callbacks_t { |
884 | | /** |
885 | | * getsockname (return size of the obtained address, or 0 if failed) |
886 | | */ |
887 | | socklen_t (*get_sockname)(h2o_conn_t *conn, struct sockaddr *sa); |
888 | | /** |
889 | | * getpeername (return size of the obtained address, or 0 if failed) |
890 | | */ |
891 | | socklen_t (*get_peername)(h2o_conn_t *conn, struct sockaddr *sa); |
892 | | /** |
893 | | * returns picotls connection object used by the connection (or NULL if TLS is not used) |
894 | | */ |
895 | | ptls_t *(*get_ptls)(h2o_conn_t *conn); |
896 | | /** |
897 | | * returns if the connection is target of tracing |
898 | | */ |
899 | | int (*skip_tracing)(h2o_conn_t *conn); |
900 | | /** |
901 | | * optional (i.e. may be NULL) callback for server push |
902 | | */ |
903 | | void (*push_path)(h2o_req_t *req, const char *abspath, size_t abspath_len, int is_critical); |
904 | | /** |
905 | | * debug state callback (optional) |
906 | | */ |
907 | | h2o_http2_debug_state_t *(*get_debug_state)(h2o_req_t *req, int hpack_enabled); |
908 | | /** |
909 | | * returns number of closed idle connections |
910 | | */ |
911 | | void (*close_idle_connection)(h2o_conn_t *conn); |
912 | | /** |
913 | | * shutdown of connection is requested |
914 | | */ |
915 | | void (*request_shutdown)(h2o_conn_t *conn); |
916 | | /** |
917 | | * for each request |
918 | | */ |
919 | | int (*foreach_request)(h2o_conn_t *conn, int (*cb)(h2o_req_t *req, void *cbdata), void *cbdata); |
920 | | /** |
921 | | * returns number of requests inflight (optional, only supported by H2, H3) |
922 | | */ |
923 | | uint32_t (*num_reqs_inflight)(h2o_conn_t *conn); |
924 | | /** |
925 | | * optional callbacks that return the tracer registry |
926 | | */ |
927 | | quicly_tracer_t *(*get_tracer)(h2o_conn_t *conn); |
928 | | /** |
929 | | * An optional callback reporting an RTT estimate between the HTTP server and the HTTP client, measured in microseconds. At the |
930 | | * moment, this callback is available only for HTTP/2. For HTTP/2, time difference between when the SETTINGS frame was sent and |
931 | | * when a SETTINGS-ack was received is used as the estimate. The callback will return a negative value if the information is not |
932 | | * yet available. |
933 | | */ |
934 | | int64_t (*get_rtt)(h2o_conn_t *conn); |
935 | | /** |
936 | | * optional callback that returns if zero copy is supported by the HTTP handler |
937 | | */ |
938 | | int (*can_zerocopy)(h2o_conn_t *conn); |
939 | | /** |
940 | | * Mandatory callback that returns a number identifying the request of a particular connection (e.g., HTTP/2 stream ID) |
941 | | */ |
942 | | uint64_t (*get_req_id)(h2o_req_t *req); |
943 | | /** |
944 | | * logging callbacks (all of them are optional) |
945 | | */ |
946 | | union { |
947 | | struct { |
948 | | h2o_iovec_t (*extensible_priorities)(h2o_req_t *req); |
949 | | struct { |
950 | | h2o_iovec_t (*cc_name)(h2o_req_t *req); |
951 | | h2o_iovec_t (*delivery_rate)(h2o_req_t *req); |
952 | | } transport; |
953 | | struct { |
954 | | h2o_iovec_t (*protocol_version)(h2o_req_t *req); |
955 | | h2o_iovec_t (*session_reused)(h2o_req_t *req); |
956 | | h2o_iovec_t (*cipher)(h2o_req_t *req); |
957 | | h2o_iovec_t (*cipher_bits)(h2o_req_t *req); |
958 | | h2o_iovec_t (*session_id)(h2o_req_t *req); |
959 | | h2o_iovec_t (*server_name)(h2o_req_t *req); |
960 | | h2o_iovec_t (*negotiated_protocol)(h2o_req_t *req); |
961 | | h2o_iovec_t (*ech_config_id)(h2o_req_t *req); |
962 | | h2o_iovec_t (*ech_kem)(h2o_req_t *req); |
963 | | h2o_iovec_t (*ech_cipher)(h2o_req_t *req); |
964 | | h2o_iovec_t (*ech_cipher_bits)(h2o_req_t *req); |
965 | | h2o_iovec_t (*backend)(h2o_req_t *req); |
966 | | } ssl; |
967 | | struct { |
968 | | h2o_iovec_t (*request_index)(h2o_req_t *req); |
969 | | } http1; |
970 | | struct { |
971 | | h2o_iovec_t (*stream_id)(h2o_req_t *req); |
972 | | h2o_iovec_t (*priority_received)(h2o_req_t *req); |
973 | | h2o_iovec_t (*priority_received_exclusive)(h2o_req_t *req); |
974 | | h2o_iovec_t (*priority_received_parent)(h2o_req_t *req); |
975 | | h2o_iovec_t (*priority_received_weight)(h2o_req_t *req); |
976 | | h2o_iovec_t (*priority_actual)(h2o_req_t *req); |
977 | | h2o_iovec_t (*priority_actual_parent)(h2o_req_t *req); |
978 | | h2o_iovec_t (*priority_actual_weight)(h2o_req_t *req); |
979 | | } http2; |
980 | | struct { |
981 | | h2o_iovec_t (*stream_id)(h2o_req_t *req); |
982 | | h2o_iovec_t (*quic_stats)(h2o_req_t *req); |
983 | | h2o_iovec_t (*quic_version)(h2o_req_t *req); |
984 | | } http3; |
985 | | }; |
986 | | h2o_iovec_t (*callbacks[1])(h2o_req_t *req); |
987 | | } log_; |
988 | | } h2o_conn_callbacks_t; |
989 | | |
990 | | /** |
991 | | * basic structure of an HTTP connection (HTTP/1, HTTP/2, etc.) |
992 | | */ |
993 | | struct st_h2o_conn_t { |
994 | | /** |
995 | | * the context of the server |
996 | | */ |
997 | | h2o_context_t *ctx; |
998 | | /** |
999 | | * NULL-terminated list of hostconfs bound to the connection |
1000 | | */ |
1001 | | h2o_hostconf_t **hosts; |
1002 | | /** |
1003 | | * time when the connection was established |
1004 | | */ |
1005 | | struct timeval connected_at; |
1006 | | /** |
1007 | | * connection id |
1008 | | */ |
1009 | | uint64_t id; |
1010 | | /** |
1011 | | * callbacks |
1012 | | */ |
1013 | | const h2o_conn_callbacks_t *callbacks; |
1014 | | /** |
1015 | | * connection UUID (UUIDv4 in the string representation). |
1016 | | */ |
1017 | | struct { |
1018 | | char str[H2O_UUID_STR_RFC4122_LEN + 1]; |
1019 | | uint8_t is_initialized; |
1020 | | } _uuid; |
1021 | | h2o_conn_state_t state; |
1022 | | /* internal structure */ |
1023 | | h2o_linklist_t _conns; |
1024 | | }; |
1025 | | |
1026 | 0 | #define NOPAREN(...) __VA_ARGS__ |
1027 | | #define H2O_CONN_LIST_FOREACH(decl_var, conn_list, block) \ |
1028 | 0 | do { \ |
1029 | 0 | h2o_linklist_t *_conn_list[] = NOPAREN conn_list; \ |
1030 | 0 | size_t conn_list_len = PTLS_ELEMENTSOF(_conn_list); \ |
1031 | 0 | h2o_linklist_t **_conn_list_iter = (_conn_list); \ |
1032 | 0 | for (size_t i = 0; i < conn_list_len; i++) { \ |
1033 | 0 | for (h2o_linklist_t *_node = _conn_list_iter[i]->next, *_node_next; _node != _conn_list_iter[i]; _node = _node_next) { \ |
1034 | 0 | _node_next = _node->next; \ |
1035 | 0 | h2o_conn_t *_h2o_conn = H2O_STRUCT_FROM_MEMBER(h2o_conn_t, _conns, _node); \ |
1036 | 0 | decl_var = (void *)_h2o_conn; \ |
1037 | 0 | { \ |
1038 | 0 | block \ |
1039 | 0 | } \ |
1040 | 0 | } \ |
1041 | 0 | } \ |
1042 | 0 | } while (0) |
1043 | | |
1044 | | /** |
1045 | | * filter used for capturing a response (can be used to implement subreq) |
1046 | | */ |
1047 | | typedef struct st_h2o_req_prefilter_t { |
1048 | | struct st_h2o_req_prefilter_t *next; |
1049 | | void (*on_setup_ostream)(struct st_h2o_req_prefilter_t *self, h2o_req_t *req, h2o_ostream_t **slot); |
1050 | | } h2o_req_prefilter_t; |
1051 | | |
1052 | | typedef struct st_h2o_req_overrides_t { |
1053 | | /** |
1054 | | * specific client context (or NULL) |
1055 | | */ |
1056 | | h2o_httpclient_ctx_t *client_ctx; |
1057 | | /** |
1058 | | * connpool to be used when connecting to upstream (or NULL) |
1059 | | */ |
1060 | | h2o_httpclient_connection_pool_t *connpool; |
1061 | | /** |
1062 | | * upstream to connect to (or NULL) |
1063 | | */ |
1064 | | h2o_url_t *upstream; |
1065 | | /** |
1066 | | * parameters for rewriting the `Location` header (only used if match.len != 0) |
1067 | | */ |
1068 | | struct { |
1069 | | /** |
1070 | | * if the prefix of the location header matches the url, then the header will be rewritten |
1071 | | */ |
1072 | | h2o_url_t *match; |
1073 | | /** |
1074 | | * path prefix to be inserted upon rewrite |
1075 | | */ |
1076 | | h2o_iovec_t path_prefix; |
1077 | | } location_rewrite; |
1078 | | /** |
1079 | | * whether if the PROXY header should be sent |
1080 | | */ |
1081 | | unsigned use_proxy_protocol : 1; |
1082 | | /** |
1083 | | * whether the proxied request should preserve host |
1084 | | */ |
1085 | | unsigned proxy_preserve_host : 1; |
1086 | | /** |
1087 | | * a boolean flag if set to true, instructs the proxy to close the frontend h1 connection on behalf of the upstream |
1088 | | */ |
1089 | | unsigned forward_close_connection : 1; |
1090 | | /** |
1091 | | * headers rewrite commands to be used when sending requests to upstream (or NULL) |
1092 | | */ |
1093 | | h2o_headers_command_t *headers_cmds; |
1094 | | } h2o_req_overrides_t; |
1095 | | |
1096 | | /** |
1097 | | * additional information for extension-based dynamic content |
1098 | | */ |
1099 | | typedef struct st_h2o_filereq_t { |
1100 | | h2o_iovec_t script_name; |
1101 | | h2o_iovec_t path_info; |
1102 | | h2o_iovec_t local_path; |
1103 | | } h2o_filereq_t; |
1104 | | |
1105 | | /** |
1106 | | * Called be the protocol handler to submit chunk of request body to the generator. The callback returns 0 if successful, otherwise |
1107 | | * a non-zero value. Once `write_req.cb` is called, subsequent invocations MUST be postponed until the `proceed_req` is called. At |
1108 | | * the moment, `write_req_cb` is required to create a copy of data being provided before returning. To avoid copying, we should |
1109 | | * consider delegating the responsibility of retaining the buffer to the caller. |
1110 | | */ |
1111 | | typedef int (*h2o_write_req_cb)(void *ctx, int is_end_stream); |
1112 | | /** |
1113 | | * Called by the generator, in response to `h2o_write_req_cb` to indicate to the protocol handler that new chunk can be submitted, |
1114 | | * or to notify that an error has occurred. In the latter case, write might not be inflight. Note that `errstr` will be NULL (rather |
1115 | | * than an error code indicating EOS) when called in response to `h2o_write_req_cb` with `is_end_stream` set to 1. |
1116 | | */ |
1117 | | typedef void (*h2o_proceed_req_cb)(h2o_req_t *req, const char *errstr); |
1118 | | /** |
1119 | | * |
1120 | | */ |
1121 | | typedef void (*h2o_forward_datagram_cb)(h2o_req_t *req, h2o_iovec_t *datagrams, size_t num_datagrams); |
1122 | | |
1123 | 0 | #define H2O_SEND_SERVER_TIMING_BASIC 1 |
1124 | 0 | #define H2O_SEND_SERVER_TIMING_PROXY 2 |
1125 | | |
1126 | | /** |
1127 | | * a HTTP request |
1128 | | */ |
1129 | | struct st_h2o_req_t { |
1130 | | /** |
1131 | | * the underlying connection |
1132 | | */ |
1133 | | h2o_conn_t *conn; |
1134 | | /** |
1135 | | * the request sent by the client (as is) |
1136 | | */ |
1137 | | struct { |
1138 | | /** |
1139 | | * scheme (http, https, etc.) |
1140 | | */ |
1141 | | const h2o_url_scheme_t *scheme; |
1142 | | /** |
1143 | | * authority (a.k.a. the Host header; the value is supplemented if missing before the handlers are being called) |
1144 | | */ |
1145 | | h2o_iovec_t authority; |
1146 | | /** |
1147 | | * method |
1148 | | */ |
1149 | | h2o_iovec_t method; |
1150 | | /** |
1151 | | * abs-path of the request (unmodified) |
1152 | | */ |
1153 | | h2o_iovec_t path; |
1154 | | /** |
1155 | | * offset of '?' within path, or SIZE_MAX if not found |
1156 | | */ |
1157 | | size_t query_at; |
1158 | | } input; |
1159 | | /** |
1160 | | * the host context |
1161 | | */ |
1162 | | h2o_hostconf_t *hostconf; |
1163 | | /** |
1164 | | * the path context |
1165 | | */ |
1166 | | h2o_pathconf_t *pathconf; |
1167 | | /** |
1168 | | * filters and the size of it |
1169 | | */ |
1170 | | h2o_filter_t **filters; |
1171 | | size_t num_filters; |
1172 | | /** |
1173 | | * loggers and the size of it |
1174 | | */ |
1175 | | h2o_logger_t **loggers; |
1176 | | size_t num_loggers; |
1177 | | /** |
1178 | | * the handler that has been executed |
1179 | | */ |
1180 | | h2o_handler_t *handler; |
1181 | | /** |
1182 | | * scheme (http, https, etc.) |
1183 | | */ |
1184 | | const h2o_url_scheme_t *scheme; |
1185 | | /** |
1186 | | * authority (of the processing request) |
1187 | | */ |
1188 | | h2o_iovec_t authority; |
1189 | | /** |
1190 | | * method (of the processing request) |
1191 | | */ |
1192 | | h2o_iovec_t method; |
1193 | | /** |
1194 | | * abs-path of the processing request |
1195 | | */ |
1196 | | h2o_iovec_t path; |
1197 | | /** |
1198 | | * offset of '?' within path, or SIZE_MAX if not found |
1199 | | */ |
1200 | | size_t query_at; |
1201 | | /** |
1202 | | * normalized path of the processing request (i.e. no "." or "..", no query) |
1203 | | */ |
1204 | | h2o_iovec_t path_normalized; |
1205 | | /** |
1206 | | * Map of indexes of `path_normalized` into the next character in `path`; built only if `path` required normalization |
1207 | | */ |
1208 | | size_t *norm_indexes; |
1209 | | /** |
1210 | | * authority's prefix matched with `*` against defined hosts |
1211 | | */ |
1212 | | h2o_iovec_t authority_wildcard_match; |
1213 | | /** |
1214 | | * filters assigned per request |
1215 | | */ |
1216 | | h2o_req_prefilter_t *prefilters; |
1217 | | /** |
1218 | | * additional information (becomes available for extension-based dynamic content) |
1219 | | */ |
1220 | | h2o_filereq_t *filereq; |
1221 | | /** |
1222 | | * overrides (maybe NULL) |
1223 | | */ |
1224 | | h2o_req_overrides_t *overrides; |
1225 | | /** |
1226 | | * the HTTP version (represented as 0xMMmm (M=major, m=minor)) |
1227 | | */ |
1228 | | int version; |
1229 | | /** |
1230 | | * list of request headers |
1231 | | */ |
1232 | | h2o_headers_t headers; |
1233 | | /** |
1234 | | * the request entity (base == NULL if none), can't be used if the handler is streaming the body |
1235 | | */ |
1236 | | h2o_iovec_t entity; |
1237 | | /** |
1238 | | * amount of request body being received |
1239 | | */ |
1240 | | size_t req_body_bytes_received; |
1241 | | /** |
1242 | | * If different of SIZE_MAX, the numeric value of the received content-length: header |
1243 | | */ |
1244 | | size_t content_length; |
1245 | | /** |
1246 | | * timestamp when the request was processed |
1247 | | */ |
1248 | | h2o_timestamp_t processed_at; |
1249 | | /** |
1250 | | * additional timestamps |
1251 | | */ |
1252 | | struct { |
1253 | | struct timeval request_begin_at; |
1254 | | struct timeval request_body_begin_at; |
1255 | | struct timeval response_start_at; |
1256 | | struct timeval response_end_at; |
1257 | | } timestamps; |
1258 | | /** |
1259 | | * proxy stats |
1260 | | */ |
1261 | | struct { |
1262 | | struct { |
1263 | | uint64_t total; |
1264 | | uint64_t header; |
1265 | | uint64_t body; |
1266 | | } bytes_written; |
1267 | | struct { |
1268 | | uint64_t total; |
1269 | | uint64_t header; |
1270 | | uint64_t body; |
1271 | | } bytes_read; |
1272 | | h2o_httpclient_timings_t timestamps; |
1273 | | h2o_httpclient_conn_properties_t conn; |
1274 | | } proxy_stats; |
1275 | | /** |
1276 | | * the response |
1277 | | */ |
1278 | | h2o_res_t res; |
1279 | | /** |
1280 | | * number of bytes sent by the generator (excluding headers) |
1281 | | */ |
1282 | | uint64_t bytes_sent; |
1283 | | /** |
1284 | | * the number of times the request can be reprocessed (excluding delegation) |
1285 | | */ |
1286 | | unsigned remaining_reprocesses; |
1287 | | /** |
1288 | | * the number of times the request can be delegated |
1289 | | */ |
1290 | | unsigned remaining_delegations; |
1291 | | |
1292 | | /** |
1293 | | * environment variables |
1294 | | */ |
1295 | | h2o_iovec_vector_t env; |
1296 | | |
1297 | | /** |
1298 | | * error log for the request (`h2o_req_log_error` must be used for error logging) |
1299 | | */ |
1300 | | h2o_buffer_t *error_logs; |
1301 | | |
1302 | | /** |
1303 | | * error log redirection called by `h2o_req_log_error`. By default, the error is appended to `error_logs`. The callback is |
1304 | | * replaced by mruby middleware to send the error log to the rack handler. |
1305 | | */ |
1306 | | struct { |
1307 | | void (*cb)(void *data, h2o_iovec_t prefix, h2o_iovec_t msg); |
1308 | | void *data; |
1309 | | } error_log_delegate; |
1310 | | |
1311 | | /* flags */ |
1312 | | |
1313 | | /** |
1314 | | * whether or not the connection is persistent. |
1315 | | * Applications should set this flag to zero in case the connection cannot be kept keep-alive (due to an error etc.) |
1316 | | */ |
1317 | | unsigned char http1_is_persistent : 1; |
1318 | | /** |
1319 | | * whether if the response has been delegated (i.e. reproxied). |
1320 | | * For delegated responses, redirect responses would be handled internally. |
1321 | | */ |
1322 | | unsigned char res_is_delegated : 1; |
1323 | | /** |
1324 | | * set by the generator if the protocol handler should replay the request upon seeing 425 |
1325 | | */ |
1326 | | unsigned char reprocess_if_too_early : 1; |
1327 | | /** |
1328 | | * set by the prxy handler if the http2 upstream refused the stream so the client can retry the request |
1329 | | */ |
1330 | | unsigned char upstream_refused : 1; |
1331 | | /** |
1332 | | * if h2o_process_request has been called |
1333 | | */ |
1334 | | unsigned char process_called : 1; |
1335 | | /** |
1336 | | * Indicates if requested to serve something other than HTTP (e.g., websocket, upgrade, CONNECT, ...) using the streaming API. |
1337 | | * When the protocol handler returns a successful response, filters are skipped. |
1338 | | */ |
1339 | | unsigned char is_tunnel_req : 1; |
1340 | | |
1341 | | /** |
1342 | | * whether if the response should include server-timing header. Logical OR of H2O_SEND_SERVER_TIMING_* |
1343 | | */ |
1344 | | unsigned send_server_timing; |
1345 | | |
1346 | | /** |
1347 | | * Whether the producer of the response has explicitly disabled or |
1348 | | * enabled compression. One of H2O_COMPRESS_HINT_* |
1349 | | */ |
1350 | | char compress_hint; |
1351 | | |
1352 | | /** |
1353 | | * the Upgrade request header (or { NULL, 0 } if not available) |
1354 | | */ |
1355 | | h2o_iovec_t upgrade; |
1356 | | |
1357 | | /** |
1358 | | * preferred chunk size by the ostream |
1359 | | */ |
1360 | | size_t preferred_chunk_size; |
1361 | | |
1362 | | /** |
1363 | | * callback and context for receiving request body (see h2o_handler_t::supports_request_streaming for details) |
1364 | | */ |
1365 | | struct { |
1366 | | h2o_write_req_cb cb; |
1367 | | void *ctx; |
1368 | | } write_req; |
1369 | | |
1370 | | /** |
1371 | | * callback and context for receiving more request body (see h2o_handler_t::supports_request_streaming for details) |
1372 | | */ |
1373 | | h2o_proceed_req_cb proceed_req; |
1374 | | |
1375 | | /** |
1376 | | * Callbacks used for forwarding datagrams. Write-side is assumed to use `write_req.ctx` for retaining the context if necessary. |
1377 | | */ |
1378 | | struct { |
1379 | | h2o_forward_datagram_cb write_, read_; |
1380 | | } forward_datagram; |
1381 | | |
1382 | | /* internal structure */ |
1383 | | h2o_generator_t *_generator; |
1384 | | h2o_ostream_t *_ostr_top; |
1385 | | size_t _next_filter_index; |
1386 | | h2o_timer_t _timeout_entry; |
1387 | | |
1388 | | /* per-request memory pool (placed at the last since the structure is large) */ |
1389 | | h2o_mem_pool_t pool; |
1390 | | }; |
1391 | | |
1392 | | typedef struct st_h2o_accept_ctx_t { |
1393 | | h2o_context_t *ctx; |
1394 | | h2o_hostconf_t **hosts; |
1395 | | SSL_CTX *ssl_ctx; |
1396 | | h2o_iovec_t *http2_origin_frame; |
1397 | | int expect_proxy_line; |
1398 | | h2o_multithread_receiver_t *libmemcached_receiver; |
1399 | | } h2o_accept_ctx_t; |
1400 | | |
1401 | | /* util */ |
1402 | | |
1403 | | extern const char h2o_http2_npn_protocols[]; |
1404 | | extern const char h2o_npn_protocols[]; |
1405 | | extern const h2o_iovec_t h2o_http2_alpn_protocols[]; |
1406 | | extern const h2o_iovec_t h2o_alpn_protocols[]; |
1407 | | |
1408 | | /** |
1409 | | * accepts a connection |
1410 | | */ |
1411 | | void h2o_accept(h2o_accept_ctx_t *ctx, h2o_socket_t *sock); |
1412 | | /** |
1413 | | * creates a new connection |
1414 | | */ |
1415 | | h2o_conn_t *h2o_create_connection(size_t sz, h2o_context_t *ctx, h2o_hostconf_t **hosts, struct timeval connected_at, |
1416 | | const h2o_conn_callbacks_t *callbacks); |
1417 | | /** |
1418 | | * destroys a connection |
1419 | | */ |
1420 | | void h2o_destroy_connection(h2o_conn_t *conn); |
1421 | | /** |
1422 | | * returns the uuid of the connection as a null-terminated string. |
1423 | | */ |
1424 | | static const char *h2o_conn_get_uuid(h2o_conn_t *conn); |
1425 | | /** |
1426 | | * returns if the connection is still in early-data state (i.e., if there is a risk of received requests being a replay) |
1427 | | */ |
1428 | | static int h2o_conn_is_early_data(h2o_conn_t *conn); |
1429 | | /** |
1430 | | * setups accept context for memcached SSL resumption |
1431 | | */ |
1432 | | void h2o_accept_setup_memcached_ssl_resumption(h2o_memcached_context_t *ctx, unsigned expiration); |
1433 | | /** |
1434 | | * setups accept context for redis SSL resumption |
1435 | | */ |
1436 | | void h2o_accept_setup_redis_ssl_resumption(const char *host, uint16_t port, unsigned expiration, const char *prefix); |
1437 | | /** |
1438 | | * returns the protocol version (e.g. "HTTP/1.1", "HTTP/2") |
1439 | | */ |
1440 | | size_t h2o_stringify_protocol_version(char *dst, int version); |
1441 | | /** |
1442 | | * builds the proxy header defined by the PROXY PROTOCOL |
1443 | | */ |
1444 | | size_t h2o_stringify_proxy_header(h2o_conn_t *conn, char *buf); |
1445 | | #define H2O_PROXY_HEADER_MAX_LENGTH \ |
1446 | | (sizeof("PROXY TCP6 ffff:ffff:ffff:ffff:ffff:ffff:ffff:ffff ffff:ffff:ffff:ffff:ffff:ffff:ffff:ffff 65535 65535\r\n") - 1) |
1447 | | /** |
1448 | | * extracts path to be pushed from `Link: rel=preload` header. |
1449 | | */ |
1450 | | void h2o_extract_push_path_from_link_header(h2o_mem_pool_t *pool, const char *value, size_t value_len, h2o_iovec_t base_path, |
1451 | | const h2o_url_scheme_t *input_scheme, h2o_iovec_t input_authority, |
1452 | | const h2o_url_scheme_t *base_scheme, h2o_iovec_t *base_authority, |
1453 | | void (*cb)(void *ctx, const char *path, size_t path_len, int is_critical), void *cb_ctx, |
1454 | | h2o_iovec_t *filtered_value, int allow_cross_origin_push); |
1455 | | /** |
1456 | | * return a bitmap of compressible types, by parsing the `accept-encoding` header |
1457 | | */ |
1458 | | int h2o_get_compressible_types(const h2o_headers_t *headers); |
1459 | 0 | #define H2O_COMPRESSIBLE_GZIP 1 |
1460 | 0 | #define H2O_COMPRESSIBLE_BROTLI 2 |
1461 | | /** |
1462 | | * builds destination URL or path, by contatenating the prefix and path_info of the request |
1463 | | */ |
1464 | | h2o_iovec_t h2o_build_destination(h2o_req_t *req, const char *prefix, size_t prefix_len, int use_path_normalized); |
1465 | | /** |
1466 | | * encodes the duration value of the `server-timing` header |
1467 | | */ |
1468 | | void h2o_add_server_timing_header(h2o_req_t *req, int uses_trailer); |
1469 | | /** |
1470 | | * encodes the duration value of the `server-timing` trailer |
1471 | | */ |
1472 | | h2o_iovec_t h2o_build_server_timing_trailer(h2o_req_t *req, const char *prefix, size_t prefix_len, const char *suffix, |
1473 | | size_t suffix_len); |
1474 | | /** |
1475 | | * Garbage collects resources kept for future reuse in the current thread. If `now` is set to zero, performs full GC. If a valid |
1476 | | * pointer is passed to `ctx_optional`, resource associated to the context will be collected as well. This function returns how long |
1477 | | * the next event loop can block before calling `h2o_cleanup_thread` again, in milliseconds. |
1478 | | */ |
1479 | | uint32_t h2o_cleanup_thread(uint64_t now, h2o_context_t *ctx_optional); |
1480 | | |
1481 | | extern uint64_t h2o_connection_id; |
1482 | | |
1483 | | /* request */ |
1484 | | |
1485 | | /** |
1486 | | * initializes the request structure |
1487 | | * @param req the request structure |
1488 | | * @param conn the underlying connection |
1489 | | * @param src if not NULL, the request structure would be a shallow copy of src |
1490 | | */ |
1491 | | void h2o_init_request(h2o_req_t *req, h2o_conn_t *conn, h2o_req_t *src); |
1492 | | /** |
1493 | | * releases resources allocated for handling a request |
1494 | | */ |
1495 | | void h2o_dispose_request(h2o_req_t *req); |
1496 | | /** |
1497 | | * Checks and returns if pseudo headers meet the constraints. This function should be called by each protocol implementation before |
1498 | | * passing the request to `h2o_process_request`. |
1499 | | */ |
1500 | | int h2o_req_validate_pseudo_headers(h2o_req_t *req); |
1501 | | /** |
1502 | | * called by the connection layer to start processing a request that is ready |
1503 | | */ |
1504 | | void h2o_process_request(h2o_req_t *req); |
1505 | | /** |
1506 | | * returns the first handler that will be used for the request |
1507 | | */ |
1508 | | h2o_handler_t *h2o_get_first_handler(h2o_req_t *req); |
1509 | | /** |
1510 | | * delegates the request to the next handler |
1511 | | */ |
1512 | | void h2o_delegate_request(h2o_req_t *req); |
1513 | | /** |
1514 | | * calls h2o_delegate_request using zero_timeout callback |
1515 | | */ |
1516 | | void h2o_delegate_request_deferred(h2o_req_t *req); |
1517 | | /** |
1518 | | * reprocesses a request once more (used for internal redirection) |
1519 | | */ |
1520 | | void h2o_reprocess_request(h2o_req_t *req, h2o_iovec_t method, const h2o_url_scheme_t *scheme, h2o_iovec_t authority, |
1521 | | h2o_iovec_t path, h2o_req_overrides_t *overrides, int is_delegated); |
1522 | | /** |
1523 | | * calls h2o_reprocess_request using zero_timeout callback |
1524 | | */ |
1525 | | void h2o_reprocess_request_deferred(h2o_req_t *req, h2o_iovec_t method, const h2o_url_scheme_t *scheme, h2o_iovec_t authority, |
1526 | | h2o_iovec_t path, h2o_req_overrides_t *overrides, int is_delegated); |
1527 | | /** |
1528 | | * |
1529 | | */ |
1530 | | void h2o_replay_request(h2o_req_t *req); |
1531 | | /** |
1532 | | * |
1533 | | */ |
1534 | | void h2o_replay_request_deferred(h2o_req_t *req); |
1535 | | /** |
1536 | | * called by handlers to set the generator |
1537 | | * @param req the request |
1538 | | * @param generator the generator |
1539 | | */ |
1540 | | void h2o_start_response(h2o_req_t *req, h2o_generator_t *generator); |
1541 | | /** |
1542 | | * called by filters to insert output-stream filters for modifying the response |
1543 | | * @param req the request |
1544 | | * @param alignment of the memory to be allocated for the ostream filter |
1545 | | * @param size of the memory to be allocated for the ostream filter |
1546 | | * @param slot where the stream should be inserted |
1547 | | * @return pointer to the ostream filter |
1548 | | */ |
1549 | | h2o_ostream_t *h2o_add_ostream(h2o_req_t *req, size_t alignment, size_t sz, h2o_ostream_t **slot); |
1550 | | /** |
1551 | | * prepares the request for processing by looking at the method, URI, headers |
1552 | | */ |
1553 | | h2o_hostconf_t *h2o_req_setup(h2o_req_t *req); |
1554 | | /** |
1555 | | * binds configurations to the request |
1556 | | */ |
1557 | | void h2o_req_bind_conf(h2o_req_t *req, h2o_hostconf_t *hostconf, h2o_pathconf_t *pathconf); |
1558 | | /** |
1559 | | * |
1560 | | */ |
1561 | | static int h2o_send_state_is_in_progress(h2o_send_state_t s); |
1562 | | /** |
1563 | | * called by the generators to send output |
1564 | | * note: generators should free itself after sending the final chunk (i.e. calling the function with is_final set to true) |
1565 | | * @param req the request |
1566 | | * @param bufs an array of buffers |
1567 | | * @param bufcnt length of the buffers array |
1568 | | * @param state describes if the output is final, has an error, or is in progress |
1569 | | */ |
1570 | | void h2o_send(h2o_req_t *req, h2o_iovec_t *bufs, size_t bufcnt, h2o_send_state_t state); |
1571 | | void h2o_sendvec(h2o_req_t *req, h2o_sendvec_t *vecs, size_t veccnt, h2o_send_state_t state); |
1572 | | /** |
1573 | | * creates an uninitialized prefilter and returns pointer to it |
1574 | | */ |
1575 | | h2o_req_prefilter_t *h2o_add_prefilter(h2o_req_t *req, size_t alignment, size_t sz); |
1576 | | /** |
1577 | | * requests the next prefilter or filter (if any) to setup the ostream if necessary |
1578 | | */ |
1579 | | static void h2o_setup_next_prefilter(h2o_req_prefilter_t *self, h2o_req_t *req, h2o_ostream_t **slot); |
1580 | | /** |
1581 | | * requests the next filter (if any) to setup the ostream if necessary |
1582 | | */ |
1583 | | static void h2o_setup_next_ostream(h2o_req_t *req, h2o_ostream_t **slot); |
1584 | | /** |
1585 | | * called by the ostream filters to send output to the next ostream filter |
1586 | | * note: ostream filters should free itself after sending the final chunk (i.e. calling the function with is_final set to true) |
1587 | | * note: ostream filters must not set is_final flag to TRUE unless is_final flag of the do_send callback was set as such |
1588 | | * @param ostr current ostream filter |
1589 | | * @param req the request |
1590 | | * @param bufs an array of buffers |
1591 | | * @param bufcnt length of the buffers array |
1592 | | * @param state whether the output is in progress, final, or in error |
1593 | | */ |
1594 | | void h2o_ostream_send_next(h2o_ostream_t *ostream, h2o_req_t *req, h2o_sendvec_t *bufs, size_t bufcnt, h2o_send_state_t state); |
1595 | | /** |
1596 | | * called by the connection layer to request additional data to the generator |
1597 | | */ |
1598 | | static void h2o_proceed_response(h2o_req_t *req); |
1599 | | void h2o_proceed_response_deferred(h2o_req_t *req); |
1600 | | /** |
1601 | | * if NULL, supplements h2o_req_t::mime_attr |
1602 | | */ |
1603 | | void h2o_req_fill_mime_attributes(h2o_req_t *req); |
1604 | | /** |
1605 | | * returns an environment variable |
1606 | | */ |
1607 | | static h2o_iovec_t *h2o_req_getenv(h2o_req_t *req, const char *name, size_t name_len, int allocate_if_not_found); |
1608 | | /** |
1609 | | * unsets an environment variable |
1610 | | */ |
1611 | | static void h2o_req_unsetenv(h2o_req_t *req, const char *name, size_t name_len); |
1612 | | |
1613 | | /* config */ |
1614 | | |
1615 | | h2o_envconf_t *h2o_config_create_envconf(h2o_envconf_t *src); |
1616 | | void h2o_config_setenv(h2o_envconf_t *envconf, const char *name, const char *value); |
1617 | | void h2o_config_unsetenv(h2o_envconf_t *envconf, const char *name); |
1618 | | |
1619 | | /** |
1620 | | * initializes pathconf |
1621 | | * @param path path to serve, or NULL if fallback or extension-level |
1622 | | * @param mimemap mimemap to use, or NULL if fallback or extension-level |
1623 | | */ |
1624 | | void h2o_config_init_pathconf(h2o_pathconf_t *pathconf, h2o_globalconf_t *globalconf, const char *path, h2o_mimemap_t *mimemap); |
1625 | | /** |
1626 | | * |
1627 | | */ |
1628 | | void h2o_config_dispose_pathconf(h2o_pathconf_t *pathconf); |
1629 | | /** |
1630 | | * initializes the global configuration |
1631 | | */ |
1632 | | void h2o_config_init(h2o_globalconf_t *config); |
1633 | | /** |
1634 | | * registers a host context |
1635 | | */ |
1636 | | h2o_hostconf_t *h2o_config_register_host(h2o_globalconf_t *config, h2o_iovec_t host, uint16_t port); |
1637 | | /** |
1638 | | * registers a path context |
1639 | | * @param hostconf host-level configuration that the path-level configuration belongs to |
1640 | | * @param path path |
1641 | | * @param flags unused and must be set to zero |
1642 | | * |
1643 | | * Handling of the path argument has changed in version 2.0 (of the standard server). |
1644 | | * |
1645 | | * Before 2.0, the function implicitely added a trailing `/` to the supplied path (if it did not end with a `/`), and when receiving |
1646 | | * a HTTP request for a matching path without the trailing `/`, libh2o sent a 301 response redirecting the client to a URI with a |
1647 | | * trailing `/`. |
1648 | | * |
1649 | | * Since 2.0, the function retains the exact path given as the argument, and the handlers of the pathconf is invoked if one of the |
1650 | | * following conditions are met: |
1651 | | * |
1652 | | * * request path is an exact match to the configuration path |
1653 | | * * configuration path does not end with a `/`, and the request path begins with the configuration path followed by a `/` |
1654 | | */ |
1655 | | h2o_pathconf_t *h2o_config_register_path(h2o_hostconf_t *hostconf, const char *path, int flags); |
1656 | | /** |
1657 | | * registers an extra status handler |
1658 | | */ |
1659 | | void h2o_config_register_status_handler(h2o_globalconf_t *config, h2o_status_handler_t *status_handler); |
1660 | | /** |
1661 | | * disposes of the resources allocated for the global configuration |
1662 | | */ |
1663 | | void h2o_config_dispose(h2o_globalconf_t *config); |
1664 | | /** |
1665 | | * creates a handler associated to a given pathconf |
1666 | | */ |
1667 | | h2o_handler_t *h2o_create_handler(h2o_pathconf_t *conf, size_t sz); |
1668 | | /** |
1669 | | * creates a filter associated to a given pathconf |
1670 | | */ |
1671 | | h2o_filter_t *h2o_create_filter(h2o_pathconf_t *conf, size_t sz); |
1672 | | /** |
1673 | | * creates a logger associated to a given pathconf |
1674 | | */ |
1675 | | h2o_logger_t *h2o_create_logger(h2o_pathconf_t *conf, size_t sz); |
1676 | | |
1677 | | /* context */ |
1678 | | |
1679 | | /** |
1680 | | * initializes the context |
1681 | | */ |
1682 | | void h2o_context_init(h2o_context_t *context, h2o_loop_t *loop, h2o_globalconf_t *config); |
1683 | | /** |
1684 | | * disposes of the resources allocated for the context |
1685 | | */ |
1686 | | void h2o_context_dispose(h2o_context_t *context); |
1687 | | /** |
1688 | | * requests shutdown to the connections governed by the context |
1689 | | */ |
1690 | | void h2o_context_request_shutdown(h2o_context_t *context); |
1691 | | /** |
1692 | | * |
1693 | | */ |
1694 | | void h2o_context_init_pathconf_context(h2o_context_t *ctx, h2o_pathconf_t *pathconf); |
1695 | | /** |
1696 | | * |
1697 | | */ |
1698 | | void h2o_context_dispose_pathconf_context(h2o_context_t *ctx, h2o_pathconf_t *pathconf); |
1699 | | |
1700 | | /** |
1701 | | * returns current timestamp |
1702 | | * @param ctx the context |
1703 | | * @param pool memory pool (used when ts != NULL) |
1704 | | * @param ts buffer to store the timestamp (optional) |
1705 | | * @return current time in UTC |
1706 | | */ |
1707 | | static h2o_timestamp_t h2o_get_timestamp(h2o_context_t *ctx, h2o_mem_pool_t *pool); |
1708 | | void h2o_context_update_timestamp_string_cache(h2o_context_t *ctx); |
1709 | | /** |
1710 | | * Closes at most @max_connections_to_close connections that have been inactive for @min_age milliseconds |
1711 | | */ |
1712 | | void h2o_context_close_idle_connections(h2o_context_t *ctx, size_t max_connections_to_close, uint64_t min_age); |
1713 | | /** |
1714 | | * transition connection state |
1715 | | */ |
1716 | | void h2o_conn_set_state(h2o_conn_t *conn, h2o_conn_state_t state); |
1717 | | /** |
1718 | | * returns per-module context set |
1719 | | */ |
1720 | | static void *h2o_context_get_handler_context(h2o_context_t *ctx, h2o_handler_t *handler); |
1721 | | /** |
1722 | | * sets per-module context |
1723 | | */ |
1724 | | static void h2o_context_set_handler_context(h2o_context_t *ctx, h2o_handler_t *handler, void *handler_ctx); |
1725 | | /** |
1726 | | * returns per-module context set by the on_context_init callback |
1727 | | */ |
1728 | | static void *h2o_context_get_filter_context(h2o_context_t *ctx, h2o_filter_t *filter); |
1729 | | /** |
1730 | | * sets per-module filter context |
1731 | | */ |
1732 | | static void h2o_context_set_filter_context(h2o_context_t *ctx, h2o_filter_t *filter, void *filter_ctx); |
1733 | | /** |
1734 | | * returns per-module context set by the on_context_init callback |
1735 | | */ |
1736 | | static void *h2o_context_get_logger_context(h2o_context_t *ctx, h2o_logger_t *logger); |
1737 | | /* |
1738 | | * return the address associated with the key in the context storage |
1739 | | */ |
1740 | | static void **h2o_context_get_storage(h2o_context_t *ctx, size_t *key, void (*dispose_cb)(void *)); |
1741 | | |
1742 | | /* built-in generators */ |
1743 | | |
1744 | | enum { |
1745 | | /** |
1746 | | * enforces the http1 protocol handler to close the connection after sending the response |
1747 | | */ |
1748 | | H2O_SEND_ERROR_HTTP1_CLOSE_CONNECTION = 0x1, |
1749 | | /** |
1750 | | * if set, does not flush the registered response headers |
1751 | | */ |
1752 | | H2O_SEND_ERROR_KEEP_HEADERS = 0x2, |
1753 | | /** |
1754 | | * indicates a broken or incomplete HTTP request, and that some fields of `h2o_req_t` e.g., `input` might be NULL |
1755 | | */ |
1756 | | H2O_SEND_ERROR_BROKEN_REQUEST = 0x04 |
1757 | | }; |
1758 | | |
1759 | | /** |
1760 | | * Add a `date:` header to the response |
1761 | | */ |
1762 | | void h2o_resp_add_date_header(h2o_req_t *req); |
1763 | | /** |
1764 | | * Sends the given string as the response. The function copies the string so that the caller can discard it immediately. |
1765 | | * |
1766 | | * Be careful of calling the function asynchronously, because there is a chance of the request object getting destroyed before the |
1767 | | * function is being invoked. This could happpen for example when the client abruptly closing the connection. There are two ways to |
1768 | | * detect the destruction: |
1769 | | * |
1770 | | * * allocate a memory chunk using the request's memory pool with a destructor that you define; i.e. call `h2o_mem_alloc_shared( |
1771 | | * &req->pool, obj_size, my_destructor)`. When the request object is destroyed, `my_destructor` will be invoked as part of the |
1772 | | * memory reclamation process. |
1773 | | * * register the `stop` callback of the generator that is bound to the request. The downside of the approach is that a generator |
1774 | | * is not associated to a request until all the response headers become ready to be sent, i.e., when `h2o_start_response` is |
1775 | | * called. |
1776 | | */ |
1777 | | void h2o_send_inline(h2o_req_t *req, const char *body, size_t len); |
1778 | | /** |
1779 | | * sends the given information as an error response to the client. Uses h2o_send_inline internally, so the same restrictions apply. |
1780 | | */ |
1781 | | void h2o_send_error_generic(h2o_req_t *req, int status, const char *reason, const char *body, int flags); |
1782 | | #define H2O_SEND_ERROR_XXX(status) \ |
1783 | | static inline void h2o_send_error_##status(h2o_req_t *req, const char *reason, const char *body, int flags) \ |
1784 | 3.55k | { \ |
1785 | 3.55k | req->conn->ctx->emitted_error_status[H2O_STATUS_ERROR_##status]++; \ |
1786 | 3.55k | h2o_send_error_generic(req, status, reason, body, flags); \ |
1787 | 3.55k | } Unexecuted instantiation: driver.cc:h2o_send_error_400(st_h2o_req_t*, char const*, char const*, int) Unexecuted instantiation: driver.cc:h2o_send_error_401(st_h2o_req_t*, char const*, char const*, int) Unexecuted instantiation: driver.cc:h2o_send_error_403(st_h2o_req_t*, char const*, char const*, int) Unexecuted instantiation: driver.cc:h2o_send_error_404(st_h2o_req_t*, char const*, char const*, int) Unexecuted instantiation: driver.cc:h2o_send_error_405(st_h2o_req_t*, char const*, char const*, int) Unexecuted instantiation: driver.cc:h2o_send_error_413(st_h2o_req_t*, char const*, char const*, int) Unexecuted instantiation: driver.cc:h2o_send_error_416(st_h2o_req_t*, char const*, char const*, int) Unexecuted instantiation: driver.cc:h2o_send_error_417(st_h2o_req_t*, char const*, char const*, int) Unexecuted instantiation: driver.cc:h2o_send_error_421(st_h2o_req_t*, char const*, char const*, int) Unexecuted instantiation: driver.cc:h2o_send_error_500(st_h2o_req_t*, char const*, char const*, int) Unexecuted instantiation: driver.cc:h2o_send_error_502(st_h2o_req_t*, char const*, char const*, int) Unexecuted instantiation: driver.cc:h2o_send_error_503(st_h2o_req_t*, char const*, char const*, int) Unexecuted instantiation: driver_common.cc:h2o_send_error_400(st_h2o_req_t*, char const*, char const*, int) Unexecuted instantiation: driver_common.cc:h2o_send_error_401(st_h2o_req_t*, char const*, char const*, int) Unexecuted instantiation: driver_common.cc:h2o_send_error_403(st_h2o_req_t*, char const*, char const*, int) Unexecuted instantiation: driver_common.cc:h2o_send_error_404(st_h2o_req_t*, char const*, char const*, int) Unexecuted instantiation: driver_common.cc:h2o_send_error_405(st_h2o_req_t*, char const*, char const*, int) Unexecuted instantiation: driver_common.cc:h2o_send_error_413(st_h2o_req_t*, char const*, char const*, int) Unexecuted instantiation: driver_common.cc:h2o_send_error_416(st_h2o_req_t*, char const*, char const*, int) Unexecuted instantiation: driver_common.cc:h2o_send_error_417(st_h2o_req_t*, char const*, char const*, int) Unexecuted instantiation: driver_common.cc:h2o_send_error_421(st_h2o_req_t*, char const*, char const*, int) Unexecuted instantiation: driver_common.cc:h2o_send_error_500(st_h2o_req_t*, char const*, char const*, int) Unexecuted instantiation: driver_common.cc:h2o_send_error_502(st_h2o_req_t*, char const*, char const*, int) Unexecuted instantiation: driver_common.cc:h2o_send_error_503(st_h2o_req_t*, char const*, char const*, int) Unexecuted instantiation: config.c:h2o_send_error_400 Unexecuted instantiation: config.c:h2o_send_error_401 Unexecuted instantiation: config.c:h2o_send_error_403 Unexecuted instantiation: config.c:h2o_send_error_404 Unexecuted instantiation: config.c:h2o_send_error_405 Unexecuted instantiation: config.c:h2o_send_error_413 Unexecuted instantiation: config.c:h2o_send_error_416 Unexecuted instantiation: config.c:h2o_send_error_417 Unexecuted instantiation: config.c:h2o_send_error_421 Unexecuted instantiation: config.c:h2o_send_error_500 Unexecuted instantiation: config.c:h2o_send_error_502 Unexecuted instantiation: config.c:h2o_send_error_503 Unexecuted instantiation: configurator.c:h2o_send_error_400 Unexecuted instantiation: configurator.c:h2o_send_error_401 Unexecuted instantiation: configurator.c:h2o_send_error_403 Unexecuted instantiation: configurator.c:h2o_send_error_404 Unexecuted instantiation: configurator.c:h2o_send_error_405 Unexecuted instantiation: configurator.c:h2o_send_error_413 Unexecuted instantiation: configurator.c:h2o_send_error_416 Unexecuted instantiation: configurator.c:h2o_send_error_417 Unexecuted instantiation: configurator.c:h2o_send_error_421 Unexecuted instantiation: configurator.c:h2o_send_error_500 Unexecuted instantiation: configurator.c:h2o_send_error_502 Unexecuted instantiation: configurator.c:h2o_send_error_503 Unexecuted instantiation: context.c:h2o_send_error_400 Unexecuted instantiation: context.c:h2o_send_error_401 Unexecuted instantiation: context.c:h2o_send_error_403 Unexecuted instantiation: context.c:h2o_send_error_404 Unexecuted instantiation: context.c:h2o_send_error_405 Unexecuted instantiation: context.c:h2o_send_error_413 Unexecuted instantiation: context.c:h2o_send_error_416 Unexecuted instantiation: context.c:h2o_send_error_417 Unexecuted instantiation: context.c:h2o_send_error_421 Unexecuted instantiation: context.c:h2o_send_error_500 Unexecuted instantiation: context.c:h2o_send_error_502 Unexecuted instantiation: context.c:h2o_send_error_503 Unexecuted instantiation: headers.c:h2o_send_error_400 Unexecuted instantiation: headers.c:h2o_send_error_401 Unexecuted instantiation: headers.c:h2o_send_error_403 Unexecuted instantiation: headers.c:h2o_send_error_404 Unexecuted instantiation: headers.c:h2o_send_error_405 Unexecuted instantiation: headers.c:h2o_send_error_413 Unexecuted instantiation: headers.c:h2o_send_error_416 Unexecuted instantiation: headers.c:h2o_send_error_417 Unexecuted instantiation: headers.c:h2o_send_error_421 Unexecuted instantiation: headers.c:h2o_send_error_500 Unexecuted instantiation: headers.c:h2o_send_error_502 Unexecuted instantiation: headers.c:h2o_send_error_503 request.c:h2o_send_error_404 Line | Count | Source | 1784 | 1.64k | { \ | 1785 | 1.64k | req->conn->ctx->emitted_error_status[H2O_STATUS_ERROR_##status]++; \ | 1786 | 1.64k | h2o_send_error_generic(req, status, reason, body, flags); \ | 1787 | 1.64k | } |
Unexecuted instantiation: request.c:h2o_send_error_502 Unexecuted instantiation: request.c:h2o_send_error_400 Unexecuted instantiation: request.c:h2o_send_error_401 Unexecuted instantiation: request.c:h2o_send_error_403 Unexecuted instantiation: request.c:h2o_send_error_405 Unexecuted instantiation: request.c:h2o_send_error_413 Unexecuted instantiation: request.c:h2o_send_error_416 Unexecuted instantiation: request.c:h2o_send_error_417 Unexecuted instantiation: request.c:h2o_send_error_421 Unexecuted instantiation: request.c:h2o_send_error_500 Unexecuted instantiation: request.c:h2o_send_error_503 Unexecuted instantiation: util.c:h2o_send_error_400 Unexecuted instantiation: util.c:h2o_send_error_401 Unexecuted instantiation: util.c:h2o_send_error_403 Unexecuted instantiation: util.c:h2o_send_error_404 Unexecuted instantiation: util.c:h2o_send_error_405 Unexecuted instantiation: util.c:h2o_send_error_413 Unexecuted instantiation: util.c:h2o_send_error_416 Unexecuted instantiation: util.c:h2o_send_error_417 Unexecuted instantiation: util.c:h2o_send_error_421 Unexecuted instantiation: util.c:h2o_send_error_500 Unexecuted instantiation: util.c:h2o_send_error_502 Unexecuted instantiation: util.c:h2o_send_error_503 Unexecuted instantiation: access_log.c:h2o_send_error_400 Unexecuted instantiation: access_log.c:h2o_send_error_401 Unexecuted instantiation: access_log.c:h2o_send_error_403 Unexecuted instantiation: access_log.c:h2o_send_error_404 Unexecuted instantiation: access_log.c:h2o_send_error_405 Unexecuted instantiation: access_log.c:h2o_send_error_413 Unexecuted instantiation: access_log.c:h2o_send_error_416 Unexecuted instantiation: access_log.c:h2o_send_error_417 Unexecuted instantiation: access_log.c:h2o_send_error_421 Unexecuted instantiation: access_log.c:h2o_send_error_500 Unexecuted instantiation: access_log.c:h2o_send_error_502 Unexecuted instantiation: access_log.c:h2o_send_error_503 Unexecuted instantiation: file.c:h2o_send_error_405 Unexecuted instantiation: file.c:h2o_send_error_503 Unexecuted instantiation: file.c:h2o_send_error_403 Unexecuted instantiation: file.c:h2o_send_error_416 Unexecuted instantiation: file.c:h2o_send_error_400 Unexecuted instantiation: file.c:h2o_send_error_401 Unexecuted instantiation: file.c:h2o_send_error_404 Unexecuted instantiation: file.c:h2o_send_error_413 Unexecuted instantiation: file.c:h2o_send_error_417 Unexecuted instantiation: file.c:h2o_send_error_421 Unexecuted instantiation: file.c:h2o_send_error_500 Unexecuted instantiation: file.c:h2o_send_error_502 Unexecuted instantiation: mimemap.c:h2o_send_error_400 Unexecuted instantiation: mimemap.c:h2o_send_error_401 Unexecuted instantiation: mimemap.c:h2o_send_error_403 Unexecuted instantiation: mimemap.c:h2o_send_error_404 Unexecuted instantiation: mimemap.c:h2o_send_error_405 Unexecuted instantiation: mimemap.c:h2o_send_error_413 Unexecuted instantiation: mimemap.c:h2o_send_error_416 Unexecuted instantiation: mimemap.c:h2o_send_error_417 Unexecuted instantiation: mimemap.c:h2o_send_error_421 Unexecuted instantiation: mimemap.c:h2o_send_error_500 Unexecuted instantiation: mimemap.c:h2o_send_error_502 Unexecuted instantiation: mimemap.c:h2o_send_error_503 Unexecuted instantiation: proxy.c:h2o_send_error_400 Unexecuted instantiation: proxy.c:h2o_send_error_401 Unexecuted instantiation: proxy.c:h2o_send_error_403 Unexecuted instantiation: proxy.c:h2o_send_error_404 Unexecuted instantiation: proxy.c:h2o_send_error_405 Unexecuted instantiation: proxy.c:h2o_send_error_413 Unexecuted instantiation: proxy.c:h2o_send_error_416 Unexecuted instantiation: proxy.c:h2o_send_error_417 Unexecuted instantiation: proxy.c:h2o_send_error_421 Unexecuted instantiation: proxy.c:h2o_send_error_500 Unexecuted instantiation: proxy.c:h2o_send_error_502 Unexecuted instantiation: proxy.c:h2o_send_error_503 Unexecuted instantiation: http1.c:h2o_send_error_400 Unexecuted instantiation: http1.c:h2o_send_error_417 Unexecuted instantiation: http1.c:h2o_send_error_405 Unexecuted instantiation: http1.c:h2o_send_error_401 Unexecuted instantiation: http1.c:h2o_send_error_403 Unexecuted instantiation: http1.c:h2o_send_error_404 Unexecuted instantiation: http1.c:h2o_send_error_413 Unexecuted instantiation: http1.c:h2o_send_error_416 Unexecuted instantiation: http1.c:h2o_send_error_421 Unexecuted instantiation: http1.c:h2o_send_error_500 Unexecuted instantiation: http1.c:h2o_send_error_502 Unexecuted instantiation: http1.c:h2o_send_error_503 connection.c:h2o_send_error_400 Line | Count | Source | 1784 | 1.90k | { \ | 1785 | 1.90k | req->conn->ctx->emitted_error_status[H2O_STATUS_ERROR_##status]++; \ | 1786 | 1.90k | h2o_send_error_generic(req, status, reason, body, flags); \ | 1787 | 1.90k | } |
Unexecuted instantiation: connection.c:h2o_send_error_401 Unexecuted instantiation: connection.c:h2o_send_error_403 Unexecuted instantiation: connection.c:h2o_send_error_404 Unexecuted instantiation: connection.c:h2o_send_error_405 Unexecuted instantiation: connection.c:h2o_send_error_413 Unexecuted instantiation: connection.c:h2o_send_error_416 Unexecuted instantiation: connection.c:h2o_send_error_417 Unexecuted instantiation: connection.c:h2o_send_error_421 Unexecuted instantiation: connection.c:h2o_send_error_500 Unexecuted instantiation: connection.c:h2o_send_error_502 Unexecuted instantiation: connection.c:h2o_send_error_503 Unexecuted instantiation: scheduler.c:h2o_send_error_400 Unexecuted instantiation: scheduler.c:h2o_send_error_401 Unexecuted instantiation: scheduler.c:h2o_send_error_403 Unexecuted instantiation: scheduler.c:h2o_send_error_404 Unexecuted instantiation: scheduler.c:h2o_send_error_405 Unexecuted instantiation: scheduler.c:h2o_send_error_413 Unexecuted instantiation: scheduler.c:h2o_send_error_416 Unexecuted instantiation: scheduler.c:h2o_send_error_417 Unexecuted instantiation: scheduler.c:h2o_send_error_421 Unexecuted instantiation: scheduler.c:h2o_send_error_500 Unexecuted instantiation: scheduler.c:h2o_send_error_502 Unexecuted instantiation: scheduler.c:h2o_send_error_503 Unexecuted instantiation: stream.c:h2o_send_error_400 Unexecuted instantiation: stream.c:h2o_send_error_401 Unexecuted instantiation: stream.c:h2o_send_error_403 Unexecuted instantiation: stream.c:h2o_send_error_404 Unexecuted instantiation: stream.c:h2o_send_error_405 Unexecuted instantiation: stream.c:h2o_send_error_413 Unexecuted instantiation: stream.c:h2o_send_error_416 Unexecuted instantiation: stream.c:h2o_send_error_417 Unexecuted instantiation: stream.c:h2o_send_error_421 Unexecuted instantiation: stream.c:h2o_send_error_500 Unexecuted instantiation: stream.c:h2o_send_error_502 Unexecuted instantiation: stream.c:h2o_send_error_503 Unexecuted instantiation: http2_debug_state.c:h2o_send_error_400 Unexecuted instantiation: http2_debug_state.c:h2o_send_error_401 Unexecuted instantiation: http2_debug_state.c:h2o_send_error_403 Unexecuted instantiation: http2_debug_state.c:h2o_send_error_404 Unexecuted instantiation: http2_debug_state.c:h2o_send_error_405 Unexecuted instantiation: http2_debug_state.c:h2o_send_error_413 Unexecuted instantiation: http2_debug_state.c:h2o_send_error_416 Unexecuted instantiation: http2_debug_state.c:h2o_send_error_417 Unexecuted instantiation: http2_debug_state.c:h2o_send_error_421 Unexecuted instantiation: http2_debug_state.c:h2o_send_error_500 Unexecuted instantiation: http2_debug_state.c:h2o_send_error_502 Unexecuted instantiation: http2_debug_state.c:h2o_send_error_503 Unexecuted instantiation: server.c:h2o_send_error_400 Unexecuted instantiation: server.c:h2o_send_error_413 Unexecuted instantiation: server.c:h2o_send_error_401 Unexecuted instantiation: server.c:h2o_send_error_403 Unexecuted instantiation: server.c:h2o_send_error_404 Unexecuted instantiation: server.c:h2o_send_error_405 Unexecuted instantiation: server.c:h2o_send_error_416 Unexecuted instantiation: server.c:h2o_send_error_417 Unexecuted instantiation: server.c:h2o_send_error_421 Unexecuted instantiation: server.c:h2o_send_error_500 Unexecuted instantiation: server.c:h2o_send_error_502 Unexecuted instantiation: server.c:h2o_send_error_503 Unexecuted instantiation: absprio.c:h2o_send_error_400 Unexecuted instantiation: absprio.c:h2o_send_error_401 Unexecuted instantiation: absprio.c:h2o_send_error_403 Unexecuted instantiation: absprio.c:h2o_send_error_404 Unexecuted instantiation: absprio.c:h2o_send_error_405 Unexecuted instantiation: absprio.c:h2o_send_error_413 Unexecuted instantiation: absprio.c:h2o_send_error_416 Unexecuted instantiation: absprio.c:h2o_send_error_417 Unexecuted instantiation: absprio.c:h2o_send_error_421 Unexecuted instantiation: absprio.c:h2o_send_error_500 Unexecuted instantiation: absprio.c:h2o_send_error_502 Unexecuted instantiation: absprio.c:h2o_send_error_503 Unexecuted instantiation: logconf.c:h2o_send_error_400 Unexecuted instantiation: logconf.c:h2o_send_error_401 Unexecuted instantiation: logconf.c:h2o_send_error_403 Unexecuted instantiation: logconf.c:h2o_send_error_404 Unexecuted instantiation: logconf.c:h2o_send_error_405 Unexecuted instantiation: logconf.c:h2o_send_error_413 Unexecuted instantiation: logconf.c:h2o_send_error_416 Unexecuted instantiation: logconf.c:h2o_send_error_417 Unexecuted instantiation: logconf.c:h2o_send_error_421 Unexecuted instantiation: logconf.c:h2o_send_error_500 Unexecuted instantiation: logconf.c:h2o_send_error_502 Unexecuted instantiation: logconf.c:h2o_send_error_503 Unexecuted instantiation: compress.c:h2o_send_error_400 Unexecuted instantiation: compress.c:h2o_send_error_401 Unexecuted instantiation: compress.c:h2o_send_error_403 Unexecuted instantiation: compress.c:h2o_send_error_404 Unexecuted instantiation: compress.c:h2o_send_error_405 Unexecuted instantiation: compress.c:h2o_send_error_413 Unexecuted instantiation: compress.c:h2o_send_error_416 Unexecuted instantiation: compress.c:h2o_send_error_417 Unexecuted instantiation: compress.c:h2o_send_error_421 Unexecuted instantiation: compress.c:h2o_send_error_500 Unexecuted instantiation: compress.c:h2o_send_error_502 Unexecuted instantiation: compress.c:h2o_send_error_503 Unexecuted instantiation: gzip.c:h2o_send_error_400 Unexecuted instantiation: gzip.c:h2o_send_error_401 Unexecuted instantiation: gzip.c:h2o_send_error_403 Unexecuted instantiation: gzip.c:h2o_send_error_404 Unexecuted instantiation: gzip.c:h2o_send_error_405 Unexecuted instantiation: gzip.c:h2o_send_error_413 Unexecuted instantiation: gzip.c:h2o_send_error_416 Unexecuted instantiation: gzip.c:h2o_send_error_417 Unexecuted instantiation: gzip.c:h2o_send_error_421 Unexecuted instantiation: gzip.c:h2o_send_error_500 Unexecuted instantiation: gzip.c:h2o_send_error_502 Unexecuted instantiation: gzip.c:h2o_send_error_503 Unexecuted instantiation: headers_util.c:h2o_send_error_400 Unexecuted instantiation: headers_util.c:h2o_send_error_401 Unexecuted instantiation: headers_util.c:h2o_send_error_403 Unexecuted instantiation: headers_util.c:h2o_send_error_404 Unexecuted instantiation: headers_util.c:h2o_send_error_405 Unexecuted instantiation: headers_util.c:h2o_send_error_413 Unexecuted instantiation: headers_util.c:h2o_send_error_416 Unexecuted instantiation: headers_util.c:h2o_send_error_417 Unexecuted instantiation: headers_util.c:h2o_send_error_421 Unexecuted instantiation: headers_util.c:h2o_send_error_500 Unexecuted instantiation: headers_util.c:h2o_send_error_502 Unexecuted instantiation: headers_util.c:h2o_send_error_503 Unexecuted instantiation: qpack.c:h2o_send_error_400 Unexecuted instantiation: qpack.c:h2o_send_error_401 Unexecuted instantiation: qpack.c:h2o_send_error_403 Unexecuted instantiation: qpack.c:h2o_send_error_404 Unexecuted instantiation: qpack.c:h2o_send_error_405 Unexecuted instantiation: qpack.c:h2o_send_error_413 Unexecuted instantiation: qpack.c:h2o_send_error_416 Unexecuted instantiation: qpack.c:h2o_send_error_417 Unexecuted instantiation: qpack.c:h2o_send_error_421 Unexecuted instantiation: qpack.c:h2o_send_error_500 Unexecuted instantiation: qpack.c:h2o_send_error_502 Unexecuted instantiation: qpack.c:h2o_send_error_503 |
1788 | | |
1789 | | H2O_SEND_ERROR_XXX(400) |
1790 | | H2O_SEND_ERROR_XXX(401) |
1791 | | H2O_SEND_ERROR_XXX(403) |
1792 | | H2O_SEND_ERROR_XXX(404) |
1793 | | H2O_SEND_ERROR_XXX(405) |
1794 | | H2O_SEND_ERROR_XXX(413) |
1795 | | H2O_SEND_ERROR_XXX(416) |
1796 | | H2O_SEND_ERROR_XXX(417) |
1797 | | H2O_SEND_ERROR_XXX(421) |
1798 | | H2O_SEND_ERROR_XXX(500) |
1799 | | H2O_SEND_ERROR_XXX(502) |
1800 | | H2O_SEND_ERROR_XXX(503) |
1801 | | |
1802 | | /** |
1803 | | * sends error response using zero timeout; can be called by output filters while processing the headers. Uses h2o_send_inline |
1804 | | * internally, so the same restrictions apply. |
1805 | | */ |
1806 | | void h2o_send_error_deferred(h2o_req_t *req, int status, const char *reason, const char *body, int flags); |
1807 | | /** |
1808 | | * sends a redirect response. Uses (the equivalent of) h2o_send_inline internally, so the same restrictions apply. |
1809 | | */ |
1810 | | void h2o_send_redirect(h2o_req_t *req, int status, const char *reason, const char *url, size_t url_len); |
1811 | | /** |
1812 | | * handles redirect internally. |
1813 | | */ |
1814 | | void h2o_send_redirect_internal(h2o_req_t *req, h2o_iovec_t method, const char *url_str, size_t url_len, int preserve_overrides); |
1815 | | /** |
1816 | | * returns method to be used after redirection |
1817 | | */ |
1818 | | h2o_iovec_t h2o_get_redirect_method(h2o_iovec_t method, int status); |
1819 | | /** |
1820 | | * registers push path (if necessary) by parsing a Link header |
1821 | | * this returns a version of `value` that removes the links that had the `x-http2-push-only` attribute |
1822 | | */ |
1823 | | h2o_iovec_t h2o_push_path_in_link_header(h2o_req_t *req, const char *value, size_t value_len); |
1824 | | /** |
1825 | | * sends 1xx response |
1826 | | */ |
1827 | | void h2o_send_informational(h2o_req_t *req); |
1828 | | /** |
1829 | | * |
1830 | | */ |
1831 | | static int h2o_req_can_stream_request(h2o_req_t *req); |
1832 | | /** |
1833 | | * resolves internal redirect url for dest regarding req's hostconf |
1834 | | */ |
1835 | | int h2o_req_resolve_internal_redirect_url(h2o_req_t *req, h2o_iovec_t dest, h2o_url_t *resolved); |
1836 | | /** |
1837 | | * logs an error |
1838 | | */ |
1839 | | void h2o_req_log_error(h2o_req_t *req, const char *module, const char *fmt, ...) __attribute__((format(printf, 3, 4))); |
1840 | | void h2o_write_error_log(h2o_iovec_t prefix, h2o_iovec_t msg); |
1841 | | |
1842 | | /* log */ |
1843 | | |
1844 | | enum { H2O_LOGCONF_ESCAPE_APACHE, H2O_LOGCONF_ESCAPE_JSON }; |
1845 | | |
1846 | | /** |
1847 | | * compiles a log configuration |
1848 | | */ |
1849 | | h2o_logconf_t *h2o_logconf_compile(const char *fmt, int escape, char *errbuf); |
1850 | | /** |
1851 | | * disposes of a log configuration |
1852 | | */ |
1853 | | void h2o_logconf_dispose(h2o_logconf_t *logconf); |
1854 | | /** |
1855 | | * logs a request |
1856 | | */ |
1857 | | char *h2o_log_request(h2o_logconf_t *logconf, h2o_req_t *req, size_t *len, char *buf); |
1858 | | |
1859 | | /* proxy */ |
1860 | | |
1861 | | /** |
1862 | | * processes a request (by sending the request upstream) |
1863 | | */ |
1864 | | void h2o__proxy_process_request(h2o_req_t *req); |
1865 | | |
1866 | | /* mime mapper */ |
1867 | | |
1868 | | /** |
1869 | | * initializes the mimemap (the returned chunk is refcounted) |
1870 | | */ |
1871 | | h2o_mimemap_t *h2o_mimemap_create(void); |
1872 | | /** |
1873 | | * clones a mimemap |
1874 | | */ |
1875 | | h2o_mimemap_t *h2o_mimemap_clone(h2o_mimemap_t *src); |
1876 | | /** |
1877 | | * |
1878 | | */ |
1879 | | void h2o_mimemap_on_context_init(h2o_mimemap_t *mimemap, h2o_context_t *ctx); |
1880 | | /** |
1881 | | * |
1882 | | */ |
1883 | | void h2o_mimemap_on_context_dispose(h2o_mimemap_t *mimemap, h2o_context_t *ctx); |
1884 | | /** |
1885 | | * returns if the map contains a dynamic type |
1886 | | */ |
1887 | | int h2o_mimemap_has_dynamic_type(h2o_mimemap_t *mimemap); |
1888 | | /** |
1889 | | * sets the default mime-type |
1890 | | */ |
1891 | | void h2o_mimemap_set_default_type(h2o_mimemap_t *mimemap, const char *mime, h2o_mime_attributes_t *attr); |
1892 | | /** |
1893 | | * adds a mime-type mapping |
1894 | | */ |
1895 | | void h2o_mimemap_define_mimetype(h2o_mimemap_t *mimemap, const char *ext, const char *mime, h2o_mime_attributes_t *attr); |
1896 | | /** |
1897 | | * adds a mime-type mapping |
1898 | | */ |
1899 | | h2o_mimemap_type_t *h2o_mimemap_define_dynamic(h2o_mimemap_t *mimemap, const char **exts, h2o_globalconf_t *globalconf); |
1900 | | /** |
1901 | | * removes a mime-type mapping |
1902 | | */ |
1903 | | void h2o_mimemap_remove_type(h2o_mimemap_t *mimemap, const char *ext); |
1904 | | /** |
1905 | | * clears all mime-type mapping |
1906 | | */ |
1907 | | void h2o_mimemap_clear_types(h2o_mimemap_t *mimemap); |
1908 | | /** |
1909 | | * sets the default mime-type |
1910 | | */ |
1911 | | h2o_mimemap_type_t *h2o_mimemap_get_default_type(h2o_mimemap_t *mimemap); |
1912 | | /** |
1913 | | * returns the mime-type corresponding to given extension |
1914 | | */ |
1915 | | h2o_mimemap_type_t *h2o_mimemap_get_type_by_extension(h2o_mimemap_t *mimemap, h2o_iovec_t ext); |
1916 | | /** |
1917 | | * returns the mime-type corresponding to given mimetype |
1918 | | */ |
1919 | | h2o_mimemap_type_t *h2o_mimemap_get_type_by_mimetype(h2o_mimemap_t *mimemap, h2o_iovec_t mime, int exact_match_only); |
1920 | | /** |
1921 | | * returns the default mime attributes given a mime type |
1922 | | */ |
1923 | | void h2o_mimemap_get_default_attributes(const char *mime, h2o_mime_attributes_t *attr); |
1924 | | |
1925 | | /* various handlers */ |
1926 | | |
1927 | | /* lib/access_log.c */ |
1928 | | |
1929 | | typedef struct st_h2o_access_log_filehandle_t h2o_access_log_filehandle_t; |
1930 | | |
1931 | | int h2o_access_log_open_log(const char *path); |
1932 | | h2o_access_log_filehandle_t *h2o_access_log_open_handle(const char *path, const char *fmt, int escape); |
1933 | | h2o_logger_t *h2o_access_log_register(h2o_pathconf_t *pathconf, h2o_access_log_filehandle_t *handle); |
1934 | | void h2o_access_log_register_configurator(h2o_globalconf_t *conf); |
1935 | | |
1936 | | /* lib/handler/server_timing.c */ |
1937 | | void h2o_server_timing_register(h2o_pathconf_t *pathconf, int enforce); |
1938 | | void h2o_server_timing_register_configurator(h2o_globalconf_t *conf); |
1939 | | |
1940 | | /* lib/compress.c */ |
1941 | | |
1942 | | enum { H2O_COMPRESS_FLAG_PARTIAL, H2O_COMPRESS_FLAG_FLUSH, H2O_COMPRESS_FLAG_EOS }; |
1943 | | |
1944 | | /** |
1945 | | * compressor context |
1946 | | */ |
1947 | | typedef struct st_h2o_compress_context_t { |
1948 | | /** |
1949 | | * name used in content-encoding header |
1950 | | */ |
1951 | | h2o_iovec_t name; |
1952 | | /** |
1953 | | * compress or decompress callback (inbufs are raw buffers) |
1954 | | */ |
1955 | | h2o_send_state_t (*do_transform)(struct st_h2o_compress_context_t *self, h2o_sendvec_t *inbufs, size_t inbufcnt, |
1956 | | h2o_send_state_t state, h2o_sendvec_t **outbufs, size_t *outbufcnt); |
1957 | | /** |
1958 | | * push buffer |
1959 | | */ |
1960 | | char *push_buf; |
1961 | | } h2o_compress_context_t; |
1962 | | |
1963 | | typedef struct st_h2o_compress_args_t { |
1964 | | size_t min_size; |
1965 | | struct { |
1966 | | int quality; /* -1 if disabled */ |
1967 | | } gzip; |
1968 | | struct { |
1969 | | int quality; /* -1 if disabled */ |
1970 | | } brotli; |
1971 | | } h2o_compress_args_t; |
1972 | | |
1973 | | /** |
1974 | | * registers the gzip/brotli encoding output filter (added by default, for now) |
1975 | | */ |
1976 | | void h2o_compress_register(h2o_pathconf_t *pathconf, h2o_compress_args_t *args); |
1977 | | /** |
1978 | | * compresses given chunk |
1979 | | */ |
1980 | | h2o_send_state_t h2o_compress_transform(h2o_compress_context_t *self, h2o_req_t *req, h2o_sendvec_t *inbufs, size_t inbufcnt, |
1981 | | h2o_send_state_t state, h2o_sendvec_t **outbufs, size_t *outbufcnt); |
1982 | | /** |
1983 | | * instantiates the gzip compressor |
1984 | | */ |
1985 | | h2o_compress_context_t *h2o_compress_gzip_open(h2o_mem_pool_t *pool, int quality); |
1986 | | /** |
1987 | | * instantiates the gzip decompressor |
1988 | | */ |
1989 | | h2o_compress_context_t *h2o_compress_gunzip_open(h2o_mem_pool_t *pool); |
1990 | | /** |
1991 | | * instantiates the brotli compressor (only available if H2O_USE_BROTLI is set) |
1992 | | */ |
1993 | | h2o_compress_context_t *h2o_compress_brotli_open(h2o_mem_pool_t *pool, int quality, size_t estimated_cotent_length, |
1994 | | size_t preferred_chunk_size); |
1995 | | /** |
1996 | | * registers the configurator for the gzip/brotli output filter |
1997 | | */ |
1998 | | void h2o_compress_register_configurator(h2o_globalconf_t *conf); |
1999 | | |
2000 | | /* lib/handler/throttle_resp.c */ |
2001 | | /** |
2002 | | * registers the throttle response filter |
2003 | | */ |
2004 | | void h2o_throttle_resp_register(h2o_pathconf_t *pathconf); |
2005 | | /** |
2006 | | * configurator |
2007 | | */ |
2008 | | void h2o_throttle_resp_register_configurator(h2o_globalconf_t *conf); |
2009 | | |
2010 | | /* lib/errordoc.c */ |
2011 | | |
2012 | | typedef struct st_h2o_errordoc_t { |
2013 | | int status; |
2014 | | h2o_iovec_t url; /* can be relative */ |
2015 | | } h2o_errordoc_t; |
2016 | | |
2017 | | /** |
2018 | | * registers the errordocument output filter |
2019 | | */ |
2020 | | void h2o_errordoc_register(h2o_pathconf_t *pathconf, h2o_errordoc_t *errdocs, size_t cnt); |
2021 | | /** |
2022 | | * |
2023 | | */ |
2024 | | void h2o_errordoc_register_configurator(h2o_globalconf_t *conf); |
2025 | | |
2026 | | /* lib/expires.c */ |
2027 | | |
2028 | | enum { H2O_EXPIRES_MODE_ABSOLUTE, H2O_EXPIRES_MODE_MAX_AGE }; |
2029 | | |
2030 | | typedef struct st_h2o_expires_args_t { |
2031 | | int mode; |
2032 | | union { |
2033 | | const char *absolute; |
2034 | | uint64_t max_age; |
2035 | | } data; |
2036 | | } h2o_expires_args_t; |
2037 | | |
2038 | | /** |
2039 | | * registers a filter that adds an Expires (or Cache-Control) header |
2040 | | */ |
2041 | | void h2o_expires_register(h2o_pathconf_t *pathconf, h2o_expires_args_t *args); |
2042 | | /** |
2043 | | * |
2044 | | */ |
2045 | | void h2o_expires_register_configurator(h2o_globalconf_t *conf); |
2046 | | |
2047 | | /* lib/fastcgi.c */ |
2048 | | |
2049 | | typedef struct st_h2o_fastcgi_handler_t h2o_fastcgi_handler_t; |
2050 | | |
2051 | | #define H2O_DEFAULT_FASTCGI_IO_TIMEOUT 30000 |
2052 | | |
2053 | | typedef struct st_h2o_fastcgi_config_vars_t { |
2054 | | uint64_t io_timeout; |
2055 | | uint64_t keepalive_timeout; /* 0 to disable */ |
2056 | | h2o_iovec_t document_root; /* .base=NULL if not set */ |
2057 | | int send_delegated_uri; /* whether to send the rewritten HTTP_HOST & REQUEST_URI by delegation, or the original */ |
2058 | | struct { |
2059 | | void (*dispose)(h2o_fastcgi_handler_t *handler, void *data); |
2060 | | void *data; |
2061 | | } callbacks; |
2062 | | } h2o_fastcgi_config_vars_t; |
2063 | | |
2064 | | /** |
2065 | | * registers the fastcgi handler to the context |
2066 | | */ |
2067 | | h2o_fastcgi_handler_t *h2o_fastcgi_register(h2o_pathconf_t *pathconf, h2o_url_t *upstream, h2o_fastcgi_config_vars_t *vars); |
2068 | | /** |
2069 | | * registers the fastcgi handler to the context |
2070 | | */ |
2071 | | h2o_fastcgi_handler_t *h2o_fastcgi_register_by_spawnproc(h2o_pathconf_t *pathconf, char **argv, h2o_fastcgi_config_vars_t *vars); |
2072 | | /** |
2073 | | * registers the configurator |
2074 | | */ |
2075 | | void h2o_fastcgi_register_configurator(h2o_globalconf_t *conf); |
2076 | | |
2077 | | /* lib/file.c */ |
2078 | | |
2079 | | enum { |
2080 | | H2O_FILE_FLAG_NO_ETAG = 0x1, |
2081 | | H2O_FILE_FLAG_DIR_LISTING = 0x2, |
2082 | | H2O_FILE_FLAG_SEND_COMPRESSED = 0x4, |
2083 | | H2O_FILE_FLAG_GUNZIP = 0x8 |
2084 | | }; |
2085 | | |
2086 | | typedef struct st_h2o_file_handler_t h2o_file_handler_t; |
2087 | | |
2088 | | extern const char **h2o_file_default_index_files; |
2089 | | |
2090 | | /** |
2091 | | * sends given file as the response to the client |
2092 | | */ |
2093 | | int h2o_file_send(h2o_req_t *req, int status, const char *reason, const char *path, h2o_iovec_t mime_type, int flags); |
2094 | | /** |
2095 | | * registers a handler that serves a directory of statically-served files |
2096 | | * @param pathconf |
2097 | | * @param virtual_path |
2098 | | * @param real_path |
2099 | | * @param index_files optional NULL-terminated list of of filenames to be considered as the "directory-index" |
2100 | | * @param mimemap the mimemap (h2o_mimemap_create is called internally if the argument is NULL) |
2101 | | */ |
2102 | | h2o_file_handler_t *h2o_file_register(h2o_pathconf_t *pathconf, const char *real_path, const char **index_files, |
2103 | | h2o_mimemap_t *mimemap, int flags); |
2104 | | /** |
2105 | | * registers a handler that serves a specific file |
2106 | | * @param pathconf |
2107 | | * @param virtual_path |
2108 | | * @param real_path |
2109 | | * @param index_files optional NULL-terminated list of of filenames to be considered as the "directory-index" |
2110 | | * @param mimemap the mimemap (h2o_mimemap_create is called internally if the argument is NULL) |
2111 | | */ |
2112 | | h2o_handler_t *h2o_file_register_file(h2o_pathconf_t *pathconf, const char *real_path, h2o_mimemap_type_t *mime_type, int flags); |
2113 | | /** |
2114 | | * returns the associated mimemap |
2115 | | */ |
2116 | | h2o_mimemap_t *h2o_file_get_mimemap(h2o_file_handler_t *handler); |
2117 | | /** |
2118 | | * registers the configurator |
2119 | | */ |
2120 | | void h2o_file_register_configurator(h2o_globalconf_t *conf); |
2121 | | |
2122 | | /* lib/headers.c */ |
2123 | | |
2124 | | enum { |
2125 | | H2O_HEADERS_CMD_NULL, |
2126 | | H2O_HEADERS_CMD_ADD, /* adds a new header line */ |
2127 | | H2O_HEADERS_CMD_APPEND, /* adds a new header line or contenates to the existing header */ |
2128 | | H2O_HEADERS_CMD_MERGE, /* merges the value into a comma-listed values of the named header */ |
2129 | | H2O_HEADERS_CMD_SET, /* sets a header line, overwriting the existing one (if any) */ |
2130 | | H2O_HEADERS_CMD_SETIFEMPTY, /* sets a header line if empty */ |
2131 | | H2O_HEADERS_CMD_UNSET, /* removes the named header(s) */ |
2132 | | H2O_HEADERS_CMD_UNSETUNLESS, /* only keeps the named header(s) */ |
2133 | | H2O_HEADERS_CMD_COOKIE_UNSET, /* removes the named cookie(s) */ |
2134 | | H2O_HEADERS_CMD_COOKIE_UNSETUNLESS, /* only keeps the named cookie(s) */ |
2135 | | }; |
2136 | | |
2137 | | typedef enum h2o_headers_command_when { |
2138 | | H2O_HEADERS_CMD_WHEN_FINAL, |
2139 | | H2O_HEADERS_CMD_WHEN_EARLY, |
2140 | | H2O_HEADERS_CMD_WHEN_ALL, |
2141 | | } h2o_headers_command_when_t; |
2142 | | |
2143 | | typedef struct st_h2o_headers_command_arg_t { |
2144 | | h2o_iovec_t *name; /* maybe a token */ |
2145 | | h2o_iovec_t value; |
2146 | | } h2o_headers_command_arg_t; |
2147 | | |
2148 | | struct st_h2o_headers_command_t { |
2149 | | int cmd; |
2150 | | h2o_headers_command_arg_t *args; |
2151 | | size_t num_args; |
2152 | | h2o_headers_command_when_t when; |
2153 | | }; |
2154 | | |
2155 | | /** |
2156 | | * registers a list of commands terminated by cmd==H2O_HEADERS_CMD_NULL |
2157 | | */ |
2158 | | void h2o_headers_register(h2o_pathconf_t *pathconf, h2o_headers_command_t *cmds); |
2159 | | /** |
2160 | | * returns whether if the given name can be registered to the filter |
2161 | | */ |
2162 | | int h2o_headers_is_prohibited_name(const h2o_token_t *token); |
2163 | | /** |
2164 | | * registers the configurator |
2165 | | */ |
2166 | | void h2o_headers_register_configurator(h2o_globalconf_t *conf); |
2167 | | |
2168 | | /* lib/proxy.c */ |
2169 | | |
2170 | | typedef struct st_h2o_proxy_config_vars_t { |
2171 | | uint64_t io_timeout; |
2172 | | uint64_t connect_timeout; |
2173 | | uint64_t first_byte_timeout; |
2174 | | uint64_t keepalive_timeout; |
2175 | | struct { |
2176 | | uint64_t name_resolution_delay; |
2177 | | uint64_t connection_attempt_delay; |
2178 | | } happy_eyeballs; |
2179 | | unsigned preserve_host : 1; |
2180 | | unsigned use_proxy_protocol : 1; |
2181 | | unsigned tunnel_enabled : 1; |
2182 | | unsigned connect_proxy_status_enabled : 1; |
2183 | | /** |
2184 | | * a boolean flag if set to true, instructs the proxy to close the frontend h1 connection on behalf of the upstream |
2185 | | */ |
2186 | | unsigned forward_close_connection : 1; |
2187 | | h2o_headers_command_t *headers_cmds; |
2188 | | size_t max_buffer_size; |
2189 | | struct { |
2190 | | uint32_t max_concurrent_streams; |
2191 | | unsigned force_cleartext : 1; |
2192 | | } http2; |
2193 | | h2o_httpclient_protocol_ratio_t protocol_ratio; |
2194 | | } h2o_proxy_config_vars_t; |
2195 | | |
2196 | | /** |
2197 | | * registers the reverse proxy handler to the context |
2198 | | */ |
2199 | | void h2o_proxy_register_reverse_proxy(h2o_pathconf_t *pathconf, h2o_proxy_config_vars_t *config, h2o_socketpool_t *sockpool); |
2200 | | /** |
2201 | | * registers the configurator |
2202 | | */ |
2203 | | void h2o_proxy_register_configurator(h2o_globalconf_t *conf); |
2204 | | |
2205 | | /* lib/redirect.c */ |
2206 | | |
2207 | | typedef struct st_h2o_redirect_handler_t h2o_redirect_handler_t; |
2208 | | |
2209 | | /** |
2210 | | * registers the redirect handler to the context |
2211 | | * @param pathconf |
2212 | | * @param internal whether if the redirect is internal or external |
2213 | | * @param status status code to be sent (e.g. 301, 303, 308, ...) |
2214 | | * @param prefix prefix of the destitation URL |
2215 | | */ |
2216 | | h2o_redirect_handler_t *h2o_redirect_register(h2o_pathconf_t *pathconf, int internal, int status, const char *prefix); |
2217 | | /** |
2218 | | * registers the configurator |
2219 | | */ |
2220 | | void h2o_redirect_register_configurator(h2o_globalconf_t *conf); |
2221 | | |
2222 | | /* lib/handler/reproxy.c */ |
2223 | | |
2224 | | typedef struct st_h2o_reproxy_handler_t h2o_reproxy_handler_t; |
2225 | | |
2226 | | /** |
2227 | | * registers the reproxy filter |
2228 | | */ |
2229 | | void h2o_reproxy_register(h2o_pathconf_t *pathconf); |
2230 | | /** |
2231 | | * registers the configurator |
2232 | | */ |
2233 | | void h2o_reproxy_register_configurator(h2o_globalconf_t *conf); |
2234 | | |
2235 | | /* lib/handler/connect.c */ |
2236 | | |
2237 | | typedef struct st_h2o_connect_acl_entry_t { |
2238 | | uint8_t allow_; /* true if allow, false if deny */ |
2239 | | enum { H2O_CONNECT_ACL_ADDRESS_ANY, H2O_CONNECT_ACL_ADDRESS_V4, H2O_CONNECT_ACL_ADDRESS_V6 } addr_family; |
2240 | | union { |
2241 | | uint32_t v4; |
2242 | | uint8_t v6[16]; |
2243 | | } addr; |
2244 | | size_t addr_mask; |
2245 | | uint16_t port; /* 0 indicates ANY */ |
2246 | | } h2o_connect_acl_entry_t; |
2247 | | |
2248 | | /** |
2249 | | * registers the connect handler to the context |
2250 | | */ |
2251 | | void h2o_connect_register(h2o_pathconf_t *pathconf, h2o_proxy_config_vars_t *config, h2o_connect_acl_entry_t *acl_entries, |
2252 | | size_t num_acl_entries); |
2253 | | /** |
2254 | | * Parses a ACL line and stores the result in `output`. If successful, returns NULL, otherwise a string indicating the problem is |
2255 | | * being returned. |
2256 | | */ |
2257 | | const char *h2o_connect_parse_acl(h2o_connect_acl_entry_t *output, const char *input); |
2258 | | /** |
2259 | | * Checks if access to given target is permissible, and returns a boolean indicating the result. |
2260 | | */ |
2261 | | int h2o_connect_lookup_acl(h2o_connect_acl_entry_t *acl_entries, size_t num_acl_entries, struct sockaddr *target); |
2262 | | |
2263 | | /* lib/handler/status.c */ |
2264 | | |
2265 | | /** |
2266 | | * registers the status handler |
2267 | | */ |
2268 | | void h2o_status_register(h2o_pathconf_t *pathconf); |
2269 | | /** |
2270 | | * registers the duration handler |
2271 | | */ |
2272 | | void h2o_duration_stats_register(h2o_globalconf_t *conf); |
2273 | | /** |
2274 | | * registers the configurator |
2275 | | */ |
2276 | | void h2o_status_register_configurator(h2o_globalconf_t *conf); |
2277 | | |
2278 | | /* lib/handler/headers_util.c */ |
2279 | | |
2280 | | struct headers_util_add_arg_t; |
2281 | | |
2282 | | /** |
2283 | | * appends a headers command to the list |
2284 | | */ |
2285 | | void h2o_headers_append_command(h2o_headers_command_t **cmds, int cmd, h2o_headers_command_arg_t *args, size_t num_args, |
2286 | | h2o_headers_command_when_t when); |
2287 | | /** |
2288 | | * rewrite headers by the command provided |
2289 | | */ |
2290 | | void h2o_rewrite_headers(h2o_mem_pool_t *pool, h2o_headers_t *headers, h2o_headers_command_t *cmd); |
2291 | | |
2292 | | /* lib/handler/http2_debug_state.c */ |
2293 | | |
2294 | | /** |
2295 | | * registers the http2 debug state handler |
2296 | | */ |
2297 | | void h2o_http2_debug_state_register(h2o_hostconf_t *hostconf, int hpack_enabled); |
2298 | | /** |
2299 | | * registers the configurator |
2300 | | */ |
2301 | | void h2o_http2_debug_state_register_configurator(h2o_globalconf_t *conf); |
2302 | | |
2303 | | /* lib/handler/conn_state.c */ |
2304 | | |
2305 | | /** |
2306 | | * |
2307 | | */ |
2308 | | void h2o_self_trace_register(h2o_pathconf_t *conf); |
2309 | | /** |
2310 | | * |
2311 | | */ |
2312 | | void h2o_self_trace_register_configurator(h2o_globalconf_t *conf); |
2313 | | |
2314 | | /* inline defs */ |
2315 | | |
2316 | | #ifdef H2O_NO_64BIT_ATOMICS |
2317 | | extern pthread_mutex_t h2o_conn_id_mutex; |
2318 | | #endif |
2319 | | |
2320 | | inline const char *h2o_conn_get_uuid(h2o_conn_t *conn) |
2321 | 0 | { |
2322 | 0 | if (conn->_uuid.is_initialized) |
2323 | 0 | return conn->_uuid.str; |
2324 | 0 | h2o_generate_uuidv4(conn->_uuid.str); |
2325 | 0 | conn->_uuid.is_initialized = 1; |
2326 | 0 | return conn->_uuid.str; |
2327 | 0 | } Unexecuted instantiation: driver.cc:h2o_conn_get_uuid(st_h2o_conn_t*) Unexecuted instantiation: driver_common.cc:h2o_conn_get_uuid(st_h2o_conn_t*) Unexecuted instantiation: config.c:h2o_conn_get_uuid Unexecuted instantiation: configurator.c:h2o_conn_get_uuid Unexecuted instantiation: context.c:h2o_conn_get_uuid Unexecuted instantiation: headers.c:h2o_conn_get_uuid Unexecuted instantiation: request.c:h2o_conn_get_uuid Unexecuted instantiation: util.c:h2o_conn_get_uuid Unexecuted instantiation: access_log.c:h2o_conn_get_uuid Unexecuted instantiation: file.c:h2o_conn_get_uuid Unexecuted instantiation: mimemap.c:h2o_conn_get_uuid Unexecuted instantiation: proxy.c:h2o_conn_get_uuid Unexecuted instantiation: http1.c:h2o_conn_get_uuid Unexecuted instantiation: connection.c:h2o_conn_get_uuid Unexecuted instantiation: scheduler.c:h2o_conn_get_uuid Unexecuted instantiation: stream.c:h2o_conn_get_uuid Unexecuted instantiation: http2_debug_state.c:h2o_conn_get_uuid Unexecuted instantiation: server.c:h2o_conn_get_uuid Unexecuted instantiation: absprio.c:h2o_conn_get_uuid Unexecuted instantiation: logconf.c:h2o_conn_get_uuid Unexecuted instantiation: compress.c:h2o_conn_get_uuid Unexecuted instantiation: gzip.c:h2o_conn_get_uuid Unexecuted instantiation: headers_util.c:h2o_conn_get_uuid Unexecuted instantiation: qpack.c:h2o_conn_get_uuid |
2328 | | |
2329 | | inline int h2o_conn_is_early_data(h2o_conn_t *conn) |
2330 | 676 | { |
2331 | 676 | ptls_t *tls; |
2332 | 676 | if (conn->callbacks->get_ptls == NULL) |
2333 | 0 | return 0; |
2334 | 676 | if ((tls = conn->callbacks->get_ptls(conn)) == NULL) |
2335 | 676 | return 0; |
2336 | 0 | if (ptls_handshake_is_complete(tls)) |
2337 | 0 | return 0; |
2338 | 0 | return 1; |
2339 | 0 | } Unexecuted instantiation: driver.cc:h2o_conn_is_early_data(st_h2o_conn_t*) Unexecuted instantiation: driver_common.cc:h2o_conn_is_early_data(st_h2o_conn_t*) Unexecuted instantiation: config.c:h2o_conn_is_early_data Unexecuted instantiation: configurator.c:h2o_conn_is_early_data Unexecuted instantiation: context.c:h2o_conn_is_early_data Unexecuted instantiation: headers.c:h2o_conn_is_early_data Unexecuted instantiation: request.c:h2o_conn_is_early_data Unexecuted instantiation: util.c:h2o_conn_is_early_data Unexecuted instantiation: access_log.c:h2o_conn_is_early_data Unexecuted instantiation: file.c:h2o_conn_is_early_data Unexecuted instantiation: mimemap.c:h2o_conn_is_early_data proxy.c:h2o_conn_is_early_data Line | Count | Source | 2330 | 676 | { | 2331 | 676 | ptls_t *tls; | 2332 | 676 | if (conn->callbacks->get_ptls == NULL) | 2333 | 0 | return 0; | 2334 | 676 | if ((tls = conn->callbacks->get_ptls(conn)) == NULL) | 2335 | 676 | return 0; | 2336 | 0 | if (ptls_handshake_is_complete(tls)) | 2337 | 0 | return 0; | 2338 | 0 | return 1; | 2339 | 0 | } |
Unexecuted instantiation: http1.c:h2o_conn_is_early_data Unexecuted instantiation: connection.c:h2o_conn_is_early_data Unexecuted instantiation: scheduler.c:h2o_conn_is_early_data Unexecuted instantiation: stream.c:h2o_conn_is_early_data Unexecuted instantiation: http2_debug_state.c:h2o_conn_is_early_data Unexecuted instantiation: server.c:h2o_conn_is_early_data Unexecuted instantiation: absprio.c:h2o_conn_is_early_data Unexecuted instantiation: logconf.c:h2o_conn_is_early_data Unexecuted instantiation: compress.c:h2o_conn_is_early_data Unexecuted instantiation: gzip.c:h2o_conn_is_early_data Unexecuted instantiation: headers_util.c:h2o_conn_is_early_data Unexecuted instantiation: qpack.c:h2o_conn_is_early_data |
2340 | | |
2341 | | inline void h2o_proceed_response(h2o_req_t *req) |
2342 | 374 | { |
2343 | 374 | if (req->_generator != NULL) { |
2344 | 374 | req->_generator->proceed(req->_generator, req); |
2345 | 374 | } else { |
2346 | 0 | req->_ostr_top->do_send(req->_ostr_top, req, NULL, 0, H2O_SEND_STATE_FINAL); |
2347 | 0 | } |
2348 | 374 | } Unexecuted instantiation: driver.cc:h2o_proceed_response(st_h2o_req_t*) Unexecuted instantiation: driver_common.cc:h2o_proceed_response(st_h2o_req_t*) Unexecuted instantiation: config.c:h2o_proceed_response Unexecuted instantiation: configurator.c:h2o_proceed_response Unexecuted instantiation: context.c:h2o_proceed_response Unexecuted instantiation: headers.c:h2o_proceed_response Unexecuted instantiation: request.c:h2o_proceed_response Unexecuted instantiation: util.c:h2o_proceed_response Unexecuted instantiation: access_log.c:h2o_proceed_response Unexecuted instantiation: file.c:h2o_proceed_response Unexecuted instantiation: mimemap.c:h2o_proceed_response Unexecuted instantiation: proxy.c:h2o_proceed_response Unexecuted instantiation: http1.c:h2o_proceed_response Unexecuted instantiation: connection.c:h2o_proceed_response Unexecuted instantiation: scheduler.c:h2o_proceed_response stream.c:h2o_proceed_response Line | Count | Source | 2342 | 374 | { | 2343 | 374 | if (req->_generator != NULL) { | 2344 | 374 | req->_generator->proceed(req->_generator, req); | 2345 | 374 | } else { | 2346 | 0 | req->_ostr_top->do_send(req->_ostr_top, req, NULL, 0, H2O_SEND_STATE_FINAL); | 2347 | 0 | } | 2348 | 374 | } |
Unexecuted instantiation: http2_debug_state.c:h2o_proceed_response Unexecuted instantiation: server.c:h2o_proceed_response Unexecuted instantiation: absprio.c:h2o_proceed_response Unexecuted instantiation: logconf.c:h2o_proceed_response Unexecuted instantiation: compress.c:h2o_proceed_response Unexecuted instantiation: gzip.c:h2o_proceed_response Unexecuted instantiation: headers_util.c:h2o_proceed_response Unexecuted instantiation: qpack.c:h2o_proceed_response |
2349 | | |
2350 | | inline h2o_iovec_t *h2o_req_getenv(h2o_req_t *req, const char *name, size_t name_len, int allocate_if_not_found) |
2351 | 0 | { |
2352 | 0 | size_t i; |
2353 | 0 | for (i = 0; i != req->env.size; i += 2) |
2354 | 0 | if (h2o_memis(req->env.entries[i].base, req->env.entries[i].len, name, name_len)) |
2355 | 0 | return req->env.entries + i + 1; |
2356 | 0 | if (!allocate_if_not_found) |
2357 | 0 | return NULL; |
2358 | 0 | h2o_vector_reserve(&req->pool, &req->env, req->env.size + 2); |
2359 | 0 | req->env.entries[req->env.size++] = h2o_iovec_init(name, name_len); |
2360 | 0 | req->env.entries[req->env.size++] = h2o_iovec_init(NULL, 0); |
2361 | 0 | return req->env.entries + req->env.size - 1; |
2362 | 0 | } Unexecuted instantiation: driver.cc:h2o_req_getenv(st_h2o_req_t*, char const*, unsigned long, int) Unexecuted instantiation: driver_common.cc:h2o_req_getenv(st_h2o_req_t*, char const*, unsigned long, int) Unexecuted instantiation: config.c:h2o_req_getenv Unexecuted instantiation: configurator.c:h2o_req_getenv Unexecuted instantiation: context.c:h2o_req_getenv Unexecuted instantiation: headers.c:h2o_req_getenv Unexecuted instantiation: request.c:h2o_req_getenv Unexecuted instantiation: util.c:h2o_req_getenv Unexecuted instantiation: access_log.c:h2o_req_getenv Unexecuted instantiation: file.c:h2o_req_getenv Unexecuted instantiation: mimemap.c:h2o_req_getenv Unexecuted instantiation: proxy.c:h2o_req_getenv Unexecuted instantiation: http1.c:h2o_req_getenv Unexecuted instantiation: connection.c:h2o_req_getenv Unexecuted instantiation: scheduler.c:h2o_req_getenv Unexecuted instantiation: stream.c:h2o_req_getenv Unexecuted instantiation: http2_debug_state.c:h2o_req_getenv Unexecuted instantiation: server.c:h2o_req_getenv Unexecuted instantiation: absprio.c:h2o_req_getenv Unexecuted instantiation: logconf.c:h2o_req_getenv Unexecuted instantiation: compress.c:h2o_req_getenv Unexecuted instantiation: gzip.c:h2o_req_getenv Unexecuted instantiation: headers_util.c:h2o_req_getenv Unexecuted instantiation: qpack.c:h2o_req_getenv |
2363 | | |
2364 | | inline void h2o_req_unsetenv(h2o_req_t *req, const char *name, size_t name_len) |
2365 | 0 | { |
2366 | 0 | size_t i; |
2367 | 0 | for (i = 0; i != req->env.size; i += 2) |
2368 | 0 | if (h2o_memis(req->env.entries[i].base, req->env.entries[i].len, name, name_len)) |
2369 | 0 | goto Found; |
2370 | | /* not found */ |
2371 | 0 | return; |
2372 | 0 | Found: |
2373 | 0 | memmove(req->env.entries + i, req->env.entries + i + 2, req->env.size - i - 2); |
2374 | 0 | req->env.size -= 2; |
2375 | 0 | } Unexecuted instantiation: driver.cc:h2o_req_unsetenv(st_h2o_req_t*, char const*, unsigned long) Unexecuted instantiation: driver_common.cc:h2o_req_unsetenv(st_h2o_req_t*, char const*, unsigned long) Unexecuted instantiation: config.c:h2o_req_unsetenv Unexecuted instantiation: configurator.c:h2o_req_unsetenv Unexecuted instantiation: context.c:h2o_req_unsetenv Unexecuted instantiation: headers.c:h2o_req_unsetenv Unexecuted instantiation: request.c:h2o_req_unsetenv Unexecuted instantiation: util.c:h2o_req_unsetenv Unexecuted instantiation: access_log.c:h2o_req_unsetenv Unexecuted instantiation: file.c:h2o_req_unsetenv Unexecuted instantiation: mimemap.c:h2o_req_unsetenv Unexecuted instantiation: proxy.c:h2o_req_unsetenv Unexecuted instantiation: http1.c:h2o_req_unsetenv Unexecuted instantiation: connection.c:h2o_req_unsetenv Unexecuted instantiation: scheduler.c:h2o_req_unsetenv Unexecuted instantiation: stream.c:h2o_req_unsetenv Unexecuted instantiation: http2_debug_state.c:h2o_req_unsetenv Unexecuted instantiation: server.c:h2o_req_unsetenv Unexecuted instantiation: absprio.c:h2o_req_unsetenv Unexecuted instantiation: logconf.c:h2o_req_unsetenv Unexecuted instantiation: compress.c:h2o_req_unsetenv Unexecuted instantiation: gzip.c:h2o_req_unsetenv Unexecuted instantiation: headers_util.c:h2o_req_unsetenv Unexecuted instantiation: qpack.c:h2o_req_unsetenv |
2376 | | |
2377 | | inline int h2o_send_state_is_in_progress(h2o_send_state_t s) |
2378 | 9.50k | { |
2379 | 9.50k | return s == H2O_SEND_STATE_IN_PROGRESS; |
2380 | 9.50k | } Unexecuted instantiation: driver.cc:h2o_send_state_is_in_progress(h2o_send_state) Unexecuted instantiation: driver_common.cc:h2o_send_state_is_in_progress(h2o_send_state) Unexecuted instantiation: config.c:h2o_send_state_is_in_progress Unexecuted instantiation: configurator.c:h2o_send_state_is_in_progress Unexecuted instantiation: context.c:h2o_send_state_is_in_progress Unexecuted instantiation: headers.c:h2o_send_state_is_in_progress request.c:h2o_send_state_is_in_progress Line | Count | Source | 2378 | 4.60k | { | 2379 | 4.60k | return s == H2O_SEND_STATE_IN_PROGRESS; | 2380 | 4.60k | } |
Unexecuted instantiation: util.c:h2o_send_state_is_in_progress Unexecuted instantiation: access_log.c:h2o_send_state_is_in_progress Unexecuted instantiation: file.c:h2o_send_state_is_in_progress Unexecuted instantiation: mimemap.c:h2o_send_state_is_in_progress Unexecuted instantiation: proxy.c:h2o_send_state_is_in_progress Unexecuted instantiation: http1.c:h2o_send_state_is_in_progress Unexecuted instantiation: connection.c:h2o_send_state_is_in_progress Unexecuted instantiation: scheduler.c:h2o_send_state_is_in_progress stream.c:h2o_send_state_is_in_progress Line | Count | Source | 2378 | 4.89k | { | 2379 | 4.89k | return s == H2O_SEND_STATE_IN_PROGRESS; | 2380 | 4.89k | } |
Unexecuted instantiation: http2_debug_state.c:h2o_send_state_is_in_progress Unexecuted instantiation: server.c:h2o_send_state_is_in_progress Unexecuted instantiation: absprio.c:h2o_send_state_is_in_progress Unexecuted instantiation: logconf.c:h2o_send_state_is_in_progress Unexecuted instantiation: compress.c:h2o_send_state_is_in_progress Unexecuted instantiation: gzip.c:h2o_send_state_is_in_progress Unexecuted instantiation: headers_util.c:h2o_send_state_is_in_progress Unexecuted instantiation: qpack.c:h2o_send_state_is_in_progress |
2381 | | |
2382 | | inline void h2o_setup_next_ostream(h2o_req_t *req, h2o_ostream_t **slot) |
2383 | 4.23k | { |
2384 | 4.23k | h2o_filter_t *next; |
2385 | | |
2386 | 4.23k | if (req->_next_filter_index < req->num_filters) { |
2387 | 0 | next = req->filters[req->_next_filter_index++]; |
2388 | 0 | next->on_setup_ostream(next, req, slot); |
2389 | 0 | } |
2390 | 4.23k | } Unexecuted instantiation: driver.cc:h2o_setup_next_ostream(st_h2o_req_t*, st_h2o_ostream_t**) Unexecuted instantiation: driver_common.cc:h2o_setup_next_ostream(st_h2o_req_t*, st_h2o_ostream_t**) Unexecuted instantiation: config.c:h2o_setup_next_ostream Unexecuted instantiation: configurator.c:h2o_setup_next_ostream Unexecuted instantiation: context.c:h2o_setup_next_ostream Unexecuted instantiation: headers.c:h2o_setup_next_ostream request.c:h2o_setup_next_ostream Line | Count | Source | 2383 | 4.23k | { | 2384 | 4.23k | h2o_filter_t *next; | 2385 | | | 2386 | 4.23k | if (req->_next_filter_index < req->num_filters) { | 2387 | 0 | next = req->filters[req->_next_filter_index++]; | 2388 | 0 | next->on_setup_ostream(next, req, slot); | 2389 | 0 | } | 2390 | 4.23k | } |
Unexecuted instantiation: util.c:h2o_setup_next_ostream Unexecuted instantiation: access_log.c:h2o_setup_next_ostream Unexecuted instantiation: file.c:h2o_setup_next_ostream Unexecuted instantiation: mimemap.c:h2o_setup_next_ostream Unexecuted instantiation: proxy.c:h2o_setup_next_ostream Unexecuted instantiation: http1.c:h2o_setup_next_ostream Unexecuted instantiation: connection.c:h2o_setup_next_ostream Unexecuted instantiation: scheduler.c:h2o_setup_next_ostream Unexecuted instantiation: stream.c:h2o_setup_next_ostream Unexecuted instantiation: http2_debug_state.c:h2o_setup_next_ostream Unexecuted instantiation: server.c:h2o_setup_next_ostream Unexecuted instantiation: absprio.c:h2o_setup_next_ostream Unexecuted instantiation: logconf.c:h2o_setup_next_ostream Unexecuted instantiation: compress.c:h2o_setup_next_ostream Unexecuted instantiation: gzip.c:h2o_setup_next_ostream Unexecuted instantiation: headers_util.c:h2o_setup_next_ostream Unexecuted instantiation: qpack.c:h2o_setup_next_ostream |
2391 | | |
2392 | | inline void h2o_setup_next_prefilter(h2o_req_prefilter_t *self, h2o_req_t *req, h2o_ostream_t **slot) |
2393 | 0 | { |
2394 | 0 | h2o_req_prefilter_t *next = self->next; |
2395 | 0 |
|
2396 | 0 | if (next != NULL) |
2397 | 0 | next->on_setup_ostream(next, req, slot); |
2398 | 0 | else |
2399 | 0 | h2o_setup_next_ostream(req, slot); |
2400 | 0 | } Unexecuted instantiation: driver.cc:h2o_setup_next_prefilter(st_h2o_req_prefilter_t*, st_h2o_req_t*, st_h2o_ostream_t**) Unexecuted instantiation: driver_common.cc:h2o_setup_next_prefilter(st_h2o_req_prefilter_t*, st_h2o_req_t*, st_h2o_ostream_t**) Unexecuted instantiation: config.c:h2o_setup_next_prefilter Unexecuted instantiation: configurator.c:h2o_setup_next_prefilter Unexecuted instantiation: context.c:h2o_setup_next_prefilter Unexecuted instantiation: headers.c:h2o_setup_next_prefilter Unexecuted instantiation: request.c:h2o_setup_next_prefilter Unexecuted instantiation: util.c:h2o_setup_next_prefilter Unexecuted instantiation: access_log.c:h2o_setup_next_prefilter Unexecuted instantiation: file.c:h2o_setup_next_prefilter Unexecuted instantiation: mimemap.c:h2o_setup_next_prefilter Unexecuted instantiation: proxy.c:h2o_setup_next_prefilter Unexecuted instantiation: http1.c:h2o_setup_next_prefilter Unexecuted instantiation: connection.c:h2o_setup_next_prefilter Unexecuted instantiation: scheduler.c:h2o_setup_next_prefilter Unexecuted instantiation: stream.c:h2o_setup_next_prefilter Unexecuted instantiation: http2_debug_state.c:h2o_setup_next_prefilter Unexecuted instantiation: server.c:h2o_setup_next_prefilter Unexecuted instantiation: absprio.c:h2o_setup_next_prefilter Unexecuted instantiation: logconf.c:h2o_setup_next_prefilter Unexecuted instantiation: compress.c:h2o_setup_next_prefilter Unexecuted instantiation: gzip.c:h2o_setup_next_prefilter Unexecuted instantiation: headers_util.c:h2o_setup_next_prefilter Unexecuted instantiation: qpack.c:h2o_setup_next_prefilter |
2401 | | |
2402 | | inline h2o_timestamp_t h2o_get_timestamp(h2o_context_t *ctx, h2o_mem_pool_t *pool) |
2403 | 6.74k | { |
2404 | 6.74k | time_t prev_sec = ctx->_timestamp_cache.tv_at.tv_sec; |
2405 | 6.74k | ctx->_timestamp_cache.tv_at = h2o_gettimeofday(ctx->loop); |
2406 | 6.74k | if (ctx->_timestamp_cache.tv_at.tv_sec != prev_sec) |
2407 | 67 | h2o_context_update_timestamp_string_cache(ctx); |
2408 | | |
2409 | 6.74k | h2o_timestamp_t ts; |
2410 | 6.74k | ts.at = ctx->_timestamp_cache.tv_at; |
2411 | 6.74k | h2o_mem_link_shared(pool, ctx->_timestamp_cache.value); |
2412 | 6.74k | ts.str = ctx->_timestamp_cache.value; |
2413 | | |
2414 | 6.74k | return ts; |
2415 | 6.74k | } Unexecuted instantiation: driver.cc:h2o_get_timestamp(st_h2o_context_t*, st_h2o_mem_pool_t*) Unexecuted instantiation: driver_common.cc:h2o_get_timestamp(st_h2o_context_t*, st_h2o_mem_pool_t*) Unexecuted instantiation: config.c:h2o_get_timestamp Unexecuted instantiation: configurator.c:h2o_get_timestamp Unexecuted instantiation: context.c:h2o_get_timestamp Unexecuted instantiation: headers.c:h2o_get_timestamp request.c:h2o_get_timestamp Line | Count | Source | 2403 | 6.74k | { | 2404 | 6.74k | time_t prev_sec = ctx->_timestamp_cache.tv_at.tv_sec; | 2405 | 6.74k | ctx->_timestamp_cache.tv_at = h2o_gettimeofday(ctx->loop); | 2406 | 6.74k | if (ctx->_timestamp_cache.tv_at.tv_sec != prev_sec) | 2407 | 67 | h2o_context_update_timestamp_string_cache(ctx); | 2408 | | | 2409 | 6.74k | h2o_timestamp_t ts; | 2410 | 6.74k | ts.at = ctx->_timestamp_cache.tv_at; | 2411 | 6.74k | h2o_mem_link_shared(pool, ctx->_timestamp_cache.value); | 2412 | 6.74k | ts.str = ctx->_timestamp_cache.value; | 2413 | | | 2414 | 6.74k | return ts; | 2415 | 6.74k | } |
Unexecuted instantiation: util.c:h2o_get_timestamp Unexecuted instantiation: access_log.c:h2o_get_timestamp Unexecuted instantiation: file.c:h2o_get_timestamp Unexecuted instantiation: mimemap.c:h2o_get_timestamp Unexecuted instantiation: proxy.c:h2o_get_timestamp Unexecuted instantiation: http1.c:h2o_get_timestamp Unexecuted instantiation: connection.c:h2o_get_timestamp Unexecuted instantiation: scheduler.c:h2o_get_timestamp Unexecuted instantiation: stream.c:h2o_get_timestamp Unexecuted instantiation: http2_debug_state.c:h2o_get_timestamp Unexecuted instantiation: server.c:h2o_get_timestamp Unexecuted instantiation: absprio.c:h2o_get_timestamp Unexecuted instantiation: logconf.c:h2o_get_timestamp Unexecuted instantiation: compress.c:h2o_get_timestamp Unexecuted instantiation: gzip.c:h2o_get_timestamp Unexecuted instantiation: headers_util.c:h2o_get_timestamp Unexecuted instantiation: qpack.c:h2o_get_timestamp |
2416 | | |
2417 | | inline void *h2o_context_get_handler_context(h2o_context_t *ctx, h2o_handler_t *handler) |
2418 | 717 | { |
2419 | 717 | return ctx->_module_configs[handler->_config_slot]; |
2420 | 717 | } Unexecuted instantiation: driver.cc:h2o_context_get_handler_context(st_h2o_context_t*, st_h2o_handler_t*) Unexecuted instantiation: driver_common.cc:h2o_context_get_handler_context(st_h2o_context_t*, st_h2o_handler_t*) Unexecuted instantiation: config.c:h2o_context_get_handler_context Unexecuted instantiation: configurator.c:h2o_context_get_handler_context Unexecuted instantiation: context.c:h2o_context_get_handler_context Unexecuted instantiation: headers.c:h2o_context_get_handler_context Unexecuted instantiation: request.c:h2o_context_get_handler_context Unexecuted instantiation: util.c:h2o_context_get_handler_context Unexecuted instantiation: access_log.c:h2o_context_get_handler_context Unexecuted instantiation: file.c:h2o_context_get_handler_context Unexecuted instantiation: mimemap.c:h2o_context_get_handler_context proxy.c:h2o_context_get_handler_context Line | Count | Source | 2418 | 717 | { | 2419 | 717 | return ctx->_module_configs[handler->_config_slot]; | 2420 | 717 | } |
Unexecuted instantiation: http1.c:h2o_context_get_handler_context Unexecuted instantiation: connection.c:h2o_context_get_handler_context Unexecuted instantiation: scheduler.c:h2o_context_get_handler_context Unexecuted instantiation: stream.c:h2o_context_get_handler_context Unexecuted instantiation: http2_debug_state.c:h2o_context_get_handler_context Unexecuted instantiation: server.c:h2o_context_get_handler_context Unexecuted instantiation: absprio.c:h2o_context_get_handler_context Unexecuted instantiation: logconf.c:h2o_context_get_handler_context Unexecuted instantiation: compress.c:h2o_context_get_handler_context Unexecuted instantiation: gzip.c:h2o_context_get_handler_context Unexecuted instantiation: headers_util.c:h2o_context_get_handler_context Unexecuted instantiation: qpack.c:h2o_context_get_handler_context |
2421 | | |
2422 | | inline void h2o_context_set_handler_context(h2o_context_t *ctx, h2o_handler_t *handler, void *handler_ctx) |
2423 | 1 | { |
2424 | 1 | ctx->_module_configs[handler->_config_slot] = handler_ctx; |
2425 | 1 | } Unexecuted instantiation: driver.cc:h2o_context_set_handler_context(st_h2o_context_t*, st_h2o_handler_t*, void*) Unexecuted instantiation: driver_common.cc:h2o_context_set_handler_context(st_h2o_context_t*, st_h2o_handler_t*, void*) Unexecuted instantiation: config.c:h2o_context_set_handler_context Unexecuted instantiation: configurator.c:h2o_context_set_handler_context Unexecuted instantiation: context.c:h2o_context_set_handler_context Unexecuted instantiation: headers.c:h2o_context_set_handler_context Unexecuted instantiation: request.c:h2o_context_set_handler_context Unexecuted instantiation: util.c:h2o_context_set_handler_context Unexecuted instantiation: access_log.c:h2o_context_set_handler_context Unexecuted instantiation: file.c:h2o_context_set_handler_context Unexecuted instantiation: mimemap.c:h2o_context_set_handler_context proxy.c:h2o_context_set_handler_context Line | Count | Source | 2423 | 1 | { | 2424 | 1 | ctx->_module_configs[handler->_config_slot] = handler_ctx; | 2425 | 1 | } |
Unexecuted instantiation: http1.c:h2o_context_set_handler_context Unexecuted instantiation: connection.c:h2o_context_set_handler_context Unexecuted instantiation: scheduler.c:h2o_context_set_handler_context Unexecuted instantiation: stream.c:h2o_context_set_handler_context Unexecuted instantiation: http2_debug_state.c:h2o_context_set_handler_context Unexecuted instantiation: server.c:h2o_context_set_handler_context Unexecuted instantiation: absprio.c:h2o_context_set_handler_context Unexecuted instantiation: logconf.c:h2o_context_set_handler_context Unexecuted instantiation: compress.c:h2o_context_set_handler_context Unexecuted instantiation: gzip.c:h2o_context_set_handler_context Unexecuted instantiation: headers_util.c:h2o_context_set_handler_context Unexecuted instantiation: qpack.c:h2o_context_set_handler_context |
2426 | | |
2427 | | inline void *h2o_context_get_filter_context(h2o_context_t *ctx, h2o_filter_t *filter) |
2428 | 0 | { |
2429 | 0 | return ctx->_module_configs[filter->_config_slot]; |
2430 | 0 | } Unexecuted instantiation: driver.cc:h2o_context_get_filter_context(st_h2o_context_t*, st_h2o_filter_t*) Unexecuted instantiation: driver_common.cc:h2o_context_get_filter_context(st_h2o_context_t*, st_h2o_filter_t*) Unexecuted instantiation: config.c:h2o_context_get_filter_context Unexecuted instantiation: configurator.c:h2o_context_get_filter_context Unexecuted instantiation: context.c:h2o_context_get_filter_context Unexecuted instantiation: headers.c:h2o_context_get_filter_context Unexecuted instantiation: request.c:h2o_context_get_filter_context Unexecuted instantiation: util.c:h2o_context_get_filter_context Unexecuted instantiation: access_log.c:h2o_context_get_filter_context Unexecuted instantiation: file.c:h2o_context_get_filter_context Unexecuted instantiation: mimemap.c:h2o_context_get_filter_context Unexecuted instantiation: proxy.c:h2o_context_get_filter_context Unexecuted instantiation: http1.c:h2o_context_get_filter_context Unexecuted instantiation: connection.c:h2o_context_get_filter_context Unexecuted instantiation: scheduler.c:h2o_context_get_filter_context Unexecuted instantiation: stream.c:h2o_context_get_filter_context Unexecuted instantiation: http2_debug_state.c:h2o_context_get_filter_context Unexecuted instantiation: server.c:h2o_context_get_filter_context Unexecuted instantiation: absprio.c:h2o_context_get_filter_context Unexecuted instantiation: logconf.c:h2o_context_get_filter_context Unexecuted instantiation: compress.c:h2o_context_get_filter_context Unexecuted instantiation: gzip.c:h2o_context_get_filter_context Unexecuted instantiation: headers_util.c:h2o_context_get_filter_context Unexecuted instantiation: qpack.c:h2o_context_get_filter_context |
2431 | | |
2432 | | inline void h2o_context_set_filter_context(h2o_context_t *ctx, h2o_filter_t *filter, void *filter_ctx) |
2433 | 0 | { |
2434 | 0 | ctx->_module_configs[filter->_config_slot] = filter_ctx; |
2435 | 0 | } Unexecuted instantiation: driver.cc:h2o_context_set_filter_context(st_h2o_context_t*, st_h2o_filter_t*, void*) Unexecuted instantiation: driver_common.cc:h2o_context_set_filter_context(st_h2o_context_t*, st_h2o_filter_t*, void*) Unexecuted instantiation: config.c:h2o_context_set_filter_context Unexecuted instantiation: configurator.c:h2o_context_set_filter_context Unexecuted instantiation: context.c:h2o_context_set_filter_context Unexecuted instantiation: headers.c:h2o_context_set_filter_context Unexecuted instantiation: request.c:h2o_context_set_filter_context Unexecuted instantiation: util.c:h2o_context_set_filter_context Unexecuted instantiation: access_log.c:h2o_context_set_filter_context Unexecuted instantiation: file.c:h2o_context_set_filter_context Unexecuted instantiation: mimemap.c:h2o_context_set_filter_context Unexecuted instantiation: proxy.c:h2o_context_set_filter_context Unexecuted instantiation: http1.c:h2o_context_set_filter_context Unexecuted instantiation: connection.c:h2o_context_set_filter_context Unexecuted instantiation: scheduler.c:h2o_context_set_filter_context Unexecuted instantiation: stream.c:h2o_context_set_filter_context Unexecuted instantiation: http2_debug_state.c:h2o_context_set_filter_context Unexecuted instantiation: server.c:h2o_context_set_filter_context Unexecuted instantiation: absprio.c:h2o_context_set_filter_context Unexecuted instantiation: logconf.c:h2o_context_set_filter_context Unexecuted instantiation: compress.c:h2o_context_set_filter_context Unexecuted instantiation: gzip.c:h2o_context_set_filter_context Unexecuted instantiation: headers_util.c:h2o_context_set_filter_context Unexecuted instantiation: qpack.c:h2o_context_set_filter_context |
2436 | | |
2437 | | inline void *h2o_context_get_logger_context(h2o_context_t *ctx, h2o_logger_t *logger) |
2438 | 0 | { |
2439 | 0 | return ctx->_module_configs[logger->_config_slot]; |
2440 | 0 | } Unexecuted instantiation: driver.cc:h2o_context_get_logger_context(st_h2o_context_t*, st_h2o_logger_t*) Unexecuted instantiation: driver_common.cc:h2o_context_get_logger_context(st_h2o_context_t*, st_h2o_logger_t*) Unexecuted instantiation: config.c:h2o_context_get_logger_context Unexecuted instantiation: configurator.c:h2o_context_get_logger_context Unexecuted instantiation: context.c:h2o_context_get_logger_context Unexecuted instantiation: headers.c:h2o_context_get_logger_context Unexecuted instantiation: request.c:h2o_context_get_logger_context Unexecuted instantiation: util.c:h2o_context_get_logger_context Unexecuted instantiation: access_log.c:h2o_context_get_logger_context Unexecuted instantiation: file.c:h2o_context_get_logger_context Unexecuted instantiation: mimemap.c:h2o_context_get_logger_context Unexecuted instantiation: proxy.c:h2o_context_get_logger_context Unexecuted instantiation: http1.c:h2o_context_get_logger_context Unexecuted instantiation: connection.c:h2o_context_get_logger_context Unexecuted instantiation: scheduler.c:h2o_context_get_logger_context Unexecuted instantiation: stream.c:h2o_context_get_logger_context Unexecuted instantiation: http2_debug_state.c:h2o_context_get_logger_context Unexecuted instantiation: server.c:h2o_context_get_logger_context Unexecuted instantiation: absprio.c:h2o_context_get_logger_context Unexecuted instantiation: logconf.c:h2o_context_get_logger_context Unexecuted instantiation: compress.c:h2o_context_get_logger_context Unexecuted instantiation: gzip.c:h2o_context_get_logger_context Unexecuted instantiation: headers_util.c:h2o_context_get_logger_context Unexecuted instantiation: qpack.c:h2o_context_get_logger_context |
2441 | | |
2442 | | inline void **h2o_context_get_storage(h2o_context_t *ctx, size_t *key, void (*dispose_cb)(void *)) |
2443 | 0 | { |
2444 | | /* SIZE_MAX might not be available in case the file is included from a C++ source file */ |
2445 | 0 | size_t size_max = (size_t)-1; |
2446 | 0 | if (*key == size_max) |
2447 | 0 | *key = ctx->storage.size; |
2448 | 0 | if (ctx->storage.size <= *key) { |
2449 | 0 | h2o_vector_reserve(NULL, &ctx->storage, *key + 1); |
2450 | 0 | memset(ctx->storage.entries + ctx->storage.size, 0, (*key + 1 - ctx->storage.size) * sizeof(ctx->storage.entries[0])); |
2451 | 0 | ctx->storage.size = *key + 1; |
2452 | 0 | } |
2453 | |
|
2454 | 0 | ctx->storage.entries[*key].dispose = dispose_cb; |
2455 | 0 | return &ctx->storage.entries[*key].data; |
2456 | 0 | } Unexecuted instantiation: driver.cc:h2o_context_get_storage(st_h2o_context_t*, unsigned long*, void (*)(void*)) Unexecuted instantiation: driver_common.cc:h2o_context_get_storage(st_h2o_context_t*, unsigned long*, void (*)(void*)) Unexecuted instantiation: config.c:h2o_context_get_storage Unexecuted instantiation: configurator.c:h2o_context_get_storage Unexecuted instantiation: context.c:h2o_context_get_storage Unexecuted instantiation: headers.c:h2o_context_get_storage Unexecuted instantiation: request.c:h2o_context_get_storage Unexecuted instantiation: util.c:h2o_context_get_storage Unexecuted instantiation: access_log.c:h2o_context_get_storage Unexecuted instantiation: file.c:h2o_context_get_storage Unexecuted instantiation: mimemap.c:h2o_context_get_storage Unexecuted instantiation: proxy.c:h2o_context_get_storage Unexecuted instantiation: http1.c:h2o_context_get_storage Unexecuted instantiation: connection.c:h2o_context_get_storage Unexecuted instantiation: scheduler.c:h2o_context_get_storage Unexecuted instantiation: stream.c:h2o_context_get_storage Unexecuted instantiation: http2_debug_state.c:h2o_context_get_storage Unexecuted instantiation: server.c:h2o_context_get_storage Unexecuted instantiation: absprio.c:h2o_context_get_storage Unexecuted instantiation: logconf.c:h2o_context_get_storage Unexecuted instantiation: compress.c:h2o_context_get_storage Unexecuted instantiation: gzip.c:h2o_context_get_storage Unexecuted instantiation: headers_util.c:h2o_context_get_storage Unexecuted instantiation: qpack.c:h2o_context_get_storage |
2457 | | |
2458 | | static inline void h2o_context_set_logger_context(h2o_context_t *ctx, h2o_logger_t *logger, void *logger_ctx) |
2459 | 0 | { |
2460 | 0 | ctx->_module_configs[logger->_config_slot] = logger_ctx; |
2461 | 0 | } Unexecuted instantiation: driver.cc:h2o_context_set_logger_context(st_h2o_context_t*, st_h2o_logger_t*, void*) Unexecuted instantiation: driver_common.cc:h2o_context_set_logger_context(st_h2o_context_t*, st_h2o_logger_t*, void*) Unexecuted instantiation: config.c:h2o_context_set_logger_context Unexecuted instantiation: configurator.c:h2o_context_set_logger_context Unexecuted instantiation: context.c:h2o_context_set_logger_context Unexecuted instantiation: headers.c:h2o_context_set_logger_context Unexecuted instantiation: request.c:h2o_context_set_logger_context Unexecuted instantiation: util.c:h2o_context_set_logger_context Unexecuted instantiation: access_log.c:h2o_context_set_logger_context Unexecuted instantiation: file.c:h2o_context_set_logger_context Unexecuted instantiation: mimemap.c:h2o_context_set_logger_context Unexecuted instantiation: proxy.c:h2o_context_set_logger_context Unexecuted instantiation: http1.c:h2o_context_set_logger_context Unexecuted instantiation: connection.c:h2o_context_set_logger_context Unexecuted instantiation: scheduler.c:h2o_context_set_logger_context Unexecuted instantiation: stream.c:h2o_context_set_logger_context Unexecuted instantiation: http2_debug_state.c:h2o_context_set_logger_context Unexecuted instantiation: server.c:h2o_context_set_logger_context Unexecuted instantiation: absprio.c:h2o_context_set_logger_context Unexecuted instantiation: logconf.c:h2o_context_set_logger_context Unexecuted instantiation: compress.c:h2o_context_set_logger_context Unexecuted instantiation: gzip.c:h2o_context_set_logger_context Unexecuted instantiation: headers_util.c:h2o_context_set_logger_context Unexecuted instantiation: qpack.c:h2o_context_set_logger_context |
2462 | | |
2463 | | inline int h2o_req_can_stream_request(h2o_req_t *req) |
2464 | 486 | { |
2465 | 486 | h2o_handler_t *first_handler = h2o_get_first_handler(req); |
2466 | 486 | return first_handler != NULL && first_handler->supports_request_streaming; |
2467 | 486 | } Unexecuted instantiation: driver.cc:h2o_req_can_stream_request(st_h2o_req_t*) Unexecuted instantiation: driver_common.cc:h2o_req_can_stream_request(st_h2o_req_t*) Unexecuted instantiation: config.c:h2o_req_can_stream_request Unexecuted instantiation: configurator.c:h2o_req_can_stream_request Unexecuted instantiation: context.c:h2o_req_can_stream_request Unexecuted instantiation: headers.c:h2o_req_can_stream_request Unexecuted instantiation: request.c:h2o_req_can_stream_request Unexecuted instantiation: util.c:h2o_req_can_stream_request Unexecuted instantiation: access_log.c:h2o_req_can_stream_request Unexecuted instantiation: file.c:h2o_req_can_stream_request Unexecuted instantiation: mimemap.c:h2o_req_can_stream_request Unexecuted instantiation: proxy.c:h2o_req_can_stream_request Unexecuted instantiation: http1.c:h2o_req_can_stream_request connection.c:h2o_req_can_stream_request Line | Count | Source | 2464 | 486 | { | 2465 | 486 | h2o_handler_t *first_handler = h2o_get_first_handler(req); | 2466 | 486 | return first_handler != NULL && first_handler->supports_request_streaming; | 2467 | 486 | } |
Unexecuted instantiation: scheduler.c:h2o_req_can_stream_request Unexecuted instantiation: stream.c:h2o_req_can_stream_request Unexecuted instantiation: http2_debug_state.c:h2o_req_can_stream_request Unexecuted instantiation: server.c:h2o_req_can_stream_request Unexecuted instantiation: absprio.c:h2o_req_can_stream_request Unexecuted instantiation: logconf.c:h2o_req_can_stream_request Unexecuted instantiation: compress.c:h2o_req_can_stream_request Unexecuted instantiation: gzip.c:h2o_req_can_stream_request Unexecuted instantiation: headers_util.c:h2o_req_can_stream_request Unexecuted instantiation: qpack.c:h2o_req_can_stream_request |
2468 | | |
2469 | | #define COMPUTE_DURATION(name, from, until) \ |
2470 | | static inline int h2o_time_compute_##name(struct st_h2o_req_t *req, int64_t *delta_usec) \ |
2471 | 0 | { \ |
2472 | 0 | if (h2o_timeval_is_null((from)) || h2o_timeval_is_null((until))) { \ |
2473 | 0 | return 0; \ |
2474 | 0 | } \ |
2475 | 0 | *delta_usec = h2o_timeval_subtract((from), (until)); \ |
2476 | 0 | return 1; \ |
2477 | 0 | } Unexecuted instantiation: driver.cc:h2o_time_compute_connect_time(st_h2o_req_t*, long*) Unexecuted instantiation: driver.cc:h2o_time_compute_header_time(st_h2o_req_t*, long*) Unexecuted instantiation: driver.cc:h2o_time_compute_body_time(st_h2o_req_t*, long*) Unexecuted instantiation: driver.cc:h2o_time_compute_request_total_time(st_h2o_req_t*, long*) Unexecuted instantiation: driver.cc:h2o_time_compute_process_time(st_h2o_req_t*, long*) Unexecuted instantiation: driver.cc:h2o_time_compute_response_time(st_h2o_req_t*, long*) Unexecuted instantiation: driver.cc:h2o_time_compute_total_time(st_h2o_req_t*, long*) Unexecuted instantiation: driver.cc:h2o_time_compute_proxy_idle_time(st_h2o_req_t*, long*) Unexecuted instantiation: driver.cc:h2o_time_compute_proxy_connect_time(st_h2o_req_t*, long*) Unexecuted instantiation: driver.cc:h2o_time_compute_proxy_request_time(st_h2o_req_t*, long*) Unexecuted instantiation: driver.cc:h2o_time_compute_proxy_process_time(st_h2o_req_t*, long*) Unexecuted instantiation: driver.cc:h2o_time_compute_proxy_response_time(st_h2o_req_t*, long*) Unexecuted instantiation: driver.cc:h2o_time_compute_proxy_total_time(st_h2o_req_t*, long*) Unexecuted instantiation: driver_common.cc:h2o_time_compute_connect_time(st_h2o_req_t*, long*) Unexecuted instantiation: driver_common.cc:h2o_time_compute_header_time(st_h2o_req_t*, long*) Unexecuted instantiation: driver_common.cc:h2o_time_compute_body_time(st_h2o_req_t*, long*) Unexecuted instantiation: driver_common.cc:h2o_time_compute_request_total_time(st_h2o_req_t*, long*) Unexecuted instantiation: driver_common.cc:h2o_time_compute_process_time(st_h2o_req_t*, long*) Unexecuted instantiation: driver_common.cc:h2o_time_compute_response_time(st_h2o_req_t*, long*) Unexecuted instantiation: driver_common.cc:h2o_time_compute_total_time(st_h2o_req_t*, long*) Unexecuted instantiation: driver_common.cc:h2o_time_compute_proxy_idle_time(st_h2o_req_t*, long*) Unexecuted instantiation: driver_common.cc:h2o_time_compute_proxy_connect_time(st_h2o_req_t*, long*) Unexecuted instantiation: driver_common.cc:h2o_time_compute_proxy_request_time(st_h2o_req_t*, long*) Unexecuted instantiation: driver_common.cc:h2o_time_compute_proxy_process_time(st_h2o_req_t*, long*) Unexecuted instantiation: driver_common.cc:h2o_time_compute_proxy_response_time(st_h2o_req_t*, long*) Unexecuted instantiation: driver_common.cc:h2o_time_compute_proxy_total_time(st_h2o_req_t*, long*) Unexecuted instantiation: config.c:h2o_time_compute_connect_time Unexecuted instantiation: config.c:h2o_time_compute_header_time Unexecuted instantiation: config.c:h2o_time_compute_body_time Unexecuted instantiation: config.c:h2o_time_compute_request_total_time Unexecuted instantiation: config.c:h2o_time_compute_process_time Unexecuted instantiation: config.c:h2o_time_compute_response_time Unexecuted instantiation: config.c:h2o_time_compute_total_time Unexecuted instantiation: config.c:h2o_time_compute_proxy_idle_time Unexecuted instantiation: config.c:h2o_time_compute_proxy_connect_time Unexecuted instantiation: config.c:h2o_time_compute_proxy_request_time Unexecuted instantiation: config.c:h2o_time_compute_proxy_process_time Unexecuted instantiation: config.c:h2o_time_compute_proxy_response_time Unexecuted instantiation: config.c:h2o_time_compute_proxy_total_time Unexecuted instantiation: configurator.c:h2o_time_compute_connect_time Unexecuted instantiation: configurator.c:h2o_time_compute_header_time Unexecuted instantiation: configurator.c:h2o_time_compute_body_time Unexecuted instantiation: configurator.c:h2o_time_compute_request_total_time Unexecuted instantiation: configurator.c:h2o_time_compute_process_time Unexecuted instantiation: configurator.c:h2o_time_compute_response_time Unexecuted instantiation: configurator.c:h2o_time_compute_total_time Unexecuted instantiation: configurator.c:h2o_time_compute_proxy_idle_time Unexecuted instantiation: configurator.c:h2o_time_compute_proxy_connect_time Unexecuted instantiation: configurator.c:h2o_time_compute_proxy_request_time Unexecuted instantiation: configurator.c:h2o_time_compute_proxy_process_time Unexecuted instantiation: configurator.c:h2o_time_compute_proxy_response_time Unexecuted instantiation: configurator.c:h2o_time_compute_proxy_total_time Unexecuted instantiation: context.c:h2o_time_compute_connect_time Unexecuted instantiation: context.c:h2o_time_compute_header_time Unexecuted instantiation: context.c:h2o_time_compute_body_time Unexecuted instantiation: context.c:h2o_time_compute_request_total_time Unexecuted instantiation: context.c:h2o_time_compute_process_time Unexecuted instantiation: context.c:h2o_time_compute_response_time Unexecuted instantiation: context.c:h2o_time_compute_total_time Unexecuted instantiation: context.c:h2o_time_compute_proxy_idle_time Unexecuted instantiation: context.c:h2o_time_compute_proxy_connect_time Unexecuted instantiation: context.c:h2o_time_compute_proxy_request_time Unexecuted instantiation: context.c:h2o_time_compute_proxy_process_time Unexecuted instantiation: context.c:h2o_time_compute_proxy_response_time Unexecuted instantiation: context.c:h2o_time_compute_proxy_total_time Unexecuted instantiation: headers.c:h2o_time_compute_connect_time Unexecuted instantiation: headers.c:h2o_time_compute_header_time Unexecuted instantiation: headers.c:h2o_time_compute_body_time Unexecuted instantiation: headers.c:h2o_time_compute_request_total_time Unexecuted instantiation: headers.c:h2o_time_compute_process_time Unexecuted instantiation: headers.c:h2o_time_compute_response_time Unexecuted instantiation: headers.c:h2o_time_compute_total_time Unexecuted instantiation: headers.c:h2o_time_compute_proxy_idle_time Unexecuted instantiation: headers.c:h2o_time_compute_proxy_connect_time Unexecuted instantiation: headers.c:h2o_time_compute_proxy_request_time Unexecuted instantiation: headers.c:h2o_time_compute_proxy_process_time Unexecuted instantiation: headers.c:h2o_time_compute_proxy_response_time Unexecuted instantiation: headers.c:h2o_time_compute_proxy_total_time Unexecuted instantiation: request.c:h2o_time_compute_connect_time Unexecuted instantiation: request.c:h2o_time_compute_header_time Unexecuted instantiation: request.c:h2o_time_compute_body_time Unexecuted instantiation: request.c:h2o_time_compute_request_total_time Unexecuted instantiation: request.c:h2o_time_compute_process_time Unexecuted instantiation: request.c:h2o_time_compute_response_time Unexecuted instantiation: request.c:h2o_time_compute_total_time Unexecuted instantiation: request.c:h2o_time_compute_proxy_idle_time Unexecuted instantiation: request.c:h2o_time_compute_proxy_connect_time Unexecuted instantiation: request.c:h2o_time_compute_proxy_request_time Unexecuted instantiation: request.c:h2o_time_compute_proxy_process_time Unexecuted instantiation: request.c:h2o_time_compute_proxy_response_time Unexecuted instantiation: request.c:h2o_time_compute_proxy_total_time Unexecuted instantiation: util.c:h2o_time_compute_connect_time Unexecuted instantiation: util.c:h2o_time_compute_header_time Unexecuted instantiation: util.c:h2o_time_compute_body_time Unexecuted instantiation: util.c:h2o_time_compute_request_total_time Unexecuted instantiation: util.c:h2o_time_compute_process_time Unexecuted instantiation: util.c:h2o_time_compute_proxy_idle_time Unexecuted instantiation: util.c:h2o_time_compute_proxy_connect_time Unexecuted instantiation: util.c:h2o_time_compute_proxy_request_time Unexecuted instantiation: util.c:h2o_time_compute_proxy_process_time Unexecuted instantiation: util.c:h2o_time_compute_response_time Unexecuted instantiation: util.c:h2o_time_compute_total_time Unexecuted instantiation: util.c:h2o_time_compute_proxy_response_time Unexecuted instantiation: util.c:h2o_time_compute_proxy_total_time Unexecuted instantiation: access_log.c:h2o_time_compute_connect_time Unexecuted instantiation: access_log.c:h2o_time_compute_header_time Unexecuted instantiation: access_log.c:h2o_time_compute_body_time Unexecuted instantiation: access_log.c:h2o_time_compute_request_total_time Unexecuted instantiation: access_log.c:h2o_time_compute_process_time Unexecuted instantiation: access_log.c:h2o_time_compute_response_time Unexecuted instantiation: access_log.c:h2o_time_compute_total_time Unexecuted instantiation: access_log.c:h2o_time_compute_proxy_idle_time Unexecuted instantiation: access_log.c:h2o_time_compute_proxy_connect_time Unexecuted instantiation: access_log.c:h2o_time_compute_proxy_request_time Unexecuted instantiation: access_log.c:h2o_time_compute_proxy_process_time Unexecuted instantiation: access_log.c:h2o_time_compute_proxy_response_time Unexecuted instantiation: access_log.c:h2o_time_compute_proxy_total_time Unexecuted instantiation: file.c:h2o_time_compute_connect_time Unexecuted instantiation: file.c:h2o_time_compute_header_time Unexecuted instantiation: file.c:h2o_time_compute_body_time Unexecuted instantiation: file.c:h2o_time_compute_request_total_time Unexecuted instantiation: file.c:h2o_time_compute_process_time Unexecuted instantiation: file.c:h2o_time_compute_response_time Unexecuted instantiation: file.c:h2o_time_compute_total_time Unexecuted instantiation: file.c:h2o_time_compute_proxy_idle_time Unexecuted instantiation: file.c:h2o_time_compute_proxy_connect_time Unexecuted instantiation: file.c:h2o_time_compute_proxy_request_time Unexecuted instantiation: file.c:h2o_time_compute_proxy_process_time Unexecuted instantiation: file.c:h2o_time_compute_proxy_response_time Unexecuted instantiation: file.c:h2o_time_compute_proxy_total_time Unexecuted instantiation: mimemap.c:h2o_time_compute_connect_time Unexecuted instantiation: mimemap.c:h2o_time_compute_header_time Unexecuted instantiation: mimemap.c:h2o_time_compute_body_time Unexecuted instantiation: mimemap.c:h2o_time_compute_request_total_time Unexecuted instantiation: mimemap.c:h2o_time_compute_process_time Unexecuted instantiation: mimemap.c:h2o_time_compute_response_time Unexecuted instantiation: mimemap.c:h2o_time_compute_total_time Unexecuted instantiation: mimemap.c:h2o_time_compute_proxy_idle_time Unexecuted instantiation: mimemap.c:h2o_time_compute_proxy_connect_time Unexecuted instantiation: mimemap.c:h2o_time_compute_proxy_request_time Unexecuted instantiation: mimemap.c:h2o_time_compute_proxy_process_time Unexecuted instantiation: mimemap.c:h2o_time_compute_proxy_response_time Unexecuted instantiation: mimemap.c:h2o_time_compute_proxy_total_time Unexecuted instantiation: proxy.c:h2o_time_compute_connect_time Unexecuted instantiation: proxy.c:h2o_time_compute_header_time Unexecuted instantiation: proxy.c:h2o_time_compute_body_time Unexecuted instantiation: proxy.c:h2o_time_compute_request_total_time Unexecuted instantiation: proxy.c:h2o_time_compute_process_time Unexecuted instantiation: proxy.c:h2o_time_compute_response_time Unexecuted instantiation: proxy.c:h2o_time_compute_total_time Unexecuted instantiation: proxy.c:h2o_time_compute_proxy_idle_time Unexecuted instantiation: proxy.c:h2o_time_compute_proxy_connect_time Unexecuted instantiation: proxy.c:h2o_time_compute_proxy_request_time Unexecuted instantiation: proxy.c:h2o_time_compute_proxy_process_time Unexecuted instantiation: proxy.c:h2o_time_compute_proxy_response_time Unexecuted instantiation: proxy.c:h2o_time_compute_proxy_total_time Unexecuted instantiation: http1.c:h2o_time_compute_connect_time Unexecuted instantiation: http1.c:h2o_time_compute_header_time Unexecuted instantiation: http1.c:h2o_time_compute_body_time Unexecuted instantiation: http1.c:h2o_time_compute_request_total_time Unexecuted instantiation: http1.c:h2o_time_compute_process_time Unexecuted instantiation: http1.c:h2o_time_compute_response_time Unexecuted instantiation: http1.c:h2o_time_compute_total_time Unexecuted instantiation: http1.c:h2o_time_compute_proxy_idle_time Unexecuted instantiation: http1.c:h2o_time_compute_proxy_connect_time Unexecuted instantiation: http1.c:h2o_time_compute_proxy_request_time Unexecuted instantiation: http1.c:h2o_time_compute_proxy_process_time Unexecuted instantiation: http1.c:h2o_time_compute_proxy_response_time Unexecuted instantiation: http1.c:h2o_time_compute_proxy_total_time Unexecuted instantiation: connection.c:h2o_time_compute_connect_time Unexecuted instantiation: connection.c:h2o_time_compute_header_time Unexecuted instantiation: connection.c:h2o_time_compute_body_time Unexecuted instantiation: connection.c:h2o_time_compute_request_total_time Unexecuted instantiation: connection.c:h2o_time_compute_process_time Unexecuted instantiation: connection.c:h2o_time_compute_response_time Unexecuted instantiation: connection.c:h2o_time_compute_total_time Unexecuted instantiation: connection.c:h2o_time_compute_proxy_idle_time Unexecuted instantiation: connection.c:h2o_time_compute_proxy_connect_time Unexecuted instantiation: connection.c:h2o_time_compute_proxy_request_time Unexecuted instantiation: connection.c:h2o_time_compute_proxy_process_time Unexecuted instantiation: connection.c:h2o_time_compute_proxy_response_time Unexecuted instantiation: connection.c:h2o_time_compute_proxy_total_time Unexecuted instantiation: scheduler.c:h2o_time_compute_connect_time Unexecuted instantiation: scheduler.c:h2o_time_compute_header_time Unexecuted instantiation: scheduler.c:h2o_time_compute_body_time Unexecuted instantiation: scheduler.c:h2o_time_compute_request_total_time Unexecuted instantiation: scheduler.c:h2o_time_compute_process_time Unexecuted instantiation: scheduler.c:h2o_time_compute_response_time Unexecuted instantiation: scheduler.c:h2o_time_compute_total_time Unexecuted instantiation: scheduler.c:h2o_time_compute_proxy_idle_time Unexecuted instantiation: scheduler.c:h2o_time_compute_proxy_connect_time Unexecuted instantiation: scheduler.c:h2o_time_compute_proxy_request_time Unexecuted instantiation: scheduler.c:h2o_time_compute_proxy_process_time Unexecuted instantiation: scheduler.c:h2o_time_compute_proxy_response_time Unexecuted instantiation: scheduler.c:h2o_time_compute_proxy_total_time Unexecuted instantiation: stream.c:h2o_time_compute_connect_time Unexecuted instantiation: stream.c:h2o_time_compute_header_time Unexecuted instantiation: stream.c:h2o_time_compute_body_time Unexecuted instantiation: stream.c:h2o_time_compute_request_total_time Unexecuted instantiation: stream.c:h2o_time_compute_process_time Unexecuted instantiation: stream.c:h2o_time_compute_response_time Unexecuted instantiation: stream.c:h2o_time_compute_total_time Unexecuted instantiation: stream.c:h2o_time_compute_proxy_idle_time Unexecuted instantiation: stream.c:h2o_time_compute_proxy_connect_time Unexecuted instantiation: stream.c:h2o_time_compute_proxy_request_time Unexecuted instantiation: stream.c:h2o_time_compute_proxy_process_time Unexecuted instantiation: stream.c:h2o_time_compute_proxy_response_time Unexecuted instantiation: stream.c:h2o_time_compute_proxy_total_time Unexecuted instantiation: http2_debug_state.c:h2o_time_compute_connect_time Unexecuted instantiation: http2_debug_state.c:h2o_time_compute_header_time Unexecuted instantiation: http2_debug_state.c:h2o_time_compute_body_time Unexecuted instantiation: http2_debug_state.c:h2o_time_compute_request_total_time Unexecuted instantiation: http2_debug_state.c:h2o_time_compute_process_time Unexecuted instantiation: http2_debug_state.c:h2o_time_compute_response_time Unexecuted instantiation: http2_debug_state.c:h2o_time_compute_total_time Unexecuted instantiation: http2_debug_state.c:h2o_time_compute_proxy_idle_time Unexecuted instantiation: http2_debug_state.c:h2o_time_compute_proxy_connect_time Unexecuted instantiation: http2_debug_state.c:h2o_time_compute_proxy_request_time Unexecuted instantiation: http2_debug_state.c:h2o_time_compute_proxy_process_time Unexecuted instantiation: http2_debug_state.c:h2o_time_compute_proxy_response_time Unexecuted instantiation: http2_debug_state.c:h2o_time_compute_proxy_total_time Unexecuted instantiation: server.c:h2o_time_compute_connect_time Unexecuted instantiation: server.c:h2o_time_compute_header_time Unexecuted instantiation: server.c:h2o_time_compute_body_time Unexecuted instantiation: server.c:h2o_time_compute_request_total_time Unexecuted instantiation: server.c:h2o_time_compute_process_time Unexecuted instantiation: server.c:h2o_time_compute_response_time Unexecuted instantiation: server.c:h2o_time_compute_total_time Unexecuted instantiation: server.c:h2o_time_compute_proxy_idle_time Unexecuted instantiation: server.c:h2o_time_compute_proxy_connect_time Unexecuted instantiation: server.c:h2o_time_compute_proxy_request_time Unexecuted instantiation: server.c:h2o_time_compute_proxy_process_time Unexecuted instantiation: server.c:h2o_time_compute_proxy_response_time Unexecuted instantiation: server.c:h2o_time_compute_proxy_total_time Unexecuted instantiation: absprio.c:h2o_time_compute_connect_time Unexecuted instantiation: absprio.c:h2o_time_compute_header_time Unexecuted instantiation: absprio.c:h2o_time_compute_body_time Unexecuted instantiation: absprio.c:h2o_time_compute_request_total_time Unexecuted instantiation: absprio.c:h2o_time_compute_process_time Unexecuted instantiation: absprio.c:h2o_time_compute_response_time Unexecuted instantiation: absprio.c:h2o_time_compute_total_time Unexecuted instantiation: absprio.c:h2o_time_compute_proxy_idle_time Unexecuted instantiation: absprio.c:h2o_time_compute_proxy_connect_time Unexecuted instantiation: absprio.c:h2o_time_compute_proxy_request_time Unexecuted instantiation: absprio.c:h2o_time_compute_proxy_process_time Unexecuted instantiation: absprio.c:h2o_time_compute_proxy_response_time Unexecuted instantiation: absprio.c:h2o_time_compute_proxy_total_time Unexecuted instantiation: logconf.c:h2o_time_compute_connect_time Unexecuted instantiation: logconf.c:h2o_time_compute_header_time Unexecuted instantiation: logconf.c:h2o_time_compute_body_time Unexecuted instantiation: logconf.c:h2o_time_compute_request_total_time Unexecuted instantiation: logconf.c:h2o_time_compute_process_time Unexecuted instantiation: logconf.c:h2o_time_compute_response_time Unexecuted instantiation: logconf.c:h2o_time_compute_total_time Unexecuted instantiation: logconf.c:h2o_time_compute_proxy_idle_time Unexecuted instantiation: logconf.c:h2o_time_compute_proxy_connect_time Unexecuted instantiation: logconf.c:h2o_time_compute_proxy_request_time Unexecuted instantiation: logconf.c:h2o_time_compute_proxy_process_time Unexecuted instantiation: logconf.c:h2o_time_compute_proxy_response_time Unexecuted instantiation: logconf.c:h2o_time_compute_proxy_total_time Unexecuted instantiation: compress.c:h2o_time_compute_connect_time Unexecuted instantiation: compress.c:h2o_time_compute_header_time Unexecuted instantiation: compress.c:h2o_time_compute_body_time Unexecuted instantiation: compress.c:h2o_time_compute_request_total_time Unexecuted instantiation: compress.c:h2o_time_compute_process_time Unexecuted instantiation: compress.c:h2o_time_compute_response_time Unexecuted instantiation: compress.c:h2o_time_compute_total_time Unexecuted instantiation: compress.c:h2o_time_compute_proxy_idle_time Unexecuted instantiation: compress.c:h2o_time_compute_proxy_connect_time Unexecuted instantiation: compress.c:h2o_time_compute_proxy_request_time Unexecuted instantiation: compress.c:h2o_time_compute_proxy_process_time Unexecuted instantiation: compress.c:h2o_time_compute_proxy_response_time Unexecuted instantiation: compress.c:h2o_time_compute_proxy_total_time Unexecuted instantiation: gzip.c:h2o_time_compute_connect_time Unexecuted instantiation: gzip.c:h2o_time_compute_header_time Unexecuted instantiation: gzip.c:h2o_time_compute_body_time Unexecuted instantiation: gzip.c:h2o_time_compute_request_total_time Unexecuted instantiation: gzip.c:h2o_time_compute_process_time Unexecuted instantiation: gzip.c:h2o_time_compute_response_time Unexecuted instantiation: gzip.c:h2o_time_compute_total_time Unexecuted instantiation: gzip.c:h2o_time_compute_proxy_idle_time Unexecuted instantiation: gzip.c:h2o_time_compute_proxy_connect_time Unexecuted instantiation: gzip.c:h2o_time_compute_proxy_request_time Unexecuted instantiation: gzip.c:h2o_time_compute_proxy_process_time Unexecuted instantiation: gzip.c:h2o_time_compute_proxy_response_time Unexecuted instantiation: gzip.c:h2o_time_compute_proxy_total_time Unexecuted instantiation: headers_util.c:h2o_time_compute_connect_time Unexecuted instantiation: headers_util.c:h2o_time_compute_header_time Unexecuted instantiation: headers_util.c:h2o_time_compute_body_time Unexecuted instantiation: headers_util.c:h2o_time_compute_request_total_time Unexecuted instantiation: headers_util.c:h2o_time_compute_process_time Unexecuted instantiation: headers_util.c:h2o_time_compute_response_time Unexecuted instantiation: headers_util.c:h2o_time_compute_total_time Unexecuted instantiation: headers_util.c:h2o_time_compute_proxy_idle_time Unexecuted instantiation: headers_util.c:h2o_time_compute_proxy_connect_time Unexecuted instantiation: headers_util.c:h2o_time_compute_proxy_request_time Unexecuted instantiation: headers_util.c:h2o_time_compute_proxy_process_time Unexecuted instantiation: headers_util.c:h2o_time_compute_proxy_response_time Unexecuted instantiation: headers_util.c:h2o_time_compute_proxy_total_time Unexecuted instantiation: qpack.c:h2o_time_compute_connect_time Unexecuted instantiation: qpack.c:h2o_time_compute_header_time Unexecuted instantiation: qpack.c:h2o_time_compute_body_time Unexecuted instantiation: qpack.c:h2o_time_compute_request_total_time Unexecuted instantiation: qpack.c:h2o_time_compute_process_time Unexecuted instantiation: qpack.c:h2o_time_compute_response_time Unexecuted instantiation: qpack.c:h2o_time_compute_total_time Unexecuted instantiation: qpack.c:h2o_time_compute_proxy_idle_time Unexecuted instantiation: qpack.c:h2o_time_compute_proxy_connect_time Unexecuted instantiation: qpack.c:h2o_time_compute_proxy_request_time Unexecuted instantiation: qpack.c:h2o_time_compute_proxy_process_time Unexecuted instantiation: qpack.c:h2o_time_compute_proxy_response_time Unexecuted instantiation: qpack.c:h2o_time_compute_proxy_total_time |
2478 | | |
2479 | | COMPUTE_DURATION(connect_time, &req->conn->connected_at, &req->timestamps.request_begin_at) |
2480 | | COMPUTE_DURATION(header_time, &req->timestamps.request_begin_at, |
2481 | | h2o_timeval_is_null(&req->timestamps.request_body_begin_at) ? &req->processed_at.at |
2482 | | : &req->timestamps.request_body_begin_at) |
2483 | | COMPUTE_DURATION(body_time, |
2484 | | h2o_timeval_is_null(&req->timestamps.request_body_begin_at) ? &req->processed_at.at |
2485 | | : &req->timestamps.request_body_begin_at, |
2486 | | &req->processed_at.at) |
2487 | | COMPUTE_DURATION(request_total_time, &req->timestamps.request_begin_at, &req->processed_at.at) |
2488 | | COMPUTE_DURATION(process_time, &req->processed_at.at, &req->timestamps.response_start_at) |
2489 | | COMPUTE_DURATION(response_time, &req->timestamps.response_start_at, &req->timestamps.response_end_at) |
2490 | | COMPUTE_DURATION(total_time, &req->timestamps.request_begin_at, &req->timestamps.response_end_at) |
2491 | | |
2492 | | COMPUTE_DURATION(proxy_idle_time, &req->timestamps.request_begin_at, &req->proxy_stats.timestamps.start_at) |
2493 | | COMPUTE_DURATION(proxy_connect_time, &req->proxy_stats.timestamps.start_at, &req->proxy_stats.timestamps.request_begin_at) |
2494 | | COMPUTE_DURATION(proxy_request_time, &req->proxy_stats.timestamps.request_begin_at, &req->proxy_stats.timestamps.request_end_at) |
2495 | | COMPUTE_DURATION(proxy_process_time, &req->proxy_stats.timestamps.request_end_at, &req->proxy_stats.timestamps.response_start_at) |
2496 | | COMPUTE_DURATION(proxy_response_time, &req->proxy_stats.timestamps.response_start_at, &req->proxy_stats.timestamps.response_end_at) |
2497 | | COMPUTE_DURATION(proxy_total_time, &req->proxy_stats.timestamps.request_begin_at, &req->proxy_stats.timestamps.response_end_at) |
2498 | | |
2499 | | #undef COMPUTE_DURATION |
2500 | | |
2501 | | #ifdef __cplusplus |
2502 | | } |
2503 | | #endif |
2504 | | |
2505 | | #endif |