1 | /* Licensed to the Apache Software Foundation (ASF) under one or more |
2 | * contributor license agreements. See the NOTICE file distributed with |
3 | * this work for additional information regarding copyright ownership. |
4 | * The ASF licenses this file to You under the Apache License, Version 2.0 |
5 | * (the "License"); you may not use this file except in compliance with |
6 | * the License. You may obtain a copy of the License at |
7 | * |
8 | * http://www.apache.org/licenses/LICENSE-2.0 |
9 | * |
10 | * Unless required by applicable law or agreed to in writing, software |
11 | * distributed under the License is distributed on an "AS IS" BASIS, |
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
13 | * See the License for the specific language governing permissions and |
14 | * limitations under the License. |
15 | */ |
16 | |
17 | /** |
18 | * @file http_core.h |
19 | * @brief CORE HTTP Daemon |
20 | * |
21 | * @defgroup APACHE_CORE_HTTPD Core HTTP Daemon |
22 | * @ingroup APACHE_CORE |
23 | * @{ |
24 | */ |
25 | |
26 | #ifndef APACHE_HTTP_CORE_H |
27 | #define APACHE_HTTP_CORE_H |
28 | |
29 | #include "apr.h" |
30 | #include "apr_hash.h" |
31 | #include "apr_optional.h" |
32 | #include "util_filter.h" |
33 | |
34 | #if APR_HAVE_STRUCT_RLIMIT |
35 | #include <sys/time.h> |
36 | #include <sys/resource.h> |
37 | #endif |
38 | |
39 | |
40 | #ifdef __cplusplus |
41 | extern "C" { |
42 | #endif |
43 | |
44 | /* **************************************************************** |
45 | * |
46 | * The most basic server code is encapsulated in a single module |
47 | * known as the core, which is just *barely* functional enough to |
48 | * serve documents, though not terribly well. |
49 | * |
50 | * Largely for NCSA back-compatibility reasons, the core needs to |
51 | * make pieces of its config structures available to other modules. |
52 | * The accessors are declared here, along with the interpretation |
53 | * of one of them (allow_options). |
54 | */ |
55 | |
56 | /** |
57 | * @defgroup APACHE_CORE_HTTPD_ACESSORS Acessors |
58 | * |
59 | * @brief File/Directory Accessor directives |
60 | * |
61 | * @{ |
62 | */ |
63 | |
64 | /** No directives */ |
65 | #define OPT_NONE 0 |
66 | /** Indexes directive */ |
67 | #define OPT_INDEXES 1 |
68 | /** SSI is enabled without exec= permission */ |
69 | #define OPT_INCLUDES 2 |
70 | /** FollowSymLinks directive */ |
71 | #define OPT_SYM_LINKS 4 |
72 | /** ExecCGI directive */ |
73 | #define OPT_EXECCGI 8 |
74 | /** directive unset */ |
75 | #define OPT_UNSET 16 |
76 | /** IncludesNOEXEC directive */ |
77 | #define OPT_INCNOEXEC 32 |
78 | /** SymLinksIfOwnerMatch directive */ |
79 | #define OPT_SYM_OWNER 64 |
80 | /** MultiViews directive */ |
81 | #define OPT_MULTI 128 |
82 | /** All directives */ |
83 | #define OPT_ALL (OPT_INDEXES| : pass=4 |OPT_INCLUDES| : pass=4 |OPT_INCNOEXEC| : pass=4 |OPT_SYM_LINKS| : pass=4 |OPT_EXECCGI) |
84 | /** @} */ |
85 | |
86 | #ifdef CORE_PRIVATE |
87 | /* For internal use only - since 2.2.12, the OPT_INCNOEXEC bit is |
88 | * internally replaced by OPT_INC_WITH_EXEC. The internal semantics |
89 | * of the two SSI-related bits are hence: |
90 | * |
91 | * OPT_INCLUDES => "enable SSI, without exec= permission" |
92 | * OPT_INC_WITH_EXEC => "iff OPT_INCLUDES is set, also enable exec=" |
93 | * |
94 | * The set of options exposed via ap_allow_options() retains the |
95 | * semantics of OPT_INCNOEXEC by flipping the bit. */ |
96 | #define OPT_INC_WITH_EXEC OPT_INCNOEXEC |
97 | #endif |
98 | |
99 | /** |
100 | * @defgroup get_remote_host Remote Host Resolution |
101 | * @ingroup APACHE_CORE_HTTPD |
102 | * @{ |
103 | */ |
104 | /** REMOTE_HOST returns the hostname, or NULL if the hostname |
105 | * lookup fails. It will force a DNS lookup according to the |
106 | * HostnameLookups setting. |
107 | */ |
108 | #define REMOTE_HOST (0) |
109 | |
110 | /** REMOTE_NAME returns the hostname, or the dotted quad if the |
111 | * hostname lookup fails. It will force a DNS lookup according |
112 | * to the HostnameLookups setting. |
113 | */ |
114 | #define REMOTE_NAME (1) |
115 | |
116 | /** REMOTE_NOLOOKUP is like REMOTE_NAME except that a DNS lookup is |
117 | * never forced. |
118 | */ |
119 | #define REMOTE_NOLOOKUP (2) |
120 | |
121 | /** REMOTE_DOUBLE_REV will always force a DNS lookup, and also force |
122 | * a double reverse lookup, regardless of the HostnameLookups |
123 | * setting. The result is the (double reverse checked) hostname, |
124 | * or NULL if any of the lookups fail. |
125 | */ |
126 | #define REMOTE_DOUBLE_REV (3) |
127 | |
128 | /** @} // get_remote_host */ |
129 | |
130 | /** all of the requirements must be met */ |
131 | #define SATISFY_ALL 0 |
132 | /** any of the requirements must be met */ |
133 | #define SATISFY_ANY 1 |
134 | /** There are no applicable satisfy lines */ |
135 | #define SATISFY_NOSPEC 2 |
136 | |
137 | /** Make sure we don't write less than 8000 bytes at any one time. |
138 | */ |
139 | #define AP_MIN_BYTES_TO_WRITE 8000 |
140 | |
141 | /** default maximum of internal redirects */ |
142 | # define AP_DEFAULT_MAX_INTERNAL_REDIRECTS 10 |
143 | |
144 | /** default maximum subrequest nesting level */ |
145 | # define AP_DEFAULT_MAX_SUBREQ_DEPTH 10 |
146 | |
147 | /** |
148 | * Retrieve the value of Options for this request |
149 | * @param r The current request |
150 | * @return the Options bitmask |
151 | */ |
152 | AP_DECLARE(int) ap_allow_options(request_rec *r); |
153 | |
154 | /** |
155 | * Retrieve the value of the AllowOverride for this request |
156 | * @param r The current request |
157 | * @return the overrides bitmask |
158 | */ |
159 | AP_DECLARE(int) ap_allow_overrides(request_rec *r); |
160 | |
161 | /** |
162 | * Retrieve the value of the DefaultType directive, or text/plain if not set |
163 | * @param r The current request |
164 | * @return The default type |
165 | */ |
166 | AP_DECLARE(const char *) ap_default_type(request_rec *r); |
167 | |
168 | /** |
169 | * Retrieve the document root for this server |
170 | * @param r The current request |
171 | * @warning Don't use this! If your request went through a Userdir, or |
172 | * something like that, it'll screw you. But it's back-compatible... |
173 | * @return The document root |
174 | */ |
175 | AP_DECLARE(const char *) ap_document_root(request_rec *r); |
176 | |
177 | /** |
178 | * Lookup the remote client's DNS name or IP address |
179 | * @ingroup get_remote_host |
180 | * @param conn The current connection |
181 | * @param dir_config The directory config vector from the request |
182 | * @param type The type of lookup to perform. One of: |
183 | * <pre> |
184 | * REMOTE_HOST returns the hostname, or NULL if the hostname |
185 | * lookup fails. It will force a DNS lookup according to the |
186 | * HostnameLookups setting. |
187 | * REMOTE_NAME returns the hostname, or the dotted quad if the |
188 | * hostname lookup fails. It will force a DNS lookup according |
189 | * to the HostnameLookups setting. |
190 | * REMOTE_NOLOOKUP is like REMOTE_NAME except that a DNS lookup is |
191 | * never forced. |
192 | * REMOTE_DOUBLE_REV will always force a DNS lookup, and also force |
193 | * a double reverse lookup, regardless of the HostnameLookups |
194 | * setting. The result is the (double reverse checked) |
195 | * hostname, or NULL if any of the lookups fail. |
196 | * </pre> |
197 | * @param str_is_ip unless NULL is passed, this will be set to non-zero on output when an IP address |
198 | * string is returned |
199 | * @return The remote hostname |
200 | */ |
201 | AP_DECLARE(const char *) ap_get_remote_host(conn_rec *conn, void *dir_config, int type, int *str_is_ip); |
202 | |
203 | /** |
204 | * Retrieve the login name of the remote user. Undef if it could not be |
205 | * determined |
206 | * @param r The current request |
207 | * @return The user logged in to the client machine |
208 | */ |
209 | AP_DECLARE(const char *) ap_get_remote_logname(request_rec *r); |
210 | |
211 | /* Used for constructing self-referencing URLs, and things like SERVER_PORT, |
212 | * and SERVER_NAME. |
213 | */ |
214 | /** |
215 | * build a fully qualified URL from the uri and information in the request rec |
216 | * @param p The pool to allocate the URL from |
217 | * @param uri The path to the requested file |
218 | * @param r The current request |
219 | * @return A fully qualified URL |
220 | */ |
221 | AP_DECLARE(char *) ap_construct_url(apr_pool_t *p, const char *uri, request_rec *r); |
222 | |
223 | /** |
224 | * Get the current server name from the request |
225 | * @param r The current request |
226 | * @return the server name |
227 | */ |
228 | AP_DECLARE(const char *) ap_get_server_name(request_rec *r); |
229 | |
230 | /** |
231 | * Get the current server name from the request for the purposes |
232 | * of using in a URL. If the server name is an IPv6 literal |
233 | * address, it will be returned in URL format (e.g., "[fe80::1]"). |
234 | * @param r The current request |
235 | * @return the server name |
236 | */ |
237 | AP_DECLARE(const char *) ap_get_server_name_for_url(request_rec *r); |
238 | |
239 | /** |
240 | * Get the current server port |
241 | * @param r The current request |
242 | * @return The server's port |
243 | */ |
244 | AP_DECLARE(apr_port_t) ap_get_server_port(const request_rec *r); |
245 | |
246 | /** |
247 | * Return the limit on bytes in request msg body |
248 | * @param r The current request |
249 | * @return the maximum number of bytes in the request msg body |
250 | */ |
251 | AP_DECLARE(apr_off_t) ap_get_limit_req_body(const request_rec *r); |
252 | |
253 | /** |
254 | * Return the limit on bytes in XML request msg body |
255 | * @param r The current request |
256 | * @return the maximum number of bytes in XML request msg body |
257 | */ |
258 | AP_DECLARE(size_t) ap_get_limit_xml_body(const request_rec *r); |
259 | |
260 | /** |
261 | * Install a custom response handler for a given status |
262 | * @param r The current request |
263 | * @param status The status for which the custom response should be used |
264 | * @param string The custom response. This can be a static string, a file |
265 | * or a URL |
266 | */ |
267 | AP_DECLARE(void) ap_custom_response(request_rec *r, int status, const char *string); |
268 | |
269 | /** |
270 | * Check if the current request is beyond the configured max. number of redirects or subrequests |
271 | * @param r The current request |
272 | * @return true (is exceeded) or false |
273 | */ |
274 | AP_DECLARE(int) ap_is_recursion_limit_exceeded(const request_rec *r); |
275 | |
276 | /** |
277 | * Check for a definition from the server command line |
278 | * @param name The define to check for |
279 | * @return 1 if defined, 0 otherwise |
280 | */ |
281 | AP_DECLARE(int) ap_exists_config_define(const char *name); |
282 | /* FIXME! See STATUS about how */ |
283 | AP_DECLARE_NONSTD(int) ap_core_translate(request_rec *r); |
284 | |
285 | /* Authentication stuff. This is one of the places where compatibility |
286 | * with the old config files *really* hurts; they don't discriminate at |
287 | * all between different authentication schemes, meaning that we need |
288 | * to maintain common state for all of them in the core, and make it |
289 | * available to the other modules through interfaces. |
290 | */ |
291 | |
292 | /** @see require_line */ |
293 | typedef struct require_line require_line; |
294 | |
295 | /** |
296 | * @brief A structure to keep track of authorization requirements |
297 | */ |
298 | struct require_line { |
299 | /** Where the require line is in the config file. */ |
300 | apr_int64_t method_mask; |
301 | /** The complete string from the command line */ |
302 | char *requirement; |
303 | }; |
304 | |
305 | /** |
306 | * Return the type of authorization required for this request |
307 | * @param r The current request |
308 | * @return The authorization required |
309 | */ |
310 | AP_DECLARE(const char *) ap_auth_type(request_rec *r); |
311 | |
312 | /** |
313 | * Return the current Authorization realm |
314 | * @param r The current request |
315 | * @return The current authorization realm |
316 | */ |
317 | AP_DECLARE(const char *) ap_auth_name(request_rec *r); |
318 | |
319 | /** |
320 | * How the requires lines must be met. |
321 | * @param r The current request |
322 | * @return How the requirements must be met. One of: |
323 | * <pre> |
324 | * SATISFY_ANY -- any of the requirements must be met. |
325 | * SATISFY_ALL -- all of the requirements must be met. |
326 | * SATISFY_NOSPEC -- There are no applicable satisfy lines |
327 | * </pre> |
328 | */ |
329 | AP_DECLARE(int) ap_satisfies(request_rec *r); |
330 | |
331 | /** |
332 | * Retrieve information about all of the requires directives for this request |
333 | * @param r The current request |
334 | * @return An array of all requires directives for this request |
335 | */ |
336 | AP_DECLARE(const apr_array_header_t *) ap_requires(request_rec *r); |
337 | |
338 | #ifdef CORE_PRIVATE |
339 | |
340 | /** |
341 | * Core is also unlike other modules in being implemented in more than |
342 | * one file... so, data structures are declared here, even though most of |
343 | * the code that cares really is in http_core.c. Also, another accessor. |
344 | */ |
345 | AP_DECLARE_DATA extern module core_module; |
346 | |
347 | /** |
348 | * @brief Per-request configuration |
349 | */ |
350 | typedef struct { |
351 | /** bucket brigade used by getline for look-ahead and |
352 | * ap_get_client_block for holding left-over request body */ |
353 | struct apr_bucket_brigade *bb; |
354 | |
355 | /** an array of per-request working data elements, accessed |
356 | * by ID using ap_get_request_note() |
357 | * (Use ap_register_request_note() during initialization |
358 | * to add elements) |
359 | */ |
360 | void **notes; |
361 | |
362 | /** There is a script processor installed on the output filter chain, |
363 | * so it needs the default_handler to deliver a (script) file into |
364 | * the chain so it can process it. Normally, default_handler only |
365 | * serves files on a GET request (assuming the file is actual content), |
366 | * since other methods are not content-retrieval. This flag overrides |
367 | * that behavior, stating that the "content" is actually a script and |
368 | * won't actually be delivered as the response for the non-GET method. |
369 | */ |
370 | int deliver_script; |
371 | |
372 | /** Custom response strings registered via ap_custom_response(), |
373 | * or NULL; check per-dir config if nothing found here |
374 | */ |
375 | char **response_code_strings; /* from ap_custom_response(), not from |
376 | * ErrorDocument |
377 | */ |
378 | /** Should addition of charset= be suppressed for this request? |
379 | */ |
380 | int suppress_charset; |
381 | } core_request_config; |
382 | |
383 | /* Standard entries that are guaranteed to be accessible via |
384 | * ap_get_request_note() for each request (additional entries |
385 | * can be added with ap_register_request_note()) |
386 | */ |
387 | #define AP_NOTE_DIRECTORY_WALK 0 |
388 | #define AP_NOTE_LOCATION_WALK 1 |
389 | #define AP_NOTE_FILE_WALK 2 |
390 | #define AP_NUM_STD_NOTES 3 |
391 | |
392 | /** |
393 | * Reserve an element in the core_request_config->notes array |
394 | * for some application-specific data |
395 | * @return An integer key that can be passed to ap_get_request_note() |
396 | * during request processing to access this element for the |
397 | * current request. |
398 | */ |
399 | AP_DECLARE(apr_size_t) ap_register_request_note(void); |
400 | |
401 | /** |
402 | * Retrieve a pointer to an element in the core_request_config->notes array |
403 | * @param r The request |
404 | * @param note_num A key for the element: either a value obtained from |
405 | * ap_register_request_note() or one of the predefined AP_NOTE_* |
406 | * values. |
407 | * @return NULL if the note_num is invalid, otherwise a pointer to the |
408 | * requested note element. |
409 | * @remark At the start of a request, each note element is NULL. The |
410 | * handle provided by ap_get_request_note() is a pointer-to-pointer |
411 | * so that the caller can point the element to some app-specific |
412 | * data structure. The caller should guarantee that any such |
413 | * structure will last as long as the request itself. |
414 | */ |
415 | AP_DECLARE(void **) ap_get_request_note(request_rec *r, apr_size_t note_num); |
416 | |
417 | |
418 | typedef unsigned char allow_options_t; |
419 | typedef unsigned char overrides_t; |
420 | |
421 | /* |
422 | * Bits of info that go into making an ETag for a file |
423 | * document. Why a long? Because char historically |
424 | * proved too short for Options, and int can be different |
425 | * sizes on different platforms. |
426 | */ |
427 | typedef unsigned long etag_components_t; |
428 | |
429 | #define ETAG_UNSET 0 |
430 | #define ETAG_NONE (1 << : pass=0 << 0) |
431 | #define ETAG_MTIME (1 << : pass=0 << 1) |
432 | #define ETAG_INODE (1 << : pass=0 << 2) |
433 | #define ETAG_SIZE (1 << : pass=0 << 3) |
434 | #define ETAG_BACKWARD (ETAG_MTIME | : pass=0 | ETAG_INODE | : pass=0 | ETAG_SIZE) |
435 | #define ETAG_ALL (ETAG_MTIME | : pass=0 | ETAG_INODE | : pass=0 | ETAG_SIZE) |
436 | |
437 | /** |
438 | * @brief Server Signature Enumeration |
439 | */ |
440 | typedef enum { |
441 | srv_sig_unset, |
442 | srv_sig_off, |
443 | srv_sig_on, |
444 | srv_sig_withmail |
445 | } server_signature_e; |
446 | |
447 | /** |
448 | * @brief Per-directory configuration |
449 | */ |
450 | typedef struct { |
451 | /** path of the directory/regex/etc. see also d_is_fnmatch/absolute below */ |
452 | char *d; |
453 | /** the number of slashes in d */ |
454 | unsigned d_components; |
455 | |
456 | /** If (opts & OPT_UNSET) then no absolute assignment to options has |
457 | * been made. |
458 | * invariant: (opts_add & opts_remove) == 0 |
459 | * Which said another way means that the last relative (options + or -) |
460 | * assignment made to each bit is recorded in exactly one of opts_add |
461 | * or opts_remove. |
462 | */ |
463 | allow_options_t opts; |
464 | allow_options_t opts_add; |
465 | allow_options_t opts_remove; |
466 | overrides_t override; |
467 | allow_options_t override_opts; |
468 | |
469 | /* MIME typing --- the core doesn't do anything at all with this, |
470 | * but it does know what to slap on a request for a document which |
471 | * goes untyped by other mechanisms before it slips out the door... |
472 | */ |
473 | |
474 | char *ap_default_type; |
475 | |
476 | /* Authentication stuff. Groan... */ |
477 | |
478 | int *satisfy; /* for every method one */ |
479 | char *ap_auth_type; |
480 | char *ap_auth_name; |
481 | apr_array_header_t *ap_requires; |
482 | |
483 | /* Custom response config. These can contain text or a URL to redirect to. |
484 | * if response_code_strings is NULL then there are none in the config, |
485 | * if it's not null then it's allocated to sizeof(char*)*RESPONSE_CODES. |
486 | * This lets us do quick merges in merge_core_dir_configs(). |
487 | */ |
488 | |
489 | char **response_code_strings; /* from ErrorDocument, not from |
490 | * ap_custom_response() */ |
491 | |
492 | /* Hostname resolution etc */ |
493 | #define HOSTNAME_LOOKUP_OFF 0 |
494 | #define HOSTNAME_LOOKUP_ON 1 |
495 | #define HOSTNAME_LOOKUP_DOUBLE 2 |
496 | #define HOSTNAME_LOOKUP_UNSET 3 |
497 | unsigned int hostname_lookups : 4; |
498 | |
499 | signed int content_md5 : 2; /* calculate Content-MD5? */ |
500 | |
501 | #define USE_CANONICAL_NAME_OFF (0) |
502 | #define USE_CANONICAL_NAME_ON (1) |
503 | #define USE_CANONICAL_NAME_DNS (2) |
504 | #define USE_CANONICAL_NAME_UNSET (3) |
505 | unsigned use_canonical_name : 2; |
506 | |
507 | /* since is_fnmatch(conf->d) was being called so frequently in |
508 | * directory_walk() and its relatives, this field was created and |
509 | * is set to the result of that call. |
510 | */ |
511 | unsigned d_is_fnmatch : 1; |
512 | |
513 | /* should we force a charset on any outgoing parameterless content-type? |
514 | * if so, which charset? |
515 | */ |
516 | #define ADD_DEFAULT_CHARSET_OFF (0) |
517 | #define ADD_DEFAULT_CHARSET_ON (1) |
518 | #define ADD_DEFAULT_CHARSET_UNSET (2) |
519 | unsigned add_default_charset : 2; |
520 | const char *add_default_charset_name; |
521 | |
522 | /* System Resource Control */ |
523 | #ifdef RLIMIT_CPU |
524 | struct rlimit *limit_cpu; |
525 | #endif |
526 | #if defined (RLIMIT_DATA) || defined (RLIMIT_VMEM) || defined(RLIMIT_AS) |
527 | struct rlimit *limit_mem; |
528 | #endif |
529 | #ifdef RLIMIT_NPROC |
530 | struct rlimit *limit_nproc; |
531 | #endif |
532 | apr_off_t limit_req_body; /* limit on bytes in request msg body */ |
533 | long limit_xml_body; /* limit on bytes in XML request msg body */ |
534 | |
535 | /* logging options */ |
536 | |
537 | server_signature_e server_signature; |
538 | |
539 | int loglevel; |
540 | |
541 | /* Access control */ |
542 | apr_array_header_t *sec_file; |
543 | ap_regex_t *r; |
544 | |
545 | const char *mime_type; /* forced with ForceType */ |
546 | const char *handler; /* forced with SetHandler */ |
547 | const char *output_filters; /* forced with SetOutputFilters */ |
548 | const char *input_filters; /* forced with SetInputFilters */ |
549 | int accept_path_info; /* forced with AcceptPathInfo */ |
550 | |
551 | apr_hash_t *ct_output_filters; /* added with AddOutputFilterByType */ |
552 | |
553 | /* |
554 | * What attributes/data should be included in ETag generation? |
555 | */ |
556 | etag_components_t etag_bits; |
557 | etag_components_t etag_add; |
558 | etag_components_t etag_remove; |
559 | |
560 | /* |
561 | * Run-time performance tuning |
562 | */ |
563 | #define ENABLE_MMAP_OFF (0) |
564 | #define ENABLE_MMAP_ON (1) |
565 | #define ENABLE_MMAP_UNSET (2) |
566 | unsigned int enable_mmap : 2; /* whether files in this dir can be mmap'ed */ |
567 | |
568 | #define ENABLE_SENDFILE_OFF (0) |
569 | #define ENABLE_SENDFILE_ON (1) |
570 | #define ENABLE_SENDFILE_UNSET (2) |
571 | unsigned int enable_sendfile : 2; /* files in this dir can be mmap'ed */ |
572 | unsigned int allow_encoded_slashes : 1; /* URLs may contain %2f w/o being |
573 | * pitched indiscriminately */ |
574 | |
575 | #define USE_CANONICAL_PHYS_PORT_OFF (0) |
576 | #define USE_CANONICAL_PHYS_PORT_ON (1) |
577 | #define USE_CANONICAL_PHYS_PORT_UNSET (2) |
578 | unsigned use_canonical_phys_port : 2; |
579 | |
580 | |
581 | unsigned int decode_encoded_slashes : 1; /* whether to decode encoded slashes in URLs */ |
582 | |
583 | #define AP_MAXRANGES_UNSET -1 |
584 | #define AP_MAXRANGES_DEFAULT -2 |
585 | #define AP_MAXRANGES_UNLIMITED -3 |
586 | #define AP_MAXRANGES_NORANGES 0 |
587 | /** Number of Ranges before returning HTTP_OK. **/ |
588 | int max_ranges; |
589 | |
590 | } core_dir_config; |
591 | |
592 | /* Per-server core configuration */ |
593 | |
594 | typedef struct { |
595 | |
596 | #ifdef GPROF |
597 | char *gprof_dir; |
598 | #endif |
599 | |
600 | /* Name translations --- we want the core to be able to do *something* |
601 | * so it's at least a minimally functional web server on its own (and |
602 | * can be tested that way). But let's keep it to the bare minimum: |
603 | */ |
604 | const char *ap_document_root; |
605 | |
606 | /* Access control */ |
607 | |
608 | char *access_name; |
609 | apr_array_header_t *sec_dir; |
610 | apr_array_header_t *sec_url; |
611 | |
612 | /* recursion backstopper */ |
613 | int redirect_limit; /* maximum number of internal redirects */ |
614 | int subreq_limit; /* maximum nesting level of subrequests */ |
615 | |
616 | const char *protocol; |
617 | apr_table_t *accf_map; |
618 | |
619 | /* TRACE control */ |
620 | #define AP_TRACE_UNSET -1 |
621 | #define AP_TRACE_DISABLE 0 |
622 | #define AP_TRACE_ENABLE 1 |
623 | #define AP_TRACE_EXTENDED 2 |
624 | int trace_enable; |
625 | #define AP_MERGE_TRAILERS_UNSET 0 |
626 | #define AP_MERGE_TRAILERS_ENABLE 1 |
627 | #define AP_MERGE_TRAILERS_DISABLE 2 |
628 | int merge_trailers; |
629 | |
630 | } core_server_config; |
631 | |
632 | /* for AddOutputFiltersByType in core.c */ |
633 | void ap_add_output_filters_by_type(request_rec *r); |
634 | |
635 | /* for http_config.c */ |
636 | void ap_core_reorder_directories(apr_pool_t *, server_rec *); |
637 | |
638 | /* for mod_perl */ |
639 | AP_CORE_DECLARE(void) ap_add_per_dir_conf(server_rec *s, void *dir_config); |
640 | AP_CORE_DECLARE(void) ap_add_per_url_conf(server_rec *s, void *url_config); |
641 | AP_CORE_DECLARE(void) ap_add_file_conf(core_dir_config *conf, void *url_config); |
642 | AP_CORE_DECLARE_NONSTD(const char *) ap_limit_section(cmd_parms *cmd, void *dummy, const char *arg); |
643 | |
644 | /* Core filters; not exported. */ |
645 | int ap_core_input_filter(ap_filter_t *f, apr_bucket_brigade *b, |
646 | ap_input_mode_t mode, apr_read_type_e block, |
647 | apr_off_t readbytes); |
648 | apr_status_t ap_core_output_filter(ap_filter_t *f, apr_bucket_brigade *b); |
649 | |
650 | #endif /* CORE_PRIVATE */ |
651 | |
652 | AP_DECLARE(const char*) ap_get_server_protocol(server_rec* s); |
653 | AP_DECLARE(void) ap_set_server_protocol(server_rec* s, const char* proto); |
654 | |
655 | /* ---------------------------------------------------------------------- |
656 | * |
657 | * Runtime status/management |
658 | */ |
659 | |
660 | typedef enum { |
661 | ap_mgmt_type_string, |
662 | ap_mgmt_type_long, |
663 | ap_mgmt_type_hash |
664 | } ap_mgmt_type_e; |
665 | |
666 | typedef union { |
667 | const char *s_value; |
668 | long i_value; |
669 | apr_hash_t *h_value; |
670 | } ap_mgmt_value; |
671 | |
672 | typedef struct { |
673 | const char *description; |
674 | const char *name; |
675 | ap_mgmt_type_e vtype; |
676 | ap_mgmt_value v; |
677 | } ap_mgmt_item_t; |
678 | |
679 | /* Handles for core filters */ |
680 | extern AP_DECLARE_DATA ap_filter_rec_t *ap_subreq_core_filter_handle; |
681 | extern AP_DECLARE_DATA ap_filter_rec_t *ap_core_output_filter_handle; |
682 | extern AP_DECLARE_DATA ap_filter_rec_t *ap_content_length_filter_handle; |
683 | extern AP_DECLARE_DATA ap_filter_rec_t *ap_core_input_filter_handle; |
684 | |
685 | /** |
686 | * This hook provdes a way for modules to provide metrics/statistics about |
687 | * their operational status. |
688 | * |
689 | * @param p A pool to use to create entries in the hash table |
690 | * @param val The name of the parameter(s) that is wanted. This is |
691 | * tree-structured would be in the form ('*' is all the tree, |
692 | * 'module.*' all of the module , 'module.foo.*', or |
693 | * 'module.foo.bar' ) |
694 | * @param ht The hash table to store the results. Keys are item names, and |
695 | * the values point to ap_mgmt_item_t structures. |
696 | * @ingroup hooks |
697 | */ |
698 | AP_DECLARE_HOOK(int, get_mgmt_items, |
699 | (apr_pool_t *p, const char * val, apr_hash_t *ht)) |
700 | |
701 | /* ---------------------------------------------------------------------- */ |
702 | |
703 | /* ---------------------------------------------------------------------- |
704 | * |
705 | * I/O logging with mod_logio |
706 | */ |
707 | |
708 | APR_DECLARE_OPTIONAL_FN(void, ap_logio_add_bytes_out, |
709 | (conn_rec *c, apr_off_t bytes)); |
710 | |
711 | APR_DECLARE_OPTIONAL_FN(void, ap_logio_add_bytes_in, |
712 | (conn_rec *c, apr_off_t bytes)); |
713 | |
714 | /* ---------------------------------------------------------------------- |
715 | * |
716 | * ident lookups with mod_ident |
717 | */ |
718 | |
719 | APR_DECLARE_OPTIONAL_FN(const char *, ap_ident_lookup, |
720 | (request_rec *r)); |
721 | |
722 | /* ---------------------------------------------------------------------- */ |
723 | |
724 | #ifdef __cplusplus |
725 | } |
726 | #endif |
727 | |
728 | #endif /* !APACHE_HTTP_CORE_H */ |
729 | /** @} */ |
730 | [EOF] |