Apache HTTPD
core.c
Go to the documentation of this file.
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#include "apr.h"
18#include "apr_strings.h"
19#include "apr_lib.h"
20#include "apr_fnmatch.h"
21#include "apr_hash.h"
22#include "apr_thread_proc.h" /* for RLIMIT stuff */
23#include "apr_random.h"
24
25#include "apr_version.h"
26#if APR_MAJOR_VERSION < 2
27#include "apu_version.h"
28#endif
29
30#define APR_WANT_IOVEC
31#define APR_WANT_STRFUNC
32#define APR_WANT_MEMFUNC
33#include "apr_want.h"
34
35#include "ap_config.h"
36#include "httpd.h"
37#include "http_config.h"
38#include "http_core.h"
39#include "http_protocol.h" /* For index_of_response(). Grump. */
40#include "http_request.h"
41#include "http_ssl.h"
42#include "http_vhost.h"
43#include "http_main.h" /* For the default_handler below... */
44#include "http_log.h"
45#include "util_md5.h"
46#include "http_connection.h"
47#include "apr_buckets.h"
48#include "util_filter.h"
49#include "util_ebcdic.h"
50#include "util_mutex.h"
51#include "util_time.h"
52#include "mpm_common.h"
53#include "scoreboard.h"
54#include "mod_core.h"
55#include "mod_proxy.h"
56#include "ap_listen.h"
57#include "ap_regex.h"
58
59#include "mod_so.h" /* for ap_find_loaded_module_symbol */
60
61#if defined(RLIMIT_CPU) || defined (RLIMIT_DATA) || defined (RLIMIT_VMEM) || defined(RLIMIT_AS) || defined (RLIMIT_NPROC)
62#include "unixd.h"
63#endif
64#if APR_HAVE_UNISTD_H
65#include <unistd.h>
66#endif
67
68/* LimitRequestBody handling */
69#define AP_LIMIT_REQ_BODY_UNSET ((apr_off_t) -1)
70#define AP_DEFAULT_LIMIT_REQ_BODY ((apr_off_t) 1<<30) /* 1GB */
71
72/* LimitXMLRequestBody handling */
73#define AP_LIMIT_UNSET ((long) -1)
74#define AP_DEFAULT_LIMIT_XML_BODY ((apr_size_t)1000000)
75/* Hard limit for ap_escape_html2() */
76#define AP_MAX_LIMIT_XML_BODY ((apr_size_t)(APR_SIZE_MAX / 6 - 1))
77
78#define AP_MIN_SENDFILE_BYTES (256)
79
80/* maximum include nesting level */
81#ifndef AP_MAX_INCLUDE_DEPTH
82#define AP_MAX_INCLUDE_DEPTH (128)
83#endif
84
85/* valid in core-conf, but not in runtime r->used_path_info */
86#define AP_ACCEPT_PATHINFO_UNSET 3
87
88#define AP_CONTENT_MD5_OFF 0
89#define AP_CONTENT_MD5_ON 1
90#define AP_CONTENT_MD5_UNSET 2
91
92#define AP_FLUSH_MAX_THRESHOLD 65535
93#define AP_FLUSH_MAX_PIPELINED 4
94
100
102 (apr_pool_t *p, const char *val, apr_hash_t *ht),
104
109
114
115/* Server core module... This module provides support for really basic
116 * server operations, including options and commands which control the
117 * operation of other modules. Consider this the bureaucracy module.
118 *
119 * The core module also defines handlers, etc., to handle just enough
120 * to allow a server with the core module ONLY to actually serve documents.
121 *
122 * This file could almost be mod_core.c, except for the stuff which affects
123 * the http_conf_globals.
124 */
125
126/* we know core's module_index is 0 */
127#undef APLOG_MODULE_INDEX
128#define APLOG_MODULE_INDEX AP_CORE_MODULE_INDEX
129
130/* Handles for core filters */
135
136/* Provide ap_document_root_check storage and default value = true */
138
139/* magic pointer for ErrorDocument xxx "default" */
141
142/* Global state allocated out of pconf: variables here MUST be
143 * cleared/reset in reset_config(), a pconf cleanup, to avoid the
144 * variable getting reused after the pool is cleared. */
148
152
154{
155 core_dir_config *conf;
156
157 conf = (core_dir_config *)apr_pcalloc(a, sizeof(core_dir_config));
158
159 /* conf->r and conf->d[_*] are initialized by dirsection() or left NULL */
160
162 conf->opts_add = conf->opts_remove = OPT_NONE;
163 conf->override = OR_UNSET|OR_NONE;
165
168
171
173
174 /*
175 * left as NULL (we use apr_pcalloc):
176 * conf->limit_cpu = NULL;
177 * conf->limit_mem = NULL;
178 * conf->limit_nproc = NULL;
179 * conf->sec_file = NULL;
180 * conf->sec_if = NULL;
181 */
182
185
187
190
191 /* Overriding all negotiation
192 * Set NULL by apr_pcalloc:
193 * conf->mime_type = NULL;
194 * conf->handler = NULL;
195 * conf->output_filters = NULL;
196 * conf->input_filters = NULL;
197 */
198
199 /*
200 * Flag for use of inodes in ETags.
201 */
202 conf->etag_bits = ETAG_UNSET;
203 conf->etag_add = ETAG_UNSET;
204 conf->etag_remove = ETAG_UNSET;
205
208 conf->allow_encoded_slashes = 0;
209 conf->decode_encoded_slashes = 0;
210
214
217
218 return (void *)conf;
219}
220
221static void *merge_core_dir_configs(apr_pool_t *a, void *basev, void *newv)
222{
225 core_dir_config *conf;
226
227 /* Create this conf by duplicating the base, replacing elements
228 * (or creating copies for merging) where new-> values exist.
229 */
230 conf = (core_dir_config *)apr_pmemdup(a, base, sizeof(core_dir_config));
231
232 conf->d = new->d;
233 conf->d_is_fnmatch = new->d_is_fnmatch;
234 conf->d_components = new->d_components;
235 conf->r = new->r;
236 conf->refs = new->refs;
237 conf->condition = new->condition;
238
239 if (new->opts & OPT_UNSET) {
240 /* there was no explicit setting of new->opts, so we merge
241 * preserve the invariant (opts_add & opts_remove) == 0
242 */
243 conf->opts_add = (conf->opts_add & ~new->opts_remove) | new->opts_add;
244 conf->opts_remove = (conf->opts_remove & ~new->opts_add)
245 | new->opts_remove;
246 conf->opts = (conf->opts & ~conf->opts_remove) | conf->opts_add;
247
248 /* If Includes was enabled with exec in the base config, but
249 * was enabled without exec in the new config, then disable
250 * exec in the merged set. */
251 if (((base->opts & (OPT_INCLUDES|OPT_INC_WITH_EXEC))
253 && ((new->opts & (OPT_INCLUDES|OPT_INC_WITH_EXEC))
254 == OPT_INCLUDES)) {
255 conf->opts &= ~OPT_INC_WITH_EXEC;
256 }
257 }
258 else {
259 /* otherwise we just copy, because an explicit opts setting
260 * overrides all earlier +/- modifiers
261 */
262 conf->opts = new->opts;
263 conf->opts_add = new->opts_add;
264 conf->opts_remove = new->opts_remove;
265 }
266
267 if (!(new->override & OR_UNSET)) {
268 conf->override = new->override;
269 }
270
271 if (!(new->override_opts & OPT_UNSET)) {
272 conf->override_opts = new->override_opts;
273 }
274
275 if (new->override_list != NULL) {
276 conf->override_list = new->override_list;
277 }
278
279 if (conf->response_code_exprs == NULL) {
280 conf->response_code_exprs = new->response_code_exprs;
281 }
282 else if (new->response_code_exprs != NULL) {
284 new->response_code_exprs, conf->response_code_exprs);
285 }
286 /* Otherwise we simply use the base->response_code_exprs array
287 */
288
289 if (new->hostname_lookups != HOSTNAME_LOOKUP_UNSET) {
290 conf->hostname_lookups = new->hostname_lookups;
291 }
292
293 if (new->content_md5 != AP_CONTENT_MD5_UNSET) {
294 conf->content_md5 = new->content_md5;
295 }
296
297 if (new->accept_path_info != AP_ACCEPT_PATHINFO_UNSET) {
298 conf->accept_path_info = new->accept_path_info;
299 }
300
301 if (new->use_canonical_name != USE_CANONICAL_NAME_UNSET) {
302 conf->use_canonical_name = new->use_canonical_name;
303 }
304
305 if (new->use_canonical_phys_port != USE_CANONICAL_PHYS_PORT_UNSET) {
306 conf->use_canonical_phys_port = new->use_canonical_phys_port;
307 }
308
309#ifdef RLIMIT_CPU
310 if (new->limit_cpu) {
311 conf->limit_cpu = new->limit_cpu;
312 }
313#endif
314
315#if defined(RLIMIT_DATA) || defined(RLIMIT_VMEM) || defined(RLIMIT_AS)
316 if (new->limit_mem) {
317 conf->limit_mem = new->limit_mem;
318 }
319#endif
320
321#ifdef RLIMIT_NPROC
322 if (new->limit_nproc) {
323 conf->limit_nproc = new->limit_nproc;
324 }
325#endif
326
327 if (new->limit_req_body != AP_LIMIT_REQ_BODY_UNSET) {
328 conf->limit_req_body = new->limit_req_body;
329 }
330
331 if (new->limit_xml_body != AP_LIMIT_UNSET)
332 conf->limit_xml_body = new->limit_xml_body;
333
334 if (!conf->sec_file) {
335 conf->sec_file = new->sec_file;
336 }
337 else if (new->sec_file) {
338 /* If we merge, the merge-result must have its own array
339 */
340 conf->sec_file = apr_array_append(a, base->sec_file, new->sec_file);
341 }
342 /* Otherwise we simply use the base->sec_file array
343 */
344
345 if (!conf->sec_if) {
346 conf->sec_if = new->sec_if;
347 }
348 else if (new->sec_if) {
349 /* If we merge, the merge-result must have its own array
350 */
351 conf->sec_if = apr_array_append(a, base->sec_if, new->sec_if);
352 }
353 /* Otherwise we simply use the base->sec_if array
354 */
355
356 if (new->server_signature != srv_sig_unset) {
357 conf->server_signature = new->server_signature;
358 }
359
360 if (new->add_default_charset != ADD_DEFAULT_CHARSET_UNSET) {
361 conf->add_default_charset = new->add_default_charset;
362 conf->add_default_charset_name = new->add_default_charset_name;
363 }
364
365 /* Overriding all negotiation
366 */
367 if (new->mime_type) {
368 conf->mime_type = new->mime_type;
369 }
370
371 if (new->handler) {
372 conf->handler = new->handler;
373 }
374 if (new->expr_handler) {
375 conf->expr_handler = new->expr_handler;
376 }
377
378 if (new->output_filters) {
379 conf->output_filters = new->output_filters;
380 }
381
382 if (new->input_filters) {
383 conf->input_filters = new->input_filters;
384 }
385
386 /*
387 * Now merge the setting of the FileETag directive.
388 */
389 if (new->etag_bits == ETAG_UNSET) {
390 conf->etag_add =
391 (conf->etag_add & (~ new->etag_remove)) | new->etag_add;
392 conf->etag_remove =
393 (conf->etag_remove & (~ new->etag_add)) | new->etag_remove;
394 conf->etag_bits =
395 (conf->etag_bits & (~ conf->etag_remove)) | conf->etag_add;
396 }
397 else {
398 conf->etag_bits = new->etag_bits;
399 conf->etag_add = new->etag_add;
400 conf->etag_remove = new->etag_remove;
401 }
402
403 if (conf->etag_bits != ETAG_NONE) {
404 conf->etag_bits &= (~ ETAG_NONE);
405 }
406
407 if (new->enable_mmap != ENABLE_MMAP_UNSET) {
408 conf->enable_mmap = new->enable_mmap;
409 }
410
411 if (new->enable_sendfile != ENABLE_SENDFILE_UNSET) {
412 conf->enable_sendfile = new->enable_sendfile;
413 }
414
415 if (new->read_buf_size) {
416 conf->read_buf_size = new->read_buf_size;
417 }
418 else {
419 conf->read_buf_size = base->read_buf_size;
420 }
421
422 conf->allow_encoded_slashes = new->allow_encoded_slashes;
423 conf->decode_encoded_slashes = new->decode_encoded_slashes;
424
425 if (new->log) {
426 if (!conf->log) {
427 conf->log = new->log;
428 }
429 else {
430 conf->log = ap_new_log_config(a, new->log);
431 ap_merge_log_config(base->log, conf->log);
432 }
433 }
434
435 conf->max_ranges = new->max_ranges != AP_MAXRANGES_UNSET ? new->max_ranges : base->max_ranges;
436 conf->max_overlaps = new->max_overlaps != AP_MAXRANGES_UNSET ? new->max_overlaps : base->max_overlaps;
437 conf->max_reversals = new->max_reversals != AP_MAXRANGES_UNSET ? new->max_reversals : base->max_reversals;
438
439 conf->cgi_pass_auth = new->cgi_pass_auth != AP_CGI_PASS_AUTH_UNSET ? new->cgi_pass_auth : base->cgi_pass_auth;
440
441 if (new->cgi_var_rules) {
442 if (!conf->cgi_var_rules) {
443 conf->cgi_var_rules = new->cgi_var_rules;
444 }
445 else {
446 conf->cgi_var_rules = apr_hash_overlay(a, new->cgi_var_rules, conf->cgi_var_rules);
447 }
448 }
449
450 AP_CORE_MERGE_FLAG(qualify_redirect_url, conf, base, new);
451
452 return (void*)conf;
453}
454
455#if APR_HAS_SO_ACCEPTFILTER
456#ifndef ACCEPT_FILTER_NAME
457#define ACCEPT_FILTER_NAME "httpready"
458#ifdef __FreeBSD_version
459#if __FreeBSD_version < 411000 /* httpready broken before 4.1.1 */
460#undef ACCEPT_FILTER_NAME
461#define ACCEPT_FILTER_NAME "dataready"
462#endif
463#endif
464#endif
465#endif
466
468{
469 core_server_config *conf;
470 int is_virtual = s->is_virtual;
471
473
474 /* global-default / global-only settings */
475
476 if (!is_virtual) {
479
480 /* A mapping only makes sense in the global context */
481 conf->accf_map = apr_table_make(a, 5);
482#if APR_HAS_SO_ACCEPTFILTER
484 apr_table_setn(conf->accf_map, "https", "dataready");
485#elif defined(WIN32)
486 /* 'data' is disabled on Windows due to a DoS vuln (PR 59970) */
487 apr_table_setn(conf->accf_map, "http", "connect");
488 apr_table_setn(conf->accf_map, "https", "connect");
489#else
490 apr_table_setn(conf->accf_map, "http", "data");
491 apr_table_setn(conf->accf_map, "https", "data");
492#endif
493
496 }
497 else {
498 /* Use main ErrorLogFormat while the vhost is loading */
501 conf->error_log_format = main_conf->error_log_format;
502
503 conf->flush_max_pipelined = -1;
504 }
505
506 /* initialization, no special case for global context */
507
508 conf->sec_dir = apr_array_make(a, 40, sizeof(ap_conf_vector_t *));
509 conf->sec_url = apr_array_make(a, 40, sizeof(ap_conf_vector_t *));
510
511 /* pcalloc'ed - we have NULL's/0's
512 conf->gprof_dir = NULL;
513
514 ** recursion stopper; 0 == unset
515 conf->redirect_limit = 0;
516 conf->subreq_limit = 0;
517
518 conf->protocol = NULL;
519 */
520
522
523 conf->protocols = apr_array_make(a, 5, sizeof(const char *));
524 conf->protocols_honor_order = -1;
526
528
529 return (void *)conf;
530}
531
533{
538
539 if (virt->ap_document_root)
540 conf->ap_document_root = virt->ap_document_root;
541
542 if (virt->access_name)
543 conf->access_name = virt->access_name;
544
545 /* XXX optimize to keep base->sec_ pointers if virt->sec_ array is empty */
546 conf->sec_dir = apr_array_append(p, base->sec_dir, virt->sec_dir);
547 conf->sec_url = apr_array_append(p, base->sec_url, virt->sec_url);
548
549 if (virt->redirect_limit)
550 conf->redirect_limit = virt->redirect_limit;
551
552 if (virt->subreq_limit)
553 conf->subreq_limit = virt->subreq_limit;
554
555 if (virt->trace_enable != AP_TRACE_UNSET)
556 conf->trace_enable = virt->trace_enable;
557
558 if (virt->http09_enable != AP_HTTP09_UNSET)
559 conf->http09_enable = virt->http09_enable;
560
561 if (virt->http_conformance != AP_HTTP_CONFORMANCE_UNSET)
562 conf->http_conformance = virt->http_conformance;
563
564 if (virt->http_methods != AP_HTTP_METHODS_UNSET)
565 conf->http_methods = virt->http_methods;
566
567 /* no action for virt->accf_map, not allowed per-vhost */
568
569 if (virt->protocol)
570 conf->protocol = virt->protocol;
571
572 if (virt->gprof_dir)
573 conf->gprof_dir = virt->gprof_dir;
574
575 if (virt->error_log_format)
576 conf->error_log_format = virt->error_log_format;
577
578 if (virt->error_log_conn)
579 conf->error_log_conn = virt->error_log_conn;
580
581 if (virt->error_log_req)
582 conf->error_log_req = virt->error_log_req;
583
584 conf->merge_trailers = (virt->merge_trailers != AP_MERGE_TRAILERS_UNSET)
585 ? virt->merge_trailers
586 : base->merge_trailers;
587
588 conf->protocols = ((virt->protocols->nelts > 0)?
589 virt->protocols : base->protocols);
590 conf->protocols_honor_order = ((virt->protocols_honor_order < 0)?
591 base->protocols_honor_order :
592 virt->protocols_honor_order);
593 AP_CORE_MERGE_FLAG(merge_slashes, conf, base, virt);
594
595
596 conf->flush_max_threshold = (virt->flush_max_threshold)
597 ? virt->flush_max_threshold
598 : base->flush_max_threshold;
599 conf->flush_max_pipelined = (virt->flush_max_pipelined >= 0)
600 ? virt->flush_max_pipelined
601 : base->flush_max_pipelined;
602
603 conf->strict_host_check = (virt->strict_host_check != AP_CORE_CONFIG_UNSET)
604 ? virt->strict_host_check
605 : base->strict_host_check;
606
607 AP_CORE_MERGE_FLAG(strict_host_check, conf, base, virt);
608
609 return conf;
610}
611
612/* Add per-directory configuration entry (for <directory> section);
613 * these are part of the core server config.
614 */
615
617{
619 void **new_space = (void **)apr_array_push(sconf->sec_dir);
620
622}
623
625{
627 void **new_space = (void **)apr_array_push(sconf->sec_url);
628
630}
631
633 void *url_config)
634{
635 void **new_space;
636
637 if (!conf->sec_file)
638 conf->sec_file = apr_array_make(p, 2, sizeof(ap_conf_vector_t *));
639
640 new_space = (void **)apr_array_push(conf->sec_file);
642}
643
645 core_dir_config *conf,
646 void *if_config)
647{
648 void **new_space;
649 core_dir_config *new = ap_get_module_config(if_config, &core_module);
650
651 if (!conf->sec_if) {
652 conf->sec_if = apr_array_make(p, 2, sizeof(ap_conf_vector_t *));
653 }
654 if (new->condition_ifelse & AP_CONDITION_ELSE) {
655 int have_if = 0;
656 if (conf->sec_if->nelts > 0) {
659 conf->sec_if->nelts - 1,
661 last = ap_get_module_config(lastelt, &core_module);
662 if (last->condition_ifelse & AP_CONDITION_IF)
663 have_if = 1;
664 }
665 if (!have_if)
666 return "<Else> or <ElseIf> section without previous <If> or "
667 "<ElseIf> section in same scope";
668 }
669
670 new_space = (void **)apr_array_push(conf->sec_if);
672 return NULL;
673}
674
675
676/* We need to do a stable sort, qsort isn't stable. So to make it stable
677 * we'll be maintaining the original index into the list, and using it
678 * as the minor key during sorting. The major key is the number of
679 * components (where the root component is zero).
680 */
685
686static int reorder_sorter(const void *va, const void *vb)
687{
688 const struct reorder_sort_rec *a = va;
689 const struct reorder_sort_rec *b = vb;
692
695
696 /* a regex always sorts after a non-regex
697 */
698 if (!core_a->r && core_b->r) {
699 return -1;
700 }
701 else if (core_a->r && !core_b->r) {
702 return 1;
703 }
704
705 /* we always sort next by the number of components
706 */
707 if (core_a->d_components < core_b->d_components) {
708 return -1;
709 }
710 else if (core_a->d_components > core_b->d_components) {
711 return 1;
712 }
713
714 /* They have the same number of components, we now have to compare
715 * the minor key to maintain the original order (from the config.)
716 */
717 return a->orig_index - b->orig_index;
718}
719
721{
723 apr_array_header_t *sec_dir;
725 int nelts;
726 ap_conf_vector_t **elts;
727 int i;
728 apr_pool_t *tmp;
729
730 sconf = ap_get_core_module_config(s->module_config);
731 sec_dir = sconf->sec_dir;
732 nelts = sec_dir->nelts;
733 elts = (ap_conf_vector_t **)sec_dir->elts;
734
735 if (!nelts) {
736 /* simple case of already being sorted... */
737 /* We're not checking this condition to be fast... we're checking
738 * it to avoid trying to palloc zero bytes, which can trigger some
739 * memory debuggers to barf
740 */
741 return;
742 }
743
744 /* we have to allocate tmp space to do a stable sort */
745 apr_pool_create(&tmp, p);
746 apr_pool_tag(tmp, "core_reorder_directories");
747 sortbin = apr_palloc(tmp, sec_dir->nelts * sizeof(*sortbin));
748 for (i = 0; i < nelts; ++i) {
749 sortbin[i].orig_index = i;
750 sortbin[i].elt = elts[i];
751 }
752
754
755 /* and now copy back to the original array */
756 for (i = 0; i < nelts; ++i) {
757 elts[i] = sortbin[i].elt;
758 }
759
760 apr_pool_destroy(tmp);
761}
762
763/*****************************************************************
764 *
765 * There are some elements of the core config structures in which
766 * other modules have a legitimate interest (this is ugly, but necessary
767 * to preserve NCSA back-compatibility). So, we have a bunch of accessors
768 * here...
769 */
770
778
786
787/*
788 * Optional function coming from mod_authn_core, used for
789 * retrieving the type of authorization
790 */
792
794{
795 if (authn_ap_auth_type) {
796 return authn_ap_auth_type(r);
797 }
798 return NULL;
799}
800
801/*
802 * Optional function coming from mod_authn_core, used for
803 * retrieving the authorization realm
804 */
806
808{
809 if (authn_ap_auth_name) {
810 return authn_ap_auth_name(r);
811 }
812 return NULL;
813}
814
815/*
816 * Optional function coming from mod_access_compat, used to determine how
817 access control interacts with authentication/authorization
818 */
820
828
829AP_DECLARE(const char *) ap_document_root(request_rec *r) /* Don't use this! */
830{
833 if (rconf->document_root)
834 return rconf->document_root;
836 return sconf->ap_document_root;
837}
838
840{
842 if (conf->context_prefix)
843 return conf->context_prefix;
844 else
845 return "";
846}
847
856
857AP_DECLARE(void) ap_set_document_root(request_rec *r, const char *document_root)
858{
860 conf->document_root = document_root;
861}
862
863AP_DECLARE(void) ap_set_context_info(request_rec *r, const char *context_prefix,
864 const char *context_document_root)
865{
867 if (context_prefix)
868 conf->context_prefix = context_prefix;
869 if (context_document_root)
870 conf->context_document_root = context_document_root;
871}
872
873/* Should probably just get rid of this... the only code that cares is
874 * part of the core anyway (and in fact, it isn't publicised to other
875 * modules).
876 */
877
879{
882 const char *err;
883 const char *response;
884 ap_expr_info_t *expr;
885
886 /* check for string registered via ap_custom_response() first */
887 if (reqconf->response_code_strings != NULL
888 && reqconf->response_code_strings[error_index] != NULL) {
889 return reqconf->response_code_strings[error_index];
890 }
891
892 /* check for string specified via ErrorDocument */
894
895 if (!dirconf->response_code_exprs) {
896 return NULL;
897 }
898
899 expr = apr_hash_get(dirconf->response_code_exprs, &error_index,
900 sizeof(error_index));
901 if (!expr) {
902 return NULL;
903 }
904
905 /* special token to indicate revert back to default */
906 if ((char *) expr == &errordocument_default) {
907 return NULL;
908 }
909
910 err = NULL;
911 response = ap_expr_str_exec(r, expr, &err);
912 if (err) {
914 APLOG_MARK, APLOG_ERR, 0, r, APLOGNO(02841) "core: ErrorDocument: can't "
915 "evaluate require expression: %s", err);
916 return NULL;
917 }
918
919 /* alas, duplication required as we return not-const */
920 return apr_pstrdup(r->pool, response);
921}
922
923
924/* Code from Harald Hanche-Olsen <[email protected]> */
925static APR_INLINE int do_double_reverse (int double_reverse,
926 const char *remote_host,
927 apr_sockaddr_t *client_addr,
929{
931 apr_status_t rv;
932
933 if (double_reverse) {
934 /* already done */
935 return double_reverse;
936 }
937
938 if (remote_host == NULL || remote_host[0] == '\0') {
939 /* single reverse failed, so don't bother */
940 return -1;
941 }
942
943 rv = apr_sockaddr_info_get(&sa, remote_host, APR_UNSPEC, 0, 0, pool);
944 if (rv == APR_SUCCESS) {
945 while (sa) {
946 if (apr_sockaddr_equal(sa, client_addr)) {
947 return 1;
948 }
949
950 sa = sa->next;
951 }
952 }
953
954 return -1;
955}
956
958 int type, int *str_is_ip)
959{
960 int hostname_lookups;
962
963 if (!str_is_ip) { /* caller doesn't want to know */
965 }
966 *str_is_ip = 0;
967
968 /* If we haven't checked the host name, and we want to */
969 if (dir_config) {
971 ->hostname_lookups;
972
973 if (hostname_lookups == HOSTNAME_LOOKUP_UNSET) {
974 hostname_lookups = HOSTNAME_LOOKUP_OFF;
975 }
976 }
977 else {
978 /* the default */
979 hostname_lookups = HOSTNAME_LOOKUP_OFF;
980 }
981
982 if (type != REMOTE_NOLOOKUP
983 && conn->remote_host == NULL
985 || hostname_lookups != HOSTNAME_LOOKUP_OFF)) {
986
987 if (apr_getnameinfo(&conn->remote_host, conn->client_addr, 0)
988 == APR_SUCCESS) {
990
991 if (hostname_lookups == HOSTNAME_LOOKUP_DOUBLE) {
993 conn->remote_host,
994 conn->client_addr,
995 conn->pool);
996 if (conn->double_reverse != 1) {
997 conn->remote_host = NULL;
998 }
999 }
1000 }
1001
1002 /* if failed, set it to the NULL string to indicate error */
1003 if (conn->remote_host == NULL) {
1004 conn->remote_host = "";
1005 }
1006 }
1007
1008 if (type == REMOTE_DOUBLE_REV) {
1010 conn->remote_host,
1011 conn->client_addr, conn->pool);
1012 if (conn->double_reverse == -1) {
1013 return NULL;
1014 }
1015 }
1016
1017 /*
1018 * Return the desired information; either the remote DNS name, if found,
1019 * or either NULL (if the hostname was requested) or the IP address
1020 * (if any identifier was requested).
1021 */
1022 if (conn->remote_host != NULL && conn->remote_host[0] != '\0') {
1023 return conn->remote_host;
1024 }
1025 else {
1026 if (type == REMOTE_HOST || type == REMOTE_DOUBLE_REV) {
1027 return NULL;
1028 }
1029 else {
1030 *str_is_ip = 1;
1031 return conn->client_ip;
1032 }
1033 }
1034}
1035
1037 int type, int *str_is_ip)
1038{
1039 conn_rec *conn = r->connection;
1040 int hostname_lookups;
1042
1043 /* Guard here when examining the host before the read_request hook
1044 * has populated an r->useragent_addr
1045 */
1046 if (!r->useragent_addr || (r->useragent_addr == conn->client_addr)) {
1048 }
1049
1050 if (!str_is_ip) { /* caller doesn't want to know */
1052 }
1053 *str_is_ip = 0;
1054
1055 hostname_lookups = ((core_dir_config *)
1057 ->hostname_lookups;
1058 if (hostname_lookups == HOSTNAME_LOOKUP_UNSET) {
1059 hostname_lookups = HOSTNAME_LOOKUP_OFF;
1060 }
1061
1062 if (type != REMOTE_NOLOOKUP
1063 && r->useragent_host == NULL
1064 && (type == REMOTE_DOUBLE_REV
1065 || hostname_lookups != HOSTNAME_LOOKUP_OFF)) {
1066
1068 == APR_SUCCESS) {
1070
1071 if (hostname_lookups == HOSTNAME_LOOKUP_DOUBLE) {
1075 r->pool);
1076 if (r->double_reverse != 1) {
1078 }
1079 }
1080 }
1081
1082 /* if failed, set it to the NULL string to indicate error */
1083 if (r->useragent_host == NULL) {
1084 r->useragent_host = "";
1085 }
1086 }
1087
1088 if (type == REMOTE_DOUBLE_REV) {
1091 r->useragent_addr, r->pool);
1092 if (r->double_reverse == -1) {
1093 return NULL;
1094 }
1095 }
1096
1097 /*
1098 * Return the desired information; either the remote DNS name, if found,
1099 * or either NULL (if the hostname was requested) or the IP address
1100 * (if any identifier was requested).
1101 */
1102 if (r->useragent_host != NULL && r->useragent_host[0] != '\0') {
1103 return r->useragent_host;
1104 }
1105 else {
1106 if (type == REMOTE_HOST || type == REMOTE_DOUBLE_REV) {
1107 return NULL;
1108 }
1109 else {
1110 *str_is_ip = 1;
1111 return r->useragent_ip;
1112 }
1113 }
1114}
1115
1116/*
1117 * Optional function coming from mod_ident, used for looking up ident user
1118 */
1120
1122{
1123 if (r->connection->remote_logname != NULL) {
1124 return r->connection->remote_logname;
1125 }
1126
1127 if (ident_lookup) {
1128 return ident_lookup(r);
1129 }
1130
1131 return NULL;
1132}
1133
1134/* There are two options regarding what the "name" of a server is. The
1135 * "canonical" name as defined by ServerName and Port, or the "client's
1136 * name" as supplied by a possible Host: header or full URI.
1137 *
1138 * The DNS option to UseCanonicalName causes this routine to do a
1139 * reverse lookup on the local IP address of the connection and use
1140 * that for the ServerName. This makes its value more reliable while
1141 * at the same time allowing Demon's magic virtual hosting to work.
1142 * The assumption is that DNS lookups are sufficiently quick...
1143 * -- fanf 1998-10-03
1144 */
1146{
1147 conn_rec *conn = r->connection;
1149 const char *retval;
1150
1152
1153 switch (d->use_canonical_name) {
1156 break;
1158 if (conn->local_host == NULL) {
1159 if (apr_getnameinfo(&conn->local_host,
1160 conn->local_addr, 0) != APR_SUCCESS)
1161 conn->local_host = apr_pstrdup(conn->pool,
1163 else {
1165 }
1166 }
1167 retval = conn->local_host;
1168 break;
1172 break;
1173 default:
1175 "ap_get_server_name: Invalid UCN Option somehow");
1176 retval = "localhost";
1177 break;
1178 }
1179 return retval;
1180}
1181
1182/*
1183 * Get the current server name from the request for the purposes
1184 * of using in a URL. If the server name is an IPv6 literal
1185 * address, it will be returned in URL format (e.g., "[fe80::1]").
1186 */
1188{
1189 const char *plain_server_name = ap_get_server_name(r);
1190
1191#if APR_HAVE_IPV6
1192 if (ap_strchr_c(plain_server_name, ':')) { /* IPv6 literal? */
1193 return apr_pstrcat(r->pool, "[", plain_server_name, "]", NULL);
1194 }
1195#endif
1196 return plain_server_name;
1197}
1198
1200{
1204
1205 switch (d->use_canonical_name) {
1209 if (d->use_canonical_phys_port == USE_CANONICAL_PHYS_PORT_ON)
1212 r->server->port ? r->server->port :
1214 else /* USE_CANONICAL_PHYS_PORT_OFF or USE_CANONICAL_PHYS_PORT_UNSET */
1216 r->server->port ? r->server->port :
1218 break;
1220 /* With UseCanonicalName on (and in all versions prior to 1.3)
1221 * Apache will use the hostname and port specified in the
1222 * ServerName directive to construct a canonical name for the
1223 * server. (If no port was specified in the ServerName
1224 * directive, Apache uses the port supplied by the client if
1225 * any is supplied, and finally the default port for the protocol
1226 * used.
1227 */
1228 if (d->use_canonical_phys_port == USE_CANONICAL_PHYS_PORT_ON)
1229 port = r->server->port ? r->server->port :
1232 else /* USE_CANONICAL_PHYS_PORT_OFF or USE_CANONICAL_PHYS_PORT_UNSET */
1233 port = r->server->port ? r->server->port :
1235 break;
1236 default:
1238 "ap_get_server_port: Invalid UCN Option somehow");
1240 break;
1241 }
1242
1243 return port;
1244}
1245
1247 request_rec *r)
1248{
1249 unsigned port = ap_get_server_port(r);
1250 const char *host = ap_get_server_name_for_url(r);
1251
1252 if (ap_is_default_port(port, r)) {
1253 return apr_pstrcat(p, ap_http_scheme(r), "://", host, uri, NULL);
1254 }
1255
1256 return apr_psprintf(p, "%s://%s:%u%s", ap_http_scheme(r), host, port, uri);
1257}
1258
1260{
1263
1264 if (d->limit_req_body == AP_LIMIT_REQ_BODY_UNSET) {
1266 }
1267
1268 return d->limit_req_body;
1269}
1270
1272{
1274
1275 return d->read_buf_size ? d->read_buf_size : AP_IOBUFSIZE;
1276}
1277
1278
1279/*****************************************************************
1280 *
1281 * Commands... this module handles almost all of the NCSA httpd.conf
1282 * commands, but most of the old srm.conf is in the modules.
1283 */
1284
1285
1286/* returns a parent if it matches the given directive */
1288 const char *what)
1289{
1290 while (dirp->parent != NULL) {
1291 dirp = dirp->parent;
1292
1293 /* ### it would be nice to have atom-ized directives */
1294 if (ap_cstr_casecmp(dirp->directive, what) == 0)
1295 return dirp;
1296 }
1297
1298 return NULL;
1299}
1300
1302 unsigned forbidden)
1303{
1304 const char *gt = (cmd->cmd->name[0] == '<'
1305 && cmd->cmd->name[strlen(cmd->cmd->name)-1] != '>')
1306 ? ">" : "";
1307 const ap_directive_t *found;
1308
1309 if ((forbidden & NOT_IN_VIRTUALHOST) && cmd->server->is_virtual) {
1310 return apr_pstrcat(cmd->pool, cmd->cmd->name, gt,
1311 " cannot occur within <VirtualHost> section", NULL);
1312 }
1313
1314 if ((forbidden & NOT_IN_DIR_CONTEXT) && cmd->limited != -1) {
1315 return apr_pstrcat(cmd->pool, cmd->cmd->name, gt,
1316 " cannot occur within <Limit> or <LimitExcept> "
1317 "section", NULL);
1318 }
1319
1320 if ((forbidden & NOT_IN_HTACCESS) && (cmd->pool == cmd->temp_pool)) {
1321 return apr_pstrcat(cmd->pool, cmd->cmd->name, gt,
1322 " cannot occur within htaccess files", NULL);
1323 }
1324
1326 if (cmd->path != NULL) {
1327 return apr_pstrcat(cmd->pool, cmd->cmd->name, gt,
1328 " cannot occur within directory context", NULL);
1329 }
1330 if (cmd->cmd->req_override & EXEC_ON_READ) {
1331 /* EXEC_ON_READ must be NOT_IN_DIR_LOC_FILE, if not, it will
1332 * (deliberately) segfault below in the individual tests...
1333 */
1334 return NULL;
1335 }
1336 }
1337
1339 && ((found = find_parent(cmd->directive, "<Directory"))
1340 || (found = find_parent(cmd->directive, "<DirectoryMatch"))))
1342 && ((found = find_parent(cmd->directive, "<Location"))
1343 || (found = find_parent(cmd->directive, "<LocationMatch"))))
1344 || ((forbidden & NOT_IN_FILES)
1345 && ((found = find_parent(cmd->directive, "<Files"))
1346 || (found = find_parent(cmd->directive, "<FilesMatch"))
1347 || (found = find_parent(cmd->directive, "<If"))
1348 || (found = find_parent(cmd->directive, "<ElseIf"))
1349 || (found = find_parent(cmd->directive, "<Else"))))
1350 || ((forbidden & NOT_IN_PROXY)
1351 && ((found = find_parent(cmd->directive, "<Proxy"))
1352 || (found = find_parent(cmd->directive, "<ProxyMatch"))))) {
1353 return apr_pstrcat(cmd->pool, cmd->cmd->name, gt,
1354 " cannot occur within ", found->directive,
1355 "> section", NULL);
1356 }
1357
1358 return NULL;
1359}
1360
1361static const char *set_access_name(cmd_parms *cmd, void *dummy,
1362 const char *arg)
1363{
1364 void *sconf = cmd->server->module_config;
1366
1368 if (err != NULL) {
1369 return err;
1370 }
1371
1372 conf->access_name = apr_pstrdup(cmd->pool, arg);
1373 return NULL;
1374}
1375
1376AP_DECLARE(const char *) ap_resolve_env(apr_pool_t *p, const char * word)
1377{
1378# define SMALL_EXPANSION 5
1379 struct sll {
1380 struct sll *next;
1381 const char *string;
1383 } *result, *current, sresult[SMALL_EXPANSION];
1384 char *res_buf, *cp;
1385 const char *s, *e, *ep;
1386 unsigned spc;
1388
1389 s = ap_strchr_c(word, '$');
1390 if (!s) {
1391 return word;
1392 }
1393
1394 /* well, actually something to do */
1395 ep = word + strlen(word);
1396 spc = 0;
1397 result = current = &(sresult[spc++]);
1398 current->next = NULL;
1399 current->string = word;
1400 current->len = s - word;
1401 outlen = current->len;
1402
1403 do {
1404 /* prepare next entry */
1405 if (current->len) {
1406 current->next = (spc < SMALL_EXPANSION)
1407 ? &(sresult[spc++])
1408 : (struct sll *)apr_palloc(p,
1409 sizeof(*current->next));
1410 current = current->next;
1411 current->next = NULL;
1412 current->len = 0;
1413 }
1414
1415 if (*s == '$') {
1416 if (s[1] == '{' && (e = ap_strchr_c(s+2, '}'))) {
1417 char *name = apr_pstrmemdup(p, s+2, e-s-2);
1418 word = NULL;
1421 if (!word)
1423 if (word) {
1424 current->string = word;
1425 current->len = strlen(word);
1426 outlen += current->len;
1427 }
1428 else {
1429 if (ap_strchr(name, ':') == 0)
1431 "Config variable ${%s} is not defined",
1432 name);
1433 current->string = s;
1434 current->len = e - s + 1;
1435 outlen += current->len;
1436 }
1437 s = e + 1;
1438 }
1439 else {
1440 current->string = s++;
1441 current->len = 1;
1442 ++outlen;
1443 }
1444 }
1445 else {
1446 word = s;
1447 s = ap_strchr_c(s, '$');
1448 current->string = word;
1449 current->len = s ? s - word : ep - word;
1450 outlen += current->len;
1451 }
1452 } while (s && *s);
1453
1454 /* assemble result */
1455 res_buf = cp = apr_palloc(p, outlen + 1);
1456 do {
1457 if (result->len) {
1458 memcpy(cp, result->string, result->len);
1459 cp += result->len;
1460 }
1461 result = result->next;
1462 } while (result);
1463 res_buf[outlen] = '\0';
1464
1465 return res_buf;
1466}
1467
1476
1477/*
1478 * Make sure we can revert the effects of Define/UnDefine when restarting.
1479 * This function must be called once per loading of the config, before
1480 * ap_server_config_defines is changed. This may be during reading of the
1481 * config, which is even before the pre_config hook is run (due to
1482 * EXEC_ON_READ for Define/UnDefine).
1483 */
1485{
1487 /* Use apr_array_copy instead of apr_array_copy_hdr because it does not
1488 * protect from the way unset_define removes entries.
1489 */
1491}
1492
1493static const char *set_define(cmd_parms *cmd, void *dummy,
1494 const char *name, const char *value)
1495{
1497 if (err)
1498 return err;
1499 if (ap_strchr_c(name, ':') != NULL) {
1500 return "Variable name must not contain ':'";
1501 }
1502
1504 init_config_defines(cmd->pool);
1505 }
1507 *(const char **)apr_array_push(ap_server_config_defines) = name;
1508 }
1509 if (value) {
1512 }
1514 }
1515
1516 return NULL;
1517}
1518
1519static const char *unset_define(cmd_parms *cmd, void *dummy,
1520 const char *name)
1521{
1522 int i;
1523 const char **defines;
1525 if (err)
1526 return err;
1527 if (ap_strchr_c(name, ':') != NULL) {
1528 return "Variable name must not contain ':'";
1529 }
1530
1532 init_config_defines(cmd->pool);
1533 }
1534
1535 defines = (const char **)ap_server_config_defines->elts;
1536 for (i = 0; i < ap_server_config_defines->nelts; i++) {
1537 if (strcmp(defines[i], name) == 0) {
1538 defines[i] = *(const char **)apr_array_pop(ap_server_config_defines);
1539 break;
1540 }
1541 }
1542
1545 }
1546
1547 return NULL;
1548}
1549
1550static const char *generate_error(cmd_parms *cmd, void *dummy,
1551 const char *arg)
1552{
1553 if (!arg || !*arg) {
1554 return "The Error directive was used with no message.";
1555 }
1556
1557 if (*arg == '"' || *arg == '\'') { /* strip off quotes */
1558 apr_size_t len = strlen(arg);
1559 char last = *(arg + len - 1);
1560
1561 if (*arg == last) {
1562 return apr_pstrndup(cmd->pool, arg + 1, len - 2);
1563 }
1564 }
1565
1566 return arg;
1567}
1568
1569#ifdef GPROF
1570static const char *set_gprof_dir(cmd_parms *cmd, void *dummy, const char *arg)
1571{
1572 void *sconf = cmd->server->module_config;
1574
1576 if (err != NULL) {
1577 return err;
1578 }
1579
1580 conf->gprof_dir = apr_pstrdup(cmd->pool, arg);
1581 return NULL;
1582}
1583#endif /*GPROF*/
1584
1586 void *d_, const char *arg)
1587{
1588 core_dir_config *d = d_;
1589
1590 if (!ap_cstr_casecmp(arg, "Off")) {
1592 }
1593 else if (!ap_cstr_casecmp(arg, "On")) {
1594 d->add_default_charset = ADD_DEFAULT_CHARSET_ON;
1595 d->add_default_charset_name = DEFAULT_ADD_DEFAULT_CHARSET_NAME;
1596 }
1597 else {
1598 d->add_default_charset = ADD_DEFAULT_CHARSET_ON;
1599 d->add_default_charset_name = arg;
1600 }
1601
1602 return NULL;
1603}
1604
1605static const char *set_document_root(cmd_parms *cmd, void *dummy,
1606 const char *arg)
1607{
1608 void *sconf = cmd->server->module_config;
1610
1612 if (err != NULL) {
1613 return err;
1614 }
1615
1616 /* When ap_document_root_check is false; skip all the stuff below */
1618 conf->ap_document_root = arg;
1619 return NULL;
1620 }
1621
1622 /* Make it absolute, relative to ServerRoot */
1624 if (arg == NULL) {
1625 return "DocumentRoot must be a directory";
1626 }
1627
1628 /* TODO: ap_configtestonly */
1629 if (apr_filepath_merge((char**)&conf->ap_document_root, NULL, arg,
1631 || !ap_is_directory(cmd->temp_pool, arg)) {
1632 if (cmd->server->is_virtual) {
1634 cmd->pool, APLOGNO(00112)
1635 "Warning: DocumentRoot [%s] does not exist",
1636 arg);
1637 conf->ap_document_root = arg;
1638 }
1639 else {
1640 return apr_psprintf(cmd->pool,
1641 "DocumentRoot '%s' is not a directory, or is not readable",
1642 arg);
1643 }
1644 }
1645 return NULL;
1646}
1647
1649 const char *string)
1650{
1652 int idx;
1653
1654 if (conf->response_code_strings == NULL) {
1655 conf->response_code_strings =
1657 sizeof(*conf->response_code_strings) * RESPONSE_CODES);
1658 }
1659
1661
1662 conf->response_code_strings[idx] =
1663 ((ap_is_url(string) || (*string == '/')) && (*string != '"')) ?
1664 apr_pstrdup(r->pool, string) : apr_pstrcat(r->pool, "\"", string, NULL);
1665}
1666
1667static const char *set_error_document(cmd_parms *cmd, void *conf_,
1668 const char *errno_str, const char *msg)
1669{
1670 core_dir_config *conf = conf_;
1672 enum { MSG, LOCAL_PATH, REMOTE_PATH } what = MSG;
1673
1674 /* 1st parameter should be a 3 digit number, which we recognize;
1675 * convert it into an array index
1676 */
1679
1682 }
1684 return apr_pstrcat(cmd->pool, "Unsupported HTTP response code ",
1685 errno_str, NULL);
1686 }
1687
1688 /* Heuristic to determine second argument. */
1689 if (ap_strchr_c(msg,' '))
1690 what = MSG;
1691 else if (msg[0] == '/')
1692 what = LOCAL_PATH;
1693 else if (ap_is_url(msg))
1694 what = REMOTE_PATH;
1695 else
1696 what = MSG;
1697
1698 /* The entry should be ignored if it is a full URL for a 401 error */
1699
1700 if (error_number == 401 && what == REMOTE_PATH) {
1701 ap_log_error(APLOG_MARK, APLOG_NOTICE, 0, cmd->server, APLOGNO(00113)
1702 "%s:%d cannot use a full URL in a 401 ErrorDocument "
1703 "directive --- ignoring!", cmd->directive->filename, cmd->directive->line_num);
1704 }
1705 else { /* Store it... */
1706 if (conf->response_code_exprs == NULL) {
1707 conf->response_code_exprs = apr_hash_make(cmd->pool);
1708 }
1709
1710 if (ap_cstr_casecmp(msg, "default") == 0) {
1711 /* special case: ErrorDocument 404 default restores the
1712 * canned server error response
1713 */
1715 apr_pmemdup(cmd->pool, &index_number, sizeof(index_number)),
1717 }
1718 else {
1719 ap_expr_info_t *expr;
1720 const char *expr_err = NULL;
1721
1722 /* hack. Prefix a " if it is a msg; as that is what
1723 * http_protocol.c relies on to distinguish between
1724 * a msg and a (local) path.
1725 */
1726 const char *response =
1727 (what == MSG) ? apr_pstrcat(cmd->pool, "\"", msg, NULL) :
1728 apr_pstrdup(cmd->pool, msg);
1729
1731 &expr_err, NULL);
1732
1733 if (expr_err) {
1734 return apr_pstrcat(cmd->temp_pool,
1735 "Cannot parse expression in ErrorDocument: ",
1736 expr_err, NULL);
1737 }
1738
1740 apr_pmemdup(cmd->pool, &index_number, sizeof(index_number)),
1741 sizeof(index_number), expr);
1742
1743 }
1744 }
1745
1746 return NULL;
1747}
1748
1750 const char *l)
1751{
1753 int first = 1;
1754
1755 char *w, *p = (char *) l;
1756 char *tok_state;
1757
1758 while ((w = apr_strtok(p, ",", &tok_state)) != NULL) {
1759
1760 if (first) {
1761 p = NULL;
1762 *opts = OPT_NONE;
1763 first = 0;
1764 }
1765
1766 if (!ap_cstr_casecmp(w, "Indexes")) {
1767 opt = OPT_INDEXES;
1768 }
1769 else if (!ap_cstr_casecmp(w, "Includes")) {
1770 /* If Includes is permitted, both Includes and
1771 * IncludesNOEXEC may be changed. */
1773 }
1774 else if (!ap_cstr_casecmp(w, "IncludesNOEXEC")) {
1775 opt = OPT_INCLUDES;
1776 }
1777 else if (!ap_cstr_casecmp(w, "FollowSymLinks")) {
1779 }
1780 else if (!ap_cstr_casecmp(w, "SymLinksIfOwnerMatch")) {
1782 }
1783 else if (!ap_cstr_casecmp(w, "ExecCGI")) {
1784 opt = OPT_EXECCGI;
1785 }
1786 else if (!ap_cstr_casecmp(w, "MultiViews")) {
1787 opt = OPT_MULTI;
1788 }
1789 else if (!ap_cstr_casecmp(w, "RunScripts")) { /* AI backcompat. Yuck */
1791 }
1792 else if (!ap_cstr_casecmp(w, "None")) {
1793 opt = OPT_NONE;
1794 }
1795 else if (!ap_cstr_casecmp(w, "All")) {
1796 opt = OPT_ALL;
1797 }
1798 else {
1799 return apr_pstrcat(cmd->pool, "Illegal option ", w, NULL);
1800 }
1801
1802 *opts |= opt;
1803 }
1804
1805 (*opts) &= (~OPT_UNSET);
1806
1807 return NULL;
1808}
1809
1810static const char *set_override(cmd_parms *cmd, void *d_, const char *l)
1811{
1812 core_dir_config *d = d_;
1813 char *w;
1814 char *k, *v;
1815 const char *err;
1816
1817 /* Throw a warning if we're in <Location> or <Files> */
1819 ap_log_error(APLOG_MARK, APLOG_WARNING, 0, cmd->server, APLOGNO(00114)
1820 "Useless use of AllowOverride in line %d of %s.",
1821 cmd->directive->line_num, cmd->directive->filename);
1822 }
1824 return err;
1825
1826 d->override = OR_NONE;
1827 while (l[0]) {
1828 w = ap_getword_conf(cmd->temp_pool, &l);
1829
1830 k = w;
1831 v = strchr(k, '=');
1832 if (v) {
1833 *v++ = '\0';
1834 }
1835
1836 if (!ap_cstr_casecmp(w, "Limit")) {
1837 d->override |= OR_LIMIT;
1838 }
1839 else if (!ap_cstr_casecmp(k, "Options")) {
1840 d->override |= OR_OPTIONS;
1841 if (v)
1842 set_allow_opts(cmd, &(d->override_opts), v);
1843 else
1844 d->override_opts = OPT_ALL;
1845 }
1846 else if (!ap_cstr_casecmp(w, "FileInfo")) {
1847 d->override |= OR_FILEINFO;
1848 }
1849 else if (!ap_cstr_casecmp(w, "AuthConfig")) {
1850 d->override |= OR_AUTHCFG;
1851 }
1852 else if (!ap_cstr_casecmp(w, "Indexes")) {
1853 d->override |= OR_INDEXES;
1854 }
1855 else if (!ap_cstr_casecmp(w, "Nonfatal")) {
1856 if (!v) {
1857 return apr_pstrcat(cmd->pool, "=Override, =Unknown or =All expected after ", w, NULL);
1858 }
1859 else if (!ap_cstr_casecmp(v, "Override")) {
1860 d->override |= NONFATAL_OVERRIDE;
1861 }
1862 else if (!ap_cstr_casecmp(v, "Unknown")) {
1863 d->override |= NONFATAL_UNKNOWN;
1864 }
1865 else if (!ap_cstr_casecmp(v, "All")) {
1866 d->override |= NONFATAL_ALL;
1867 }
1868 }
1869 else if (!ap_cstr_casecmp(w, "None")) {
1870 d->override = OR_NONE;
1871 }
1872 else if (!ap_cstr_casecmp(w, "All")) {
1873 d->override = OR_ALL;
1874 }
1875 else {
1876 return apr_pstrcat(cmd->pool, "Illegal override option ", w, NULL);
1877 }
1878
1879 d->override &= ~OR_UNSET;
1880 }
1881
1882 return NULL;
1883}
1884
1885static const char *set_cgi_pass_auth(cmd_parms *cmd, void *d_, int flag)
1886{
1887 core_dir_config *d = d_;
1888
1890
1891 return NULL;
1892}
1893
1894static const char *set_cgi_var(cmd_parms *cmd, void *d_,
1895 const char *var, const char *rule_)
1896{
1897 core_dir_config *d = d_;
1898 char *rule = apr_pstrdup(cmd->pool, rule_);
1899
1901
1902 if (!strcmp(var, "REQUEST_URI")) {
1903 if (strcmp(rule, "current-uri") && strcmp(rule, "original-uri")) {
1904 return "Valid rules for REQUEST_URI are 'current-uri' and 'original-uri'";
1905 }
1906 }
1907 else {
1908 return apr_pstrcat(cmd->pool, "Unrecognized CGI variable: \"",
1909 var, "\"", NULL);
1910 }
1911
1912 if (!d->cgi_var_rules) {
1913 d->cgi_var_rules = apr_hash_make(cmd->pool);
1914 }
1915 apr_hash_set(d->cgi_var_rules, var, APR_HASH_KEY_STRING, rule);
1916 return NULL;
1917}
1918
1919static const char *set_qualify_redirect_url(cmd_parms *cmd, void *d_, int flag)
1920{
1921 core_dir_config *d = d_;
1922
1924
1925 return NULL;
1926}
1927
1928static const char *set_core_server_flag(cmd_parms *cmd, void *s_, int flag)
1929{
1930 core_server_config *conf =
1931 ap_get_core_module_config(cmd->server->module_config);
1932 return ap_set_flag_slot(cmd, conf, flag);
1933}
1934
1935static const char *set_override_list(cmd_parms *cmd, void *d_, int argc, char *const argv[])
1936{
1937 core_dir_config *d = d_;
1938 int i;
1939 const char *err;
1940
1941 /* Throw a warning if we're in <Location> or <Files> */
1943 ap_log_error(APLOG_MARK, APLOG_WARNING, 0, cmd->server, APLOGNO(00115)
1944 "Useless use of AllowOverrideList at %s:%d",
1945 cmd->directive->filename, cmd->directive->line_num);
1946 }
1948 return err;
1949
1950 d->override_list = apr_table_make(cmd->pool, argc);
1951
1952 for (i = 0; i < argc; i++) {
1953 if (!ap_cstr_casecmp(argv[i], "None")) {
1954 if (argc != 1) {
1955 return "'None' not allowed with other directives in "
1956 "AllowOverrideList";
1957 }
1958 return NULL;
1959 }
1960 else {
1961 const command_rec *result = NULL;
1962 module *mod = ap_top_module;
1963
1965 if (result == NULL) {
1967 APLOGNO(00116) "Discarding unrecognized "
1968 "directive `%s' in AllowOverrideList at %s:%d",
1969 argv[i], cmd->directive->filename,
1970 cmd->directive->line_num);
1971 continue;
1972 }
1973 else if ((result->req_override & (OR_ALL|ACCESS_CONF)) == 0) {
1975 APLOGNO(02304) "Discarding directive `%s' not "
1976 "allowed in AllowOverrideList at %s:%d",
1977 argv[i], cmd->directive->filename,
1978 cmd->directive->line_num);
1979 continue;
1980 }
1981 else {
1982 apr_table_setn(d->override_list, argv[i], "1");
1983 }
1984 }
1985 }
1986
1987 return NULL;
1988}
1989
1990static const char *set_options(cmd_parms *cmd, void *d_, const char *l)
1991{
1992 core_dir_config *d = d_;
1994 int first = 1;
1995 int merge = 0;
1996 int all_none = 0;
1997 char action;
1998
1999 while (l[0]) {
2000 char *w = ap_getword_conf(cmd->temp_pool, &l);
2001 action = '\0';
2002
2003 if (*w == '+' || *w == '-') {
2004 action = *(w++);
2005 if (!merge && !first && !all_none) {
2006 return "Either all Options must start with + or -, or no Option may.";
2007 }
2008 merge = 1;
2009 }
2010 else if (first) {
2011 d->opts = OPT_NONE;
2012 }
2013 else if (merge) {
2014 return "Either all Options must start with + or -, or no Option may.";
2015 }
2016
2017 if (!ap_cstr_casecmp(w, "Indexes")) {
2018 opt = OPT_INDEXES;
2019 }
2020 else if (!ap_cstr_casecmp(w, "Includes")) {
2022 }
2023 else if (!ap_cstr_casecmp(w, "IncludesNOEXEC")) {
2024 opt = OPT_INCLUDES;
2025 }
2026 else if (!ap_cstr_casecmp(w, "FollowSymLinks")) {
2028 }
2029 else if (!ap_cstr_casecmp(w, "SymLinksIfOwnerMatch")) {
2031 }
2032 else if (!ap_cstr_casecmp(w, "ExecCGI")) {
2033 opt = OPT_EXECCGI;
2034 }
2035 else if (!ap_cstr_casecmp(w, "MultiViews")) {
2036 opt = OPT_MULTI;
2037 }
2038 else if (!ap_cstr_casecmp(w, "RunScripts")) { /* AI backcompat. Yuck */
2040 }
2041 else if (!ap_cstr_casecmp(w, "None")) {
2042 if (!first) {
2043 return "'Options None' must be the first Option given.";
2044 }
2045 else if (merge) { /* Only works since None may not follow any other option. */
2046 return "You may not use 'Options +None' or 'Options -None'.";
2047 }
2048 opt = OPT_NONE;
2049 all_none = 1;
2050 }
2051 else if (!ap_cstr_casecmp(w, "All")) {
2052 if (!first) {
2053 return "'Options All' must be the first option given.";
2054 }
2055 else if (merge) { /* Only works since All may not follow any other option. */
2056 return "You may not use 'Options +All' or 'Options -All'.";
2057 }
2058 opt = OPT_ALL;
2059 all_none = 1;
2060 }
2061 else {
2062 return apr_pstrcat(cmd->pool, "Illegal option ", w, NULL);
2063 }
2064
2065 if ( (cmd->override_opts & opt) != opt ) {
2066 return apr_pstrcat(cmd->pool, "Option ", w, " not allowed here", NULL);
2067 }
2068 else if (action == '-') {
2069 /* we ensure the invariant (d->opts_add & d->opts_remove) == 0 */
2070 d->opts_remove |= opt;
2071 d->opts_add &= ~opt;
2072 d->opts &= ~opt;
2073 }
2074 else if (action == '+') {
2075 d->opts_add |= opt;
2076 d->opts_remove &= ~opt;
2077 d->opts |= opt;
2078 }
2079 else {
2080 d->opts |= opt;
2081 }
2082
2083 first = 0;
2084 }
2085
2086 return NULL;
2087}
2088
2089static const char *set_default_type(cmd_parms *cmd, void *d_,
2090 const char *arg)
2091{
2092 if ((ap_cstr_casecmp(arg, "off") != 0) && (ap_cstr_casecmp(arg, "none") != 0)) {
2093 ap_log_error(APLOG_MARK, APLOG_WARNING, 0, cmd->server, APLOGNO(00117)
2094 "Ignoring deprecated use of DefaultType in line %d of %s.",
2095 cmd->directive->line_num, cmd->directive->filename);
2096 }
2097
2098 return NULL;
2099}
2100
2101static const char *set_sethandler(cmd_parms *cmd,
2102 void *d_,
2103 const char *arg_)
2104{
2106 const char *err;
2109 &err, NULL);
2110 if (err) {
2111 return apr_pstrcat(cmd->pool,
2112 "Can't parse expression : ", err, NULL);
2113 }
2114 return NULL;
2115}
2116
2117/*
2118 * Note what data should be used when forming file ETag values.
2119 * It would be nicer to do this as an ITERATE, but then we couldn't
2120 * remember the +/- state properly.
2121 */
2122static const char *set_etag_bits(cmd_parms *cmd, void *mconfig,
2123 const char *args_p)
2124{
2125 core_dir_config *cfg;
2127 char action;
2128 char *token;
2129 const char *args;
2130 int valid;
2131 int first;
2132 int explicit;
2133
2134 cfg = (core_dir_config *)mconfig;
2135
2136 args = args_p;
2137 first = 1;
2138 explicit = 0;
2139 while (args[0] != '\0') {
2140 action = '*';
2141 bit = ETAG_UNSET;
2142 valid = 1;
2143 token = ap_getword_conf(cmd->temp_pool, &args);
2144 if ((*token == '+') || (*token == '-')) {
2145 action = *token;
2146 token++;
2147 }
2148 else {
2149 /*
2150 * The occurrence of an absolute setting wipes
2151 * out any previous relative ones. The first such
2152 * occurrence forgets any inherited ones, too.
2153 */
2154 if (first) {
2155 cfg->etag_bits = ETAG_UNSET;
2156 cfg->etag_add = ETAG_UNSET;
2157 cfg->etag_remove = ETAG_UNSET;
2158 first = 0;
2159 }
2160 }
2161
2162 if (ap_cstr_casecmp(token, "None") == 0) {
2163 if (action != '*') {
2164 valid = 0;
2165 }
2166 else {
2167 cfg->etag_bits = bit = ETAG_NONE;
2168 explicit = 1;
2169 }
2170 }
2171 else if (ap_cstr_casecmp(token, "All") == 0) {
2172 if (action != '*') {
2173 valid = 0;
2174 }
2175 else {
2176 explicit = 1;
2177 cfg->etag_bits = bit = ETAG_ALL;
2178 }
2179 }
2180 else if (ap_cstr_casecmp(token, "Size") == 0) {
2181 bit = ETAG_SIZE;
2182 }
2183 else if ((ap_cstr_casecmp(token, "LMTime") == 0)
2184 || (ap_cstr_casecmp(token, "MTime") == 0)
2185 || (ap_cstr_casecmp(token, "LastModified") == 0)) {
2186 bit = ETAG_MTIME;
2187 }
2188 else if (ap_cstr_casecmp(token, "INode") == 0) {
2189 bit = ETAG_INODE;
2190 }
2191 else if (ap_cstr_casecmp(token, "Digest") == 0) {
2192 bit = ETAG_DIGEST;
2193 }
2194 else {
2195 return apr_pstrcat(cmd->pool, "Unknown keyword '",
2196 token, "' for ", cmd->cmd->name,
2197 " directive", NULL);
2198 }
2199
2200 if (! valid) {
2201 return apr_pstrcat(cmd->pool, cmd->cmd->name, " keyword '",
2202 token, "' cannot be used with '+' or '-'",
2203 NULL);
2204 }
2205
2206 if (action == '+') {
2207 /*
2208 * Make sure it's in the 'add' list and absent from the
2209 * 'subtract' list.
2210 */
2211 cfg->etag_add |= bit;
2212 cfg->etag_remove &= (~ bit);
2213 }
2214 else if (action == '-') {
2215 cfg->etag_remove |= bit;
2216 cfg->etag_add &= (~ bit);
2217 }
2218 else {
2219 /*
2220 * Non-relative values wipe out any + or - values
2221 * accumulated so far.
2222 */
2223 cfg->etag_bits |= bit;
2224 cfg->etag_add = ETAG_UNSET;
2225 cfg->etag_remove = ETAG_UNSET;
2226 explicit = 1;
2227 }
2228 }
2229
2230 /*
2231 * Any setting at all will clear the 'None' and 'Unset' bits.
2232 */
2233
2234 if (cfg->etag_add != ETAG_UNSET) {
2235 cfg->etag_add &= (~ ETAG_UNSET);
2236 }
2237
2238 if (cfg->etag_remove != ETAG_UNSET) {
2239 cfg->etag_remove &= (~ ETAG_UNSET);
2240 }
2241
2242 if (explicit) {
2243 cfg->etag_bits &= (~ ETAG_UNSET);
2244
2245 if ((cfg->etag_bits & ETAG_NONE) != ETAG_NONE) {
2246 cfg->etag_bits &= (~ ETAG_NONE);
2247 }
2248 }
2249
2250 return NULL;
2251}
2252
2253static const char *set_enable_mmap(cmd_parms *cmd, void *d_,
2254 const char *arg)
2255{
2256 core_dir_config *d = d_;
2257
2258 if (ap_cstr_casecmp(arg, "on") == 0) {
2260 }
2261 else if (ap_cstr_casecmp(arg, "off") == 0) {
2262 d->enable_mmap = ENABLE_MMAP_OFF;
2263 }
2264 else {
2265 return "parameter must be 'on' or 'off'";
2266 }
2267
2268 return NULL;
2269}
2270
2271static const char *set_enable_sendfile(cmd_parms *cmd, void *d_,
2272 const char *arg)
2273{
2274 core_dir_config *d = d_;
2275
2276 if (ap_cstr_casecmp(arg, "on") == 0) {
2278 }
2279 else if (ap_cstr_casecmp(arg, "off") == 0) {
2280 d->enable_sendfile = ENABLE_SENDFILE_OFF;
2281 }
2282 else {
2283 return "parameter must be 'on' or 'off'";
2284 }
2285
2286 return NULL;
2287}
2288
2289static const char *set_read_buf_size(cmd_parms *cmd, void *d_,
2290 const char *arg)
2291{
2292 core_dir_config *d = d_;
2294 char *end;
2295
2296 if (apr_strtoff(&size, arg, &end, 10)
2298 return apr_pstrcat(cmd->pool,
2299 "parameter must be a number between 0 and "
2301 arg, NULL);
2302
2303 d->read_buf_size = (apr_size_t)size;
2304
2305 return NULL;
2306}
2307
2308static const char *set_flush_max_threshold(cmd_parms *cmd, void *d_,
2309 const char *arg)
2310{
2311 core_server_config *conf =
2312 ap_get_core_module_config(cmd->server->module_config);
2314 char *end;
2315
2316 if (apr_strtoff(&size, arg, &end, 10)
2318 return apr_pstrcat(cmd->pool,
2319 "parameter must be a number between 0 and "
2321 arg, NULL);
2322
2324
2325 return NULL;
2326}
2327
2328static const char *set_flush_max_pipelined(cmd_parms *cmd, void *d_,
2329 const char *arg)
2330{
2331 core_server_config *conf =
2332 ap_get_core_module_config(cmd->server->module_config);
2333 apr_off_t num;
2334 char *end;
2335
2336 if (apr_strtoff(&num, arg, &end, 10)
2338 return apr_pstrcat(cmd->pool,
2339 "parameter must be a number between -1 and "
2341 arg, NULL);
2342
2344
2345 return NULL;
2346}
2347
2348/*
2349 * Report a missing-'>' syntax error.
2350 */
2352{
2353 return apr_pstrcat(cmd->pool, cmd->cmd->name,
2354 "> directive missing closing '>'", NULL);
2355}
2356
2357/*
2358 * Report a missing args in '<Foo >' syntax error.
2359 */
2361{
2362 return apr_pstrcat(cmd->pool, cmd->cmd->name,
2363 "> directive requires additional arguments", NULL);
2364}
2365
2367 void *dummy,
2368 const char *arg)
2369{
2370 const char *endp = ap_strrchr_c(arg, '>');
2371 const char *limited_methods;
2372 void *tog = cmd->cmd->cmd_data;
2373 apr_int64_t limited = 0;
2374 apr_int64_t old_limited = cmd->limited;
2375 const char *errmsg;
2376
2377 if (endp == NULL) {
2378 return unclosed_directive(cmd);
2379 }
2380
2381 limited_methods = apr_pstrmemdup(cmd->temp_pool, arg, endp - arg);
2382
2383 if (!limited_methods[0]) {
2384 return missing_container_arg(cmd);
2385 }
2386
2387 while (limited_methods[0]) {
2388 char *method = ap_getword_conf(cmd->temp_pool, &limited_methods);
2389 int methnum;
2390
2391 /* check for builtin or module registered method number */
2393
2394 if (methnum == M_TRACE && !tog) {
2395 return "TRACE cannot be controlled by <Limit>, see TraceEnable";
2396 }
2397 else if (methnum == M_INVALID) {
2398 /* method has not been registered yet, but resource restriction
2399 * is always checked before method handling, so register it.
2400 */
2401 if (cmd->pool == cmd->temp_pool) {
2402 /* In .htaccess, we can't globally register new methods. */
2403 return apr_psprintf(cmd->pool, "Could not register method '%s' "
2404 "for %s from .htaccess configuration",
2405 method, cmd->cmd->name);
2406 }
2408 apr_pstrdup(cmd->pool, method));
2409 }
2410
2411 limited |= (AP_METHOD_BIT << methnum);
2412 }
2413
2414 /* Killing two features with one function,
2415 * if (tog == NULL) <Limit>, else <LimitExcept>
2416 */
2417 limited = tog ? ~limited : limited;
2418
2419 if (!(old_limited & limited)) {
2420 return apr_pstrcat(cmd->pool, cmd->cmd->name,
2421 "> directive excludes all methods", NULL);
2422 }
2423 else if ((old_limited & limited) == old_limited) {
2424 return apr_pstrcat(cmd->pool, cmd->cmd->name,
2425 "> directive specifies methods already excluded",
2426 NULL);
2427 }
2428
2429 cmd->limited &= limited;
2430
2431 errmsg = ap_walk_config(cmd->directive->first_child, cmd, cmd->context);
2432
2433 cmd->limited = old_limited;
2434
2435 return errmsg;
2436}
2437
2438/* XXX: Bogus - need to do this differently (at least OS2/Netware suffer
2439 * the same problem!!!
2440 * We use this in <DirectoryMatch> and <FilesMatch>, to ensure that
2441 * people don't get bitten by wrong-cased regex matches
2442 */
2443
2444#ifdef WIN32
2445#define USE_ICASE AP_REG_ICASE
2446#else
2447#define USE_ICASE 0
2448#endif
2449
2450static const char *dirsection(cmd_parms *cmd, void *mconfig, const char *arg)
2451{
2452 const char *errmsg;
2453 const char *endp = ap_strrchr_c(arg, '>');
2454 int old_overrides = cmd->override;
2455 char *old_path = cmd->path;
2456 core_dir_config *conf;
2458 ap_regex_t *r = NULL;
2459 const command_rec *thiscmd = cmd->cmd;
2460
2462 if (err != NULL) {
2463 return err;
2464 }
2465
2466 if (endp == NULL) {
2467 return unclosed_directive(cmd);
2468 }
2469
2470 arg = apr_pstrndup(cmd->temp_pool, arg, endp - arg);
2471
2472 if (!arg[0]) {
2473 return missing_container_arg(cmd);
2474 }
2475
2476 cmd->path = ap_getword_conf(cmd->pool, &arg);
2477 cmd->override = OR_ALL|ACCESS_CONF;
2478
2479 if (!strcmp(cmd->path, "~")) {
2480 cmd->path = ap_getword_conf(cmd->pool, &arg);
2481 if (!cmd->path)
2482 return "<Directory ~ > block must specify a path";
2483 r = ap_pregcomp(cmd->pool, cmd->path, AP_REG_EXTENDED|USE_ICASE);
2484 if (!r) {
2485 return "Regex could not be compiled";
2486 }
2487 }
2488 else if (thiscmd->cmd_data) { /* <DirectoryMatch> */
2489 r = ap_pregcomp(cmd->pool, cmd->path, AP_REG_EXTENDED|USE_ICASE);
2490 if (!r) {
2491 return "Regex could not be compiled";
2492 }
2493 }
2494 else if (strcmp(cmd->path, "/") != 0)
2495 {
2496 char *newpath;
2497
2498 /*
2499 * Ensure that the pathname is canonical, and append the trailing /
2500 */
2502 APR_FILEPATH_TRUENAME, cmd->pool);
2503 if (rv != APR_SUCCESS && rv != APR_EPATHWILD) {
2504 return apr_pstrcat(cmd->pool, "<Directory \"", cmd->path,
2505 "\"> path is invalid.", NULL);
2506 }
2507
2508 cmd->path = newpath;
2509 if (cmd->path[strlen(cmd->path) - 1] != '/')
2510 cmd->path = apr_pstrcat(cmd->pool, cmd->path, "/", NULL);
2511 }
2512
2513 /* initialize our config and fetch it */
2514 conf = ap_set_config_vectors(cmd->server, new_dir_conf, cmd->path,
2515 &core_module, cmd->pool);
2516
2517 errmsg = ap_walk_config(cmd->directive->first_child, cmd, new_dir_conf);
2518 if (errmsg != NULL)
2519 return errmsg;
2520
2521 conf->r = r;
2522 conf->d = cmd->path;
2523 conf->d_is_fnmatch = (apr_fnmatch_test(conf->d) != 0);
2524
2525 if (r) {
2526 conf->refs = apr_array_make(cmd->pool, 8, sizeof(char *));
2527 ap_regname(r, conf->refs, AP_REG_MATCH, 1);
2528 }
2529
2530 /* Make this explicit - the "/" root has 0 elements, that is, we
2531 * will always merge it, and it will always sort and merge first.
2532 * All others are sorted and tested by the number of slashes.
2533 */
2534 if (strcmp(conf->d, "/") == 0)
2535 conf->d_components = 0;
2536 else
2537 conf->d_components = ap_count_dirs(conf->d);
2538
2540
2541 if (*arg != '\0') {
2542 return apr_pstrcat(cmd->pool, "Multiple ", thiscmd->name,
2543 "> arguments not (yet) supported.", NULL);
2544 }
2545
2546 cmd->path = old_path;
2547 cmd->override = old_overrides;
2548
2549 return NULL;
2550}
2551
2552static const char *urlsection(cmd_parms *cmd, void *mconfig, const char *arg)
2553{
2554 const char *errmsg;
2555 const char *endp = ap_strrchr_c(arg, '>');
2556 int old_overrides = cmd->override;
2557 char *old_path = cmd->path;
2558 core_dir_config *conf;
2559 ap_regex_t *r = NULL;
2560 const command_rec *thiscmd = cmd->cmd;
2563 if (err != NULL) {
2564 return err;
2565 }
2566
2567 if (endp == NULL) {
2568 return unclosed_directive(cmd);
2569 }
2570
2571 arg = apr_pstrndup(cmd->temp_pool, arg, endp - arg);
2572
2573 if (!arg[0]) {
2574 return missing_container_arg(cmd);
2575 }
2576
2577 cmd->path = ap_getword_conf(cmd->pool, &arg);
2578 cmd->override = OR_ALL|ACCESS_CONF;
2579
2580 if (thiscmd->cmd_data) { /* <LocationMatch> */
2581 r = ap_pregcomp(cmd->pool, cmd->path, AP_REG_EXTENDED);
2582 if (!r) {
2583 return "Regex could not be compiled";
2584 }
2585 }
2586 else if (!strcmp(cmd->path, "~")) {
2587 cmd->path = ap_getword_conf(cmd->pool, &arg);
2588 r = ap_pregcomp(cmd->pool, cmd->path, AP_REG_EXTENDED);
2589 if (!r) {
2590 return "Regex could not be compiled";
2591 }
2592 }
2593
2594 /* initialize our config and fetch it */
2595 conf = ap_set_config_vectors(cmd->server, new_url_conf, cmd->path,
2596 &core_module, cmd->pool);
2597
2598 errmsg = ap_walk_config(cmd->directive->first_child, cmd, new_url_conf);
2599 if (errmsg != NULL)
2600 return errmsg;
2601
2602 conf->d = apr_pstrdup(cmd->pool, cmd->path); /* No mangling, please */
2603 conf->d_is_fnmatch = apr_fnmatch_test(conf->d) != 0;
2604 conf->r = r;
2605
2606 if (r) {
2607 conf->refs = apr_array_make(cmd->pool, 8, sizeof(char *));
2608 ap_regname(r, conf->refs, AP_REG_MATCH, 1);
2609 }
2610
2612
2613 if (*arg != '\0') {
2614 return apr_pstrcat(cmd->pool, "Multiple ", thiscmd->name,
2615 "> arguments not (yet) supported.", NULL);
2616 }
2617
2618 cmd->path = old_path;
2619 cmd->override = old_overrides;
2620
2621 return NULL;
2622}
2623
2624static const char *filesection(cmd_parms *cmd, void *mconfig, const char *arg)
2625{
2626 const char *errmsg;
2627 const char *endp = ap_strrchr_c(arg, '>');
2628 int old_overrides = cmd->override;
2629 char *old_path = cmd->path;
2630 core_dir_config *conf;
2631 ap_regex_t *r = NULL;
2632 const command_rec *thiscmd = cmd->cmd;
2634 const char *err = ap_check_cmd_context(cmd,
2636
2637 if (err != NULL) {
2638 return err;
2639 }
2640
2641 if (endp == NULL) {
2642 return unclosed_directive(cmd);
2643 }
2644
2645 arg = apr_pstrndup(cmd->temp_pool, arg, endp - arg);
2646
2647 if (!arg[0]) {
2648 return missing_container_arg(cmd);
2649 }
2650
2651 cmd->path = ap_getword_conf(cmd->pool, &arg);
2652 /* Only if not an .htaccess file */
2653 if (!old_path) {
2654 cmd->override = OR_ALL|ACCESS_CONF;
2655 }
2656
2657 if (thiscmd->cmd_data) { /* <FilesMatch> */
2658 r = ap_pregcomp(cmd->pool, cmd->path, AP_REG_EXTENDED|USE_ICASE);
2659 if (!r) {
2660 return "Regex could not be compiled";
2661 }
2662 }
2663 else if (!strcmp(cmd->path, "~")) {
2664 cmd->path = ap_getword_conf(cmd->pool, &arg);
2665 r = ap_pregcomp(cmd->pool, cmd->path, AP_REG_EXTENDED|USE_ICASE);
2666 if (!r) {
2667 return "Regex could not be compiled";
2668 }
2669 }
2670 else {
2671 char *newpath;
2672 /* Ensure that the pathname is canonical, but we
2673 * can't test the case/aliases without a fixed path */
2674 if (apr_filepath_merge(&newpath, "", cmd->path,
2675 0, cmd->pool) != APR_SUCCESS)
2676 return apr_pstrcat(cmd->pool, "<Files \"", cmd->path,
2677 "\"> is invalid.", NULL);
2678 cmd->path = newpath;
2679 }
2680
2681 /* initialize our config and fetch it */
2682 conf = ap_set_config_vectors(cmd->server, new_file_conf, cmd->path,
2683 &core_module, cmd->pool);
2684
2685 errmsg = ap_walk_config(cmd->directive->first_child, cmd, new_file_conf);
2686 if (errmsg != NULL)
2687 return errmsg;
2688
2689 conf->d = cmd->path;
2690 conf->d_is_fnmatch = apr_fnmatch_test(conf->d) != 0;
2691 conf->r = r;
2692
2693 if (r) {
2694 conf->refs = apr_array_make(cmd->pool, 8, sizeof(char *));
2695 ap_regname(r, conf->refs, AP_REG_MATCH, 1);
2696 }
2697
2699
2700 if (*arg != '\0') {
2701 return apr_pstrcat(cmd->pool, "Multiple ", thiscmd->name,
2702 "> arguments not (yet) supported.", NULL);
2703 }
2704
2705 cmd->path = old_path;
2706 cmd->override = old_overrides;
2707
2708 return NULL;
2709}
2710
2711#define COND_IF ((void *)1)
2712#define COND_ELSE ((void *)2)
2713#define COND_ELSEIF ((void *)3)
2714
2715static const char *ifsection(cmd_parms *cmd, void *mconfig, const char *arg)
2716{
2717 const char *errmsg;
2718 const char *endp = ap_strrchr_c(arg, '>');
2719 int old_overrides = cmd->override;
2720 char *old_path = cmd->path;
2721 core_dir_config *conf;
2722 const command_rec *thiscmd = cmd->cmd;
2724 const char *err = ap_check_cmd_context(cmd, NOT_IN_LIMIT);
2725 const char *condition;
2726 const char *expr_err;
2727
2728 if (err != NULL) {
2729 return err;
2730 }
2731
2732 if (endp == NULL) {
2733 return unclosed_directive(cmd);
2734 }
2735
2736 arg = apr_pstrndup(cmd->temp_pool, arg, endp - arg);
2737
2738 /*
2739 * Set a dummy value so that other directives notice that they are inside
2740 * a config section.
2741 */
2742 cmd->path = "*If";
2743 /* Only if not an .htaccess file */
2744 if (!old_path) {
2745 cmd->override = OR_ALL|ACCESS_CONF;
2746 }
2747
2748 /* initialize our config and fetch it */
2749 conf = ap_set_config_vectors(cmd->server, new_if_conf, cmd->path,
2750 &core_module, cmd->pool);
2751
2752 if (cmd->cmd->cmd_data == COND_IF)
2754 else if (cmd->cmd->cmd_data == COND_ELSEIF)
2756 else if (cmd->cmd->cmd_data == COND_ELSE)
2758 else
2759 ap_assert(0);
2760
2761 if (conf->condition_ifelse == AP_CONDITION_ELSE) {
2762 if (arg[0])
2763 return "<Else> does not take an argument";
2764 }
2765 else {
2766 if (!arg[0])
2767 return missing_container_arg(cmd);
2768 condition = ap_getword_conf(cmd->pool, &arg);
2769 conf->condition = ap_expr_parse_cmd(cmd, condition, 0, &expr_err, NULL);
2770 if (expr_err)
2771 return apr_psprintf(cmd->pool, "Cannot parse condition clause: %s",
2772 expr_err);
2773 }
2774
2775 errmsg = ap_walk_config(cmd->directive->first_child, cmd, new_if_conf);
2776 if (errmsg != NULL)
2777 return errmsg;
2778
2779 conf->d = cmd->path;
2780 conf->d_is_fnmatch = 0;
2781 conf->r = NULL;
2782
2784 if (errmsg != NULL)
2785 return errmsg;
2786
2787 if (*arg != '\0') {
2788 return apr_pstrcat(cmd->pool, "Multiple ", thiscmd->name,
2789 "> arguments not supported.", NULL);
2790 }
2791
2792 cmd->path = old_path;
2793 cmd->override = old_overrides;
2794
2795 return NULL;
2796}
2797
2798static module *find_module(server_rec *s, const char *name)
2799{
2800 module *found = ap_find_linked_module(name);
2801
2802 /* search prelinked stuff */
2803 if (!found) {
2805
2806 for (; current->name; ++current) {
2807 if (!strcmp(current->name, name)) {
2808 found = current->modp;
2809 break;
2810 }
2811 }
2812 }
2813
2814 /* search dynamic stuff */
2815 if (!found) {
2818
2819 if (check_symbol) {
2820 /*
2821 * There are two phases where calling ap_find_loaded_module_symbol
2822 * is problematic:
2823 *
2824 * During reading of the config, ap_server_conf is invalid but s
2825 * points to the main server config, if passed from cmd->server
2826 * of an EXEC_ON_READ directive.
2827 *
2828 * During config parsing, s may be a virtual host that would cause
2829 * a segfault in mod_so if passed to ap_find_loaded_module_symbol,
2830 * because mod_so's server config for vhosts is initialized later.
2831 * But ap_server_conf is already set at this time.
2832 *
2833 * Therefore we use s if it is not virtual and ap_server_conf if
2834 * s is virtual.
2835 */
2836 found = check_symbol(s->is_virtual ? ap_server_conf : s, name);
2837 }
2838 }
2839
2840 return found;
2841}
2842
2843/* Callback function type used by start_cond_section. */
2844typedef int (*test_cond_section_fn)(cmd_parms *cmd, const char *arg);
2845
2846/* Implementation of <IfXXXXX>-style conditional sections. Callback
2847 * to test condition must be in cmd->info, matching function type
2848 * test_cond_section_fn. */
2849static const char *start_cond_section(cmd_parms *cmd, void *mconfig, const char *arg)
2850{
2851 const char *endp = ap_strrchr_c(arg, '>');
2852 int result, not = (arg[0] == '!');
2854 const char *arg1;
2855
2856 if (endp == NULL) {
2857 return unclosed_directive(cmd);
2858 }
2859
2860 arg = apr_pstrmemdup(cmd->temp_pool, arg, endp - arg);
2861
2862 if (not) {
2863 arg++;
2864 }
2865
2866 arg1 = ap_getword_conf(cmd->temp_pool, &arg);
2867
2868 if (!arg1[0]) {
2869 return missing_container_arg(cmd);
2870 }
2871
2872 result = testfn(cmd, arg1);
2873
2874 if ((!not && result) || (not && !result)) {
2876 ap_directive_t *current = NULL;
2877 const char *retval;
2878
2879 retval = ap_build_cont_config(cmd->pool, cmd->temp_pool, cmd,
2880 &current, &parent, (char *)cmd->cmd->name);
2881 *(ap_directive_t **)mconfig = current;
2882 return retval;
2883 }
2884 else {
2886 return ap_soak_end_container(cmd, (char *)cmd->cmd->name);
2887 }
2888}
2889
2890/* Callback to implement <IfModule> test for start_cond_section. */
2891static int test_ifmod_section(cmd_parms *cmd, const char *arg)
2892{
2893 return find_module(cmd->server, arg) != NULL;
2894}
2895
2900
2901static int test_ifdefine_section(cmd_parms *cmd, const char *arg)
2902{
2904}
2905
2906static int test_iffile_section(cmd_parms *cmd, const char *arg)
2907{
2908 const char *relative;
2910
2911 /*
2912 * At least on Windows, if the path we are testing is not valid (for example
2913 * a path on a USB key that is not plugged), 'ap_server_root_relative()' will
2914 * return NULL. In such a case, consider that the file is not there and that
2915 * the section should be skipped.
2916 */
2917 relative = ap_server_root_relative(cmd->temp_pool, arg);
2918 return (relative &&
2919 (apr_stat(&sb, relative, APR_FINFO_TYPE, cmd->temp_pool) == APR_SUCCESS));
2920}
2921
2923{
2924 return ap_exists_directive(cmd->temp_pool, arg);
2925}
2926
2927static int test_ifsection_section(cmd_parms *cmd, const char *arg)
2928{
2929 const char *name = apr_pstrcat(cmd->temp_pool, "<", arg, NULL);
2930 return ap_exists_directive(cmd->temp_pool, name);
2931}
2932
2933/* httpd.conf commands... beginning with the <VirtualHost> business */
2934
2935static const char *virtualhost_section(cmd_parms *cmd, void *dummy,
2936 const char *arg)
2937{
2938 server_rec *main_server = cmd->server, *s;
2939 const char *errmsg;
2940 const char *endp = ap_strrchr_c(arg, '>');
2941 apr_pool_t *p = cmd->pool;
2942
2943 const char *err = ap_check_cmd_context(cmd, GLOBAL_ONLY);
2944 if (err != NULL) {
2945 return err;
2946 }
2947
2948 if (endp == NULL) {
2949 return unclosed_directive(cmd);
2950 }
2951
2952 arg = apr_pstrndup(cmd->temp_pool, arg, endp - arg);
2953
2954 if (!arg[0]) {
2955 return missing_container_arg(cmd);
2956 }
2957
2958 /* FIXME: There's another feature waiting to happen here -- since you
2959 can now put multiple addresses/names on a single <VirtualHost>
2960 you might want to use it to group common definitions and then
2961 define other "subhosts" with their individual differences. But
2962 personally I'd rather just do it with a macro preprocessor. -djg */
2963 if (main_server->is_virtual) {
2964 return "<VirtualHost> doesn't nest!";
2965 }
2966
2967 errmsg = ap_init_virtual_host(p, arg, main_server, &s);
2968 if (errmsg) {
2969 return errmsg;
2970 }
2971
2972 s->next = main_server->next;
2973 main_server->next = s;
2974
2975 s->defn_name = cmd->directive->filename;
2976 s->defn_line_number = cmd->directive->line_num;
2977
2978 cmd->server = s;
2979
2980 errmsg = ap_walk_config(cmd->directive->first_child, cmd,
2981 s->lookup_defaults);
2982
2983 cmd->server = main_server;
2984
2985 return errmsg;
2986}
2987
2989 void *dummy,
2990 const char *arg)
2991{
2992 const command_rec *thiscmd = cmd->cmd;
2993 int cflags, cflag;
2994
2995 const char *err = ap_check_cmd_context(cmd, GLOBAL_ONLY);
2996 if (err != NULL) {
2997 return err;
2998 }
2999
3001 while (*arg) {
3002 const char *name = ap_getword_conf(cmd->pool, &arg);
3003 int how = 0;
3004
3005 if (strcasecmp(name, "none") == 0) {
3006 cflags = 0;
3007 continue;
3008 }
3009
3010 if (*name == '+') {
3011 name++;
3012 how = +1;
3013 }
3014 else if (*name == '-') {
3015 name++;
3016 how = -1;
3017 }
3018
3020 if (!cflag) {
3021 return apr_psprintf(cmd->pool, "%s: option '%s' unknown",
3022 thiscmd->name, name);
3023 }
3024
3025 if (how > 0) {
3026 cflags |= cflag;
3027 }
3028 else if (how < 0) {
3029 cflags &= ~cflag;
3030 }
3031 else {
3032 cflags = cflag;
3033 }
3034 }
3036
3037 return NULL;
3038}
3039
3040static const char *set_server_alias(cmd_parms *cmd, void *dummy,
3041 const char *arg)
3042{
3043 if (!cmd->server->names) {
3044 return "ServerAlias only used in <VirtualHost>";
3045 }
3046
3047 while (*arg) {
3048 char **item, *name = ap_getword_conf(cmd->pool, &arg);
3049
3050 if (ap_is_matchexp(name)) {
3051 item = (char **)apr_array_push(cmd->server->wild_names);
3052 }
3053 else {
3054 item = (char **)apr_array_push(cmd->server->names);
3055 }
3056
3057 *item = name;
3058 }
3059
3060 return NULL;
3061}
3062
3063static const char *set_accf_map(cmd_parms *cmd, void *dummy,
3064 const char *iproto, const char* iaccf)
3065{
3066 const char *err = ap_check_cmd_context(cmd, GLOBAL_ONLY);
3067 core_server_config *conf =
3068 ap_get_core_module_config(cmd->server->module_config);
3069 char* proto;
3070 char* accf;
3071 if (err != NULL) {
3072 return err;
3073 }
3074
3075 proto = apr_pstrdup(cmd->pool, iproto);
3076 ap_str_tolower(proto);
3077 accf = apr_pstrdup(cmd->pool, iaccf);
3079 apr_table_setn(conf->accf_map, proto, accf);
3080
3081 return NULL;
3082}
3083
3085{
3086 core_server_config *conf = ap_get_core_module_config(s->module_config);
3087 return conf->protocol;
3088}
3089
3091{
3092 core_server_config *conf = ap_get_core_module_config(s->module_config);
3093 conf->protocol = proto;
3094}
3095
3096static const char *set_protocol(cmd_parms *cmd, void *dummy,
3097 const char *arg)
3098{
3100 core_server_config *conf =
3101 ap_get_core_module_config(cmd->server->module_config);
3102 char* proto;
3103
3104 if (err != NULL) {
3105 return err;
3106 }
3107
3108 proto = apr_pstrdup(cmd->pool, arg);
3109 ap_str_tolower(proto);
3110 conf->protocol = proto;
3111
3112 return NULL;
3113}
3114
3115static const char *set_server_string_slot(cmd_parms *cmd, void *dummy,
3116 const char *arg)
3117{
3118 /* This one's pretty generic... */
3119
3120 int offset = (int)(long)cmd->info;
3121 char *struct_ptr = (char *)cmd->server;
3122
3124 if (err != NULL) {
3125 return err;
3126 }
3127
3128 *(const char **)(struct_ptr + offset) = arg;
3129 return NULL;
3130}
3131
3132/*
3133 * The ServerName directive takes one argument with format
3134 * [scheme://]fully-qualified-domain-name[:port], for instance
3135 * ServerName www.example.com
3136 * ServerName www.example.com:80
3137 * ServerName https://www.example.com:443
3138 */
3139
3140static const char *server_hostname_port(cmd_parms *cmd, void *dummy, const char *arg)
3141{
3143 const char *portstr, *part;
3144 char *scheme;
3145 int port;
3146
3147 if (err != NULL) {
3148 return err;
3149 }
3150
3151 if (apr_fnmatch_test(arg))
3152 return apr_pstrcat(cmd->temp_pool, "Invalid ServerName \"", arg,
3153 "\" use ServerAlias to set multiple server names.", NULL);
3154
3155 part = ap_strstr_c(arg, "://");
3156
3157 if (part) {
3158 scheme = apr_pstrndup(cmd->pool, arg, part - arg);
3159 ap_str_tolower(scheme);
3160 cmd->server->server_scheme = (const char *)scheme;
3161 part += 3;
3162 } else {
3163 part = arg;
3164 }
3165
3166 portstr = ap_strchr_c(part, ':');
3167 if (portstr) {
3168 cmd->server->server_hostname = apr_pstrndup(cmd->pool, part,
3169 portstr - part);
3170 portstr++;
3171 port = atoi(portstr);
3172 if (port <= 0 || port >= 65536) { /* 65536 == 1<<16 */
3173 return apr_pstrcat(cmd->temp_pool, "The port number \"", arg,
3174 "\" is outside the appropriate range "
3175 "(i.e., 1..65535).", NULL);
3176 }
3177 }
3178 else {
3179 cmd->server->server_hostname = apr_pstrdup(cmd->pool, part);
3180 port = 0;
3181 }
3182
3183 cmd->server->port = port;
3184 return NULL;
3185}
3186
3187static const char *set_signature_flag(cmd_parms *cmd, void *d_,
3188 const char *arg)
3189{
3190 core_dir_config *d = d_;
3191
3192 if (ap_cstr_casecmp(arg, "On") == 0) {
3194 }
3195 else if (ap_cstr_casecmp(arg, "Off") == 0) {
3196 d->server_signature = srv_sig_off;
3197 }
3198 else if (ap_cstr_casecmp(arg, "EMail") == 0) {
3199 d->server_signature = srv_sig_withmail;
3200 }
3201 else {
3202 return "ServerSignature: use one of: off | on | email";
3203 }
3204
3205 return NULL;
3206}
3207
3208static const char *set_server_root(cmd_parms *cmd, void *dummy,
3209 const char *arg)
3210{
3211 const char *err = ap_check_cmd_context(cmd, GLOBAL_ONLY);
3212
3213 if (err != NULL) {
3214 return err;
3215 }
3216
3217 if ((apr_filepath_merge((char**)&ap_server_root, NULL, arg,
3219 || !ap_is_directory(cmd->temp_pool, ap_server_root)) {
3220 return "ServerRoot must be a valid directory";
3221 }
3222
3223 return NULL;
3224}
3225
3226static const char *set_runtime_dir(cmd_parms *cmd, void *dummy, const char *arg)
3227{
3228 const char *err = ap_check_cmd_context(cmd, GLOBAL_ONLY);
3229
3230 if (err != NULL) {
3231 return err;
3232 }
3233
3234 if ((apr_filepath_merge((char**)&ap_runtime_dir, NULL,
3235 ap_server_root_relative(cmd->temp_pool, arg),
3237 || !ap_is_directory(cmd->temp_pool, ap_runtime_dir)) {
3238 return "DefaultRuntimeDir must be a valid directory, absolute or relative to ServerRoot";
3239 }
3240
3241 return NULL;
3242}
3243
3244static const char *set_timeout(cmd_parms *cmd, void *dummy, const char *arg)
3245{
3247
3248 if (err != NULL) {
3249 return err;
3250 }
3251
3252 cmd->server->timeout = apr_time_from_sec(atoi(arg));
3253 return NULL;
3254}
3255
3256static const char *set_allow2f(cmd_parms *cmd, void *d_, const char *arg)
3257{
3258 core_dir_config *d = d_;
3259
3260 if (0 == ap_cstr_casecmp(arg, "on")) {
3262 d->decode_encoded_slashes = 1; /* for compatibility with 2.0 & 2.2 */
3263 } else if (0 == ap_cstr_casecmp(arg, "off")) {
3264 d->allow_encoded_slashes = 0;
3265 d->decode_encoded_slashes = 0;
3266 } else if (0 == ap_cstr_casecmp(arg, "nodecode")) {
3267 d->allow_encoded_slashes = 1;
3268 d->decode_encoded_slashes = 0;
3269 } else {
3270 return apr_pstrcat(cmd->pool,
3271 cmd->cmd->name, " must be On, Off, or NoDecode",
3272 NULL);
3273 }
3274 return NULL;
3275}
3276
3277static const char *set_hostname_lookups(cmd_parms *cmd, void *d_,
3278 const char *arg)
3279{
3280 core_dir_config *d = d_;
3281
3282 if (!ap_cstr_casecmp(arg, "on")) {
3284 }
3285 else if (!ap_cstr_casecmp(arg, "off")) {
3286 d->hostname_lookups = HOSTNAME_LOOKUP_OFF;
3287 }
3288 else if (!ap_cstr_casecmp(arg, "double")) {
3289 d->hostname_lookups = HOSTNAME_LOOKUP_DOUBLE;
3290 }
3291 else {
3292 return "parameter must be 'on', 'off', or 'double'";
3293 }
3294
3295 return NULL;
3296}
3297
3298static const char *set_serverpath(cmd_parms *cmd, void *dummy,
3299 const char *arg)
3300{
3302
3303 if (err != NULL) {
3304 return err;
3305 }
3306
3307 cmd->server->path = arg;
3308 cmd->server->pathlen = (int)strlen(arg);
3309 return NULL;
3310}
3311
3312static const char *set_content_md5(cmd_parms *cmd, void *d_, int arg)
3313{
3314 core_dir_config *d = d_;
3315
3317 return NULL;
3318}
3319
3320static const char *set_accept_path_info(cmd_parms *cmd, void *d_, const char *arg)
3321{
3322 core_dir_config *d = d_;
3323
3324 if (ap_cstr_casecmp(arg, "on") == 0) {
3326 }
3327 else if (ap_cstr_casecmp(arg, "off") == 0) {
3328 d->accept_path_info = AP_REQ_REJECT_PATH_INFO;
3329 }
3330 else if (ap_cstr_casecmp(arg, "default") == 0) {
3331 d->accept_path_info = AP_REQ_DEFAULT_PATH_INFO;
3332 }
3333 else {
3334 return "AcceptPathInfo must be set to on, off or default";
3335 }
3336
3337 return NULL;
3338}
3339
3340static const char *set_use_canonical_name(cmd_parms *cmd, void *d_,
3341 const char *arg)
3342{
3343 core_dir_config *d = d_;
3344
3345 if (ap_cstr_casecmp(arg, "on") == 0) {
3347 }
3348 else if (ap_cstr_casecmp(arg, "off") == 0) {
3349 d->use_canonical_name = USE_CANONICAL_NAME_OFF;
3350 }
3351 else if (ap_cstr_casecmp(arg, "dns") == 0) {
3352 d->use_canonical_name = USE_CANONICAL_NAME_DNS;
3353 }
3354 else {
3355 return "parameter must be 'on', 'off', or 'dns'";
3356 }
3357
3358 return NULL;
3359}
3360
3361static const char *set_use_canonical_phys_port(cmd_parms *cmd, void *d_,
3362 const char *arg)
3363{
3364 core_dir_config *d = d_;
3365
3366 if (ap_cstr_casecmp(arg, "on") == 0) {
3368 }
3369 else if (ap_cstr_casecmp(arg, "off") == 0) {
3370 d->use_canonical_phys_port = USE_CANONICAL_PHYS_PORT_OFF;
3371 }
3372 else {
3373 return "parameter must be 'on' or 'off'";
3374 }
3375
3376 return NULL;
3377}
3378
3379static const char *include_config (cmd_parms *cmd, void *dummy,
3380 const char *name)
3381{
3382 ap_directive_t *conftree = NULL;
3383 const char *conffile, *error;
3384 unsigned *recursion;
3385 int optional = cmd->cmd->cmd_data ? 1 : 0;
3386 void *data;
3387
3388 /* NOTE: ap_include_sentinel is also used by ap_process_resource_config()
3389 * during DUMP_INCLUDES; don't change its type or remove it without updating
3390 * the other.
3391 */
3392 apr_pool_userdata_get(&data, "ap_include_sentinel", cmd->pool);
3393 if (data) {
3394 recursion = data;
3395 }
3396 else {
3397 data = recursion = apr_palloc(cmd->pool, sizeof(*recursion));
3398 *recursion = 0;
3399 apr_pool_userdata_setn(data, "ap_include_sentinel", NULL, cmd->pool);
3400 }
3401
3403 *recursion = 0;
3404 return apr_psprintf(cmd->pool, "Exceeded maximum include depth of %u, "
3405 "There appears to be a recursion.",
3407 }
3408
3410 if (!conffile) {
3411 *recursion = 0;
3412 return apr_pstrcat(cmd->pool, "Invalid Include path ",
3413 name, NULL);
3414 }
3415
3416 if (ap_exists_config_define("DUMP_INCLUDES")) {
3417 unsigned *line_number;
3418
3419 /* NOTE: ap_include_lineno is used by ap_process_resource_config()
3420 * during DUMP_INCLUDES; don't change its type or remove it without
3421 * updating the other.
3422 */
3423 apr_pool_userdata_get(&data, "ap_include_lineno", cmd->pool);
3424 if (data) {
3425 line_number = data;
3426 } else {
3427 data = line_number = apr_palloc(cmd->pool, sizeof(*line_number));
3428 apr_pool_userdata_setn(data, "ap_include_lineno", NULL, cmd->pool);
3429 }
3430
3431 *line_number = cmd->config_file->line_number;
3432 }
3433
3434 error = ap_process_fnmatch_configs(cmd->server, conffile, &conftree,
3435 cmd->pool, cmd->temp_pool,
3436 optional);
3437 if (error) {
3438 *recursion = 0;
3439 return error;
3440 }
3441
3442 *(ap_directive_t **)dummy = conftree;
3443
3444 /* recursion level done */
3445 if (*recursion) {
3446 --*recursion;
3447 }
3448
3449 return NULL;
3450}
3451
3452static const char *set_loglevel(cmd_parms *cmd, void *config_, const char *arg_)
3453{
3454 char *level_str;
3455 int level;
3456 module *module;
3457 char *arg = apr_pstrdup(cmd->temp_pool, arg_);
3458 struct ap_logconf *log;
3459 const char *err;
3460
3461 if (cmd->path) {
3462 core_dir_config *dconf = config_;
3463 if (!dconf->log) {
3464 dconf->log = ap_new_log_config(cmd->pool, NULL);
3465 }
3466 log = dconf->log;
3467 }
3468 else {
3469 log = &cmd->server->log;
3470 }
3471
3472 if (arg == NULL)
3473 return "LogLevel requires level keyword or module loglevel specifier";
3474
3475 level_str = ap_strrchr(arg, ':');
3476
3477 if (level_str == NULL) {
3478 err = ap_parse_log_level(arg, &log->level);
3479 if (err != NULL)
3480 return err;
3483 "Setting LogLevel for all modules to %s", arg);
3484 return NULL;
3485 }
3486
3487 *level_str++ = '\0';
3488 if (!*level_str) {
3489 return apr_psprintf(cmd->temp_pool, "Module specifier '%s' must be "
3490 "followed by a log level keyword", arg);
3491 }
3492
3494 if (err != NULL)
3495 return apr_psprintf(cmd->temp_pool, "%s:%s: %s", arg, level_str, err);
3496
3497 if ((module = find_module(cmd->server, arg)) == NULL) {
3498 char *name = apr_psprintf(cmd->temp_pool, "%s_module", arg);
3500 "Cannot find module '%s', trying '%s'", arg, name);
3501 module = find_module(cmd->server, name);
3502 }
3503
3504 if (module == NULL) {
3505 return apr_psprintf(cmd->temp_pool, "Cannot find module %s", arg);
3506 }
3507
3510 "Setting LogLevel for module %s to %s", module->name,
3511 level_str);
3512
3513 return NULL;
3514}
3515
3516AP_DECLARE(const char *) ap_psignature(const char *prefix, request_rec *r)
3517{
3518 char sport[20];
3519 core_dir_config *conf;
3520
3522 if ((conf->server_signature == srv_sig_off)
3523 || (conf->server_signature == srv_sig_unset)) {
3524 return "";
3525 }
3526
3527 apr_snprintf(sport, sizeof sport, "%u", (unsigned) ap_get_server_port(r));
3528
3529 if (conf->server_signature == srv_sig_withmail) {
3530 return apr_pstrcat(r->pool, prefix, "<address>",
3532 " Server at <a href=\"",
3533 ap_is_url(r->server->server_admin) ? "" : "mailto:",
3535 "\">",
3537 "</a> Port ", sport,
3538 "</address>\n", NULL);
3539 }
3540
3541 return apr_pstrcat(r->pool, prefix, "<address>", ap_get_server_banner(),
3542 " Server at ",
3544 " Port ", sport,
3545 "</address>\n", NULL);
3546}
3547
3548/*
3549 * Handle a request to include the server's OS platform in the Server
3550 * response header field (the ServerTokens directive). Unfortunately
3551 * this requires a new global in order to communicate the setting back to
3552 * http_main so it can insert the information in the right place in the
3553 * string.
3554 */
3555
3556static char *server_banner = NULL;
3557static int banner_locked = 0;
3558static const char *server_description = NULL;
3559
3561 SrvTk_MAJOR, /* eg: Apache/2 */
3562 SrvTk_MINOR, /* eg. Apache/2.0 */
3563 SrvTk_MINIMAL, /* eg: Apache/2.0.41 */
3564 SrvTk_OS, /* eg: Apache/2.0.41 (UNIX) */
3565 SrvTk_FULL, /* eg: Apache/2.0.41 (UNIX) PHP/4.2.2 FooBar/1.2b */
3566 SrvTk_PRODUCT_ONLY /* eg: Apache */
3569
3571{
3572 banner_locked = 0;
3576 return APR_SUCCESS;
3577}
3578
3586
3592
3597
3599{
3600 if (! banner_locked) {
3601 /*
3602 * If the version string is null, register our cleanup to reset the
3603 * pointer on pool destruction. We also know that, if NULL,
3604 * we are adding the original SERVER_BASEVERSION string.
3605 */
3606 if (server_banner == NULL) {
3610 }
3611 else {
3612 /*
3613 * Tack the given component identifier to the end of
3614 * the existing string.
3615 */
3617 component, NULL);
3618 }
3619 }
3621 component, NULL);
3622}
3623
3624/*
3625 * This routine adds the real server base identity to the banner string,
3626 * and then locks out changes until the next reconfig.
3627 */
3629{
3632 }
3633 else if (ap_server_tokens == SrvTk_MINIMAL) {
3635 }
3636 else if (ap_server_tokens == SrvTk_MINOR) {
3638 }
3639 else if (ap_server_tokens == SrvTk_MAJOR) {
3641 }
3642 else {
3644 }
3645
3646 /*
3647 * Lock the server_banner string if we're not displaying
3648 * the full set of tokens
3649 */
3651 banner_locked++;
3652 }
3654}
3655
3656static const char *set_serv_tokens(cmd_parms *cmd, void *dummy,
3657 const char *arg)
3658{
3659 const char *err = ap_check_cmd_context(cmd, GLOBAL_ONLY);
3660
3661 if (err != NULL) {
3662 return err;
3663 }
3664
3665 if (!ap_cstr_casecmp(arg, "OS")) {
3667 }
3668 else if (!ap_cstr_casecmp(arg, "Min") || !ap_cstr_casecmp(arg, "Minimal")) {
3670 }
3671 else if (!ap_cstr_casecmp(arg, "Major")) {
3673 }
3674 else if (!ap_cstr_casecmp(arg, "Minor") ) {
3676 }
3677 else if (!ap_cstr_casecmp(arg, "Prod") || !ap_cstr_casecmp(arg, "ProductOnly")) {
3679 }
3680 else if (!ap_cstr_casecmp(arg, "Full")) {
3682 }
3683 else {
3684 return "ServerTokens takes 1 argument: 'Prod(uctOnly)', 'Major', 'Minor', 'Min(imal)', 'OS', or 'Full'";
3685 }
3686
3687 return NULL;
3688}
3689
3690static const char *set_limit_req_line(cmd_parms *cmd, void *dummy,
3691 const char *arg)
3692{
3694 int lim;
3695
3696 if (err != NULL) {
3697 return err;
3698 }
3699
3700 lim = atoi(arg);
3701 if (lim < 0) {
3702 return apr_pstrcat(cmd->temp_pool, "LimitRequestLine \"", arg,
3703 "\" must be a non-negative integer", NULL);
3704 }
3705
3706 cmd->server->limit_req_line = lim;
3707 return NULL;
3708}
3709
3710static const char *set_limit_req_fieldsize(cmd_parms *cmd, void *dummy,
3711 const char *arg)
3712{
3714 int lim;
3715
3716 if (err != NULL) {
3717 return err;
3718 }
3719
3720 lim = atoi(arg);
3721 if (lim < 0) {
3722 return apr_pstrcat(cmd->temp_pool, "LimitRequestFieldsize \"", arg,
3723 "\" must be a non-negative integer",
3724 NULL);
3725 }
3726
3727 cmd->server->limit_req_fieldsize = lim;
3728 return NULL;
3729}
3730
3731static const char *set_limit_req_fields(cmd_parms *cmd, void *dummy,
3732 const char *arg)
3733{
3735 int lim;
3736
3737 if (err != NULL) {
3738 return err;
3739 }
3740
3741 lim = atoi(arg);
3742 if (lim < 0) {
3743 return apr_pstrcat(cmd->temp_pool, "LimitRequestFields \"", arg,
3744 "\" must be a non-negative integer (0 = no limit)",
3745 NULL);
3746 }
3747
3748 cmd->server->limit_req_fields = lim;
3749 return NULL;
3750}
3751
3752static const char *set_limit_req_body(cmd_parms *cmd, void *conf_,
3753 const char *arg)
3754{
3755 core_dir_config *conf = conf_;
3756 char *errp;
3757
3758 if (APR_SUCCESS != apr_strtoff(&conf->limit_req_body, arg, &errp, 10)) {
3759 return "LimitRequestBody argument is not parsable.";
3760 }
3761 if (*errp || conf->limit_req_body < 0) {
3762 return "LimitRequestBody requires a non-negative integer.";
3763 }
3764
3765 return NULL;
3766}
3767
3768static const char *set_limit_xml_req_body(cmd_parms *cmd, void *conf_,
3769 const char *arg)
3770{
3771 core_dir_config *conf = conf_;
3772
3773 conf->limit_xml_body = atol(arg);
3774 if (conf->limit_xml_body < 0)
3775 return "LimitXMLRequestBody requires a non-negative integer.";
3776
3777 /* zero is AP_MAX_LIMIT_XML_BODY (implicitly) */
3779 return apr_psprintf(cmd->pool, "LimitXMLRequestBody must not exceed "
3781
3782 return NULL;
3783}
3784
3785static const char *set_max_ranges(cmd_parms *cmd, void *conf_, const char *arg)
3786{
3787 core_dir_config *conf = conf_;
3788 int val = 0;
3789
3790 if (!ap_cstr_casecmp(arg, "none")) {
3792 }
3793 else if (!ap_cstr_casecmp(arg, "default")) {
3795 }
3796 else if (!ap_cstr_casecmp(arg, "unlimited")) {
3798 }
3799 else {
3800 val = atoi(arg);
3801 if (val <= 0)
3802 return "MaxRanges requires 'none', 'default', 'unlimited' or "
3803 "a positive integer";
3804 }
3805
3806 conf->max_ranges = val;
3807
3808 return NULL;
3809}
3810
3811static const char *set_max_overlaps(cmd_parms *cmd, void *conf_, const char *arg)
3812{
3813 core_dir_config *conf = conf_;
3814 int val = 0;
3815
3816 if (!ap_cstr_casecmp(arg, "none")) {
3818 }
3819 else if (!ap_cstr_casecmp(arg, "default")) {
3821 }
3822 else if (!ap_cstr_casecmp(arg, "unlimited")) {
3824 }
3825 else {
3826 val = atoi(arg);
3827 if (val <= 0)
3828 return "MaxRangeOverlaps requires 'none', 'default', 'unlimited' or "
3829 "a positive integer";
3830 }
3831
3832 conf->max_overlaps = val;
3833
3834 return NULL;
3835}
3836
3837static const char *set_max_reversals(cmd_parms *cmd, void *conf_, const char *arg)
3838{
3839 core_dir_config *conf = conf_;
3840 int val = 0;
3841
3842 if (!ap_cstr_casecmp(arg, "none")) {
3844 }
3845 else if (!ap_cstr_casecmp(arg, "default")) {
3847 }
3848 else if (!ap_cstr_casecmp(arg, "unlimited")) {
3850 }
3851 else {
3852 val = atoi(arg);
3853 if (val <= 0)
3854 return "MaxRangeReversals requires 'none', 'default', 'unlimited' or "
3855 "a positive integer";
3856 }
3857
3858 conf->max_reversals = val;
3859
3860 return NULL;
3861}
3862
3864{
3865 core_dir_config *conf;
3866
3868 if (conf->limit_xml_body == AP_LIMIT_UNSET)
3870 if (conf->limit_xml_body == 0)
3871 return AP_MAX_LIMIT_XML_BODY;
3872
3873 return (apr_size_t)conf->limit_xml_body;
3874}
3875
3876#if !defined (RLIMIT_CPU) || !(defined (RLIMIT_DATA) || defined (RLIMIT_VMEM) || defined(RLIMIT_AS)) || !defined (RLIMIT_NPROC)
3877static const char *no_set_limit(cmd_parms *cmd, void *conf_,
3878 const char *arg, const char *arg2)
3879{
3880 ap_log_error(APLOG_MARK, APLOG_ERR, 0, cmd->server, APLOGNO(00118)
3881 "%s not supported on this platform", cmd->cmd->name);
3882
3883 return NULL;
3884}
3885#endif
3886
3887#ifdef RLIMIT_CPU
3888static const char *set_limit_cpu(cmd_parms *cmd, void *conf_,
3889 const char *arg, const char *arg2)
3890{
3891 core_dir_config *conf = conf_;
3892
3893 ap_unixd_set_rlimit(cmd, &conf->limit_cpu, arg, arg2, RLIMIT_CPU);
3894 return NULL;
3895}
3896#endif
3897
3898#if defined (RLIMIT_DATA) || defined (RLIMIT_VMEM) || defined(RLIMIT_AS)
3899static const char *set_limit_mem(cmd_parms *cmd, void *conf_,
3900 const char *arg, const char * arg2)
3901{
3902 core_dir_config *conf = conf_;
3903
3904#if defined(RLIMIT_AS)
3905 ap_unixd_set_rlimit(cmd, &conf->limit_mem, arg, arg2 ,RLIMIT_AS);
3906#elif defined(RLIMIT_DATA)
3907 ap_unixd_set_rlimit(cmd, &conf->limit_mem, arg, arg2, RLIMIT_DATA);
3908#elif defined(RLIMIT_VMEM)
3909 ap_unixd_set_rlimit(cmd, &conf->limit_mem, arg, arg2, RLIMIT_VMEM);
3910#endif
3911
3912 return NULL;
3913}
3914#endif
3915
3916#ifdef RLIMIT_NPROC
3917static const char *set_limit_nproc(cmd_parms *cmd, void *conf_,
3918 const char *arg, const char * arg2)
3919{
3920 core_dir_config *conf = conf_;
3921
3922 ap_unixd_set_rlimit(cmd, &conf->limit_nproc, arg, arg2, RLIMIT_NPROC);
3923 return NULL;
3924}
3925#endif
3926
3927static const char *set_recursion_limit(cmd_parms *cmd, void *dummy,
3928 const char *arg1, const char *arg2)
3929{
3930 core_server_config *conf =
3931 ap_get_core_module_config(cmd->server->module_config);
3932 int limit = atoi(arg1);
3933
3934 if (limit <= 0) {
3935 return "The recursion limit must be greater than zero.";
3936 }
3937 if (limit < 4) {
3938 ap_log_error(APLOG_MARK, APLOG_WARNING, 0, cmd->server, APLOGNO(00119)
3939 "Limiting internal redirects to very low numbers may "
3940 "cause normal requests to fail.");
3941 }
3942
3943 conf->redirect_limit = limit;
3944
3945 if (arg2) {
3946 limit = atoi(arg2);
3947
3948 if (limit <= 0) {
3949 return "The recursion limit must be greater than zero.";
3950 }
3951 if (limit < 4) {
3952 ap_log_error(APLOG_MARK, APLOG_WARNING, 0, cmd->server, APLOGNO(00120)
3953 "Limiting the subrequest depth to a very low level may"
3954 " cause normal requests to fail.");
3955 }
3956 }
3957
3958 conf->subreq_limit = limit;
3959
3960 return NULL;
3961}
3962
3963static void log_backtrace(const request_rec *r)
3964{
3965 if (APLOGrdebug(r)) {
3966 const request_rec *top = r;
3967
3969 "r->uri = %s", r->uri ? r->uri : "(unexpectedly NULL)");
3970
3971 while (top && (top->prev || top->main)) {
3972 if (top->prev) {
3973 top = top->prev;
3975 "redirected from r->uri = %s",
3976 top->uri ? top->uri : "(unexpectedly NULL)");
3977 }
3978
3979 if (!top->prev && top->main) {
3980 top = top->main;
3982 "subrequested from r->uri = %s",
3983 top->uri ? top->uri : "(unexpectedly NULL)");
3984 }
3985 }
3986 }
3987}
3988
3989/*
3990 * check whether redirect limit is reached
3991 */
3993{
3994 core_server_config *conf =
3996 const request_rec *top = r;
3997 int redirects = 0, subreqs = 0;
3998 int rlimit = conf->redirect_limit
3999 ? conf->redirect_limit
4001 int slimit = conf->subreq_limit
4002 ? conf->subreq_limit
4004
4005
4006 while (top->prev || top->main) {
4007 if (top->prev) {
4008 if (++redirects >= rlimit) {
4009 /* uuh, too much. */
4011 "Request exceeded the limit of %d internal "
4012 "redirects due to probable configuration error. "
4013 "Use 'LimitInternalRecursion' to increase the "
4014 "limit if necessary. Use 'LogLevel debug' to get "
4015 "a backtrace.", rlimit);
4016
4017 /* post backtrace */
4019
4020 /* return failure */
4021 return 1;
4022 }
4023
4024 top = top->prev;
4025 }
4026
4027 if (!top->prev && top->main) {
4028 if (++subreqs >= slimit) {
4029 /* uuh, too much. */
4031 "Request exceeded the limit of %d subrequest "
4032 "nesting levels due to probable configuration "
4033 "error. Use 'LimitInternalRecursion' to increase "
4034 "the limit if necessary. Use 'LogLevel debug' to "
4035 "get a backtrace.", slimit);
4036
4037 /* post backtrace */
4039
4040 /* return failure */
4041 return 1;
4042 }
4043
4044 top = top->main;
4045 }
4046 }
4047
4048 /* recursion state: ok */
4049 return 0;
4050}
4051
4052static const char *set_trace_enable(cmd_parms *cmd, void *dummy,
4053 const char *arg1)
4054{
4055 core_server_config *conf =
4056 ap_get_core_module_config(cmd->server->module_config);
4057
4058 if (ap_cstr_casecmp(arg1, "on") == 0) {
4060 }
4061 else if (ap_cstr_casecmp(arg1, "off") == 0) {
4063 }
4064 else if (ap_cstr_casecmp(arg1, "extended") == 0) {
4066 }
4067 else {
4068 return "TraceEnable must be one of 'on', 'off', or 'extended'";
4069 }
4070
4071 return NULL;
4072}
4073
4074static const char *set_protocols(cmd_parms *cmd, void *dummy,
4075 const char *arg)
4076{
4077 core_server_config *conf =
4078 ap_get_core_module_config(cmd->server->module_config);
4079 const char **np;
4081
4082 if (err) {
4083 return err;
4084 }
4085
4086 np = (const char **)apr_array_push(conf->protocols);
4087 *np = arg;
4088
4089 return NULL;
4090}
4091
4093 const char *arg)
4094{
4095 core_server_config *conf =
4096 ap_get_core_module_config(cmd->server->module_config);
4098
4099 if (err) {
4100 return err;
4101 }
4102
4103 if (ap_cstr_casecmp(arg, "on") == 0) {
4104 conf->protocols_honor_order = 1;
4105 }
4106 else if (ap_cstr_casecmp(arg, "off") == 0) {
4107 conf->protocols_honor_order = 0;
4108 }
4109 else {
4110 return "ProtocolsHonorOrder must be 'on' or 'off'";
4111 }
4112
4113 return NULL;
4114}
4115
4117 const char *arg)
4118{
4119 core_server_config *conf =
4120 ap_get_core_module_config(cmd->server->module_config);
4121
4122 if (strcasecmp(arg, "allow0.9") == 0)
4124 else if (strcasecmp(arg, "require1.0") == 0)
4126 else if (strcasecmp(arg, "strict") == 0)
4128 else if (strcasecmp(arg, "unsafe") == 0)
4130 else if (strcasecmp(arg, "registeredmethods") == 0)
4132 else if (strcasecmp(arg, "lenientmethods") == 0)
4134 else
4135 return "HttpProtocolOptions accepts "
4136 "'Unsafe' or 'Strict' (default), "
4137 "'RegisteredMethods' or 'LenientMethods' (default), and "
4138 "'Require1.0' or 'Allow0.9' (default)";
4139
4140 if ((conf->http09_enable & AP_HTTP09_ENABLE)
4141 && (conf->http09_enable & AP_HTTP09_DISABLE))
4142 return "HttpProtocolOptions 'Allow0.9' and 'Require1.0'"
4143 " are mutually exclusive";
4144
4147 return "HttpProtocolOptions 'Strict' and 'Unsafe'"
4148 " are mutually exclusive";
4149
4152 return "HttpProtocolOptions 'RegisteredMethods' and 'LenientMethods'"
4153 " are mutually exclusive";
4154
4155 return NULL;
4156}
4157
4158static const char *set_http_method(cmd_parms *cmd, void *conf, const char *arg)
4159{
4160 const char *err = ap_check_cmd_context(cmd, GLOBAL_ONLY);
4161 if (err != NULL)
4162 return err;
4163 ap_method_register(cmd->pool, arg);
4164 return NULL;
4165}
4166
4168
4169static int log_constant_item(const ap_errorlog_info *info, const char *arg,
4170 char *buf, int buflen)
4171{
4172 char *end = apr_cpystrn(buf, arg, buflen);
4173 return end - buf;
4174}
4175
4178 const char **sa)
4179{
4180 const char *s;
4181 char scratch[MAX_STRING_LEN];
4182 char *d = scratch;
4183 /*
4184 * non-leading white space terminates this string to allow the next field
4185 * separator to be inserted
4186 */
4187 int at_start = 1;
4188
4189 it->func = log_constant_item;
4190 s = *sa;
4191
4192 while (*s && *s != '%' && (*s != ' ' || at_start) && d < scratch + MAX_STRING_LEN) {
4193 if (*s != '\\') {
4194 if (*s != ' ') {
4195 at_start = 0;
4196 }
4197 *d++ = *s++;
4198 }
4199 else {
4200 s++;
4201 switch (*s) {
4202 case 'r':
4203 *d++ = '\r';
4204 s++;
4205 break;
4206 case 'n':
4207 *d++ = '\n';
4208 s++;
4209 break;
4210 case 't':
4211 *d++ = '\t';
4212 s++;
4213 break;
4214 case '\0':
4215 /* handle end of string */
4216 *d++ = '\\';
4217 break;
4218 default:
4219 /* copy next char verbatim */
4220 *d++ = *s++;
4221 break;
4222 }
4223 }
4224 }
4225 *d = '\0';
4226 it->arg = apr_pstrdup(p, scratch);
4227
4228 *sa = s;
4229 return NULL;
4230}
4231
4233 const char **sa)
4234{
4235 const char *s = *sa;
4236 ap_errorlog_handler *handler;
4237 int i;
4238
4239 if (*s != '%') {
4240 if (*s == ' ') {
4242 }
4244 }
4245
4246 ++s;
4247
4248 if (*s == ' ') {
4249 /* percent-space (% ) is a field separator */
4251 *sa = ++s;
4252 /* recurse */
4253 return parse_errorlog_item(p, it, sa);
4254 }
4255 else if (*s == '%') {
4256 it->arg = "%";
4257 it->func = log_constant_item;
4258 *sa = ++s;
4259 return NULL;
4260 }
4261
4262 while (*s) {
4263 switch (*s) {
4264 case '{':
4265 ++s;
4266 it->arg = ap_getword(p, &s, '}');
4267 break;
4268 case '+':
4269 ++s;
4270 it->flags |= AP_ERRORLOG_FLAG_REQUIRED;
4271 break;
4272 case '-':
4273 ++s;
4275 break;
4276 case '0':
4277 case '1':
4278 case '2':
4279 case '3':
4280 case '4':
4281 case '5':
4282 case '6':
4283 case '7':
4284 case '8':
4285 case '9':
4286 i = *s - '0';
4287 while (apr_isdigit(*++s))
4288 i = i * 10 + (*s) - '0';
4289 it->min_loglevel = i;
4290 break;
4291 case 'M':
4292 it->func = NULL;
4293 it->flags |= AP_ERRORLOG_FLAG_MESSAGE;
4294 *sa = ++s;
4295 return NULL;
4296 default:
4298 if (!handler) {
4299 char dummy[2];
4300
4301 dummy[0] = *s;
4302 dummy[1] = '\0';
4303 return apr_pstrcat(p, "Unrecognized error log format directive %",
4304 dummy, NULL);
4305 }
4306 it->func = handler->func;
4307 *sa = ++s;
4308 return NULL;
4309 }
4310 }
4311
4312 return "Ran off end of error log format parsing args to some directive";
4313}
4314
4316 const char *s,
4317 const char **err,
4318 int is_main_fmt)
4319{
4321 sizeof(ap_errorlog_format_item));
4322 char *res;
4323 int seen_msg_fmt = 0;
4324
4325 while (s && *s) {
4328 memset(item, 0, sizeof(*item));
4330 if (res) {
4331 *err = res;
4332 return NULL;
4333 }
4334 if (item->flags & AP_ERRORLOG_FLAG_MESSAGE) {
4335 if (!is_main_fmt) {
4336 *err = "%M cannot be used in once-per-request or "
4337 "once-per-connection formats";
4338 return NULL;
4339 }
4340 seen_msg_fmt = 1;
4341 }
4342 if (is_main_fmt && item->flags & AP_ERRORLOG_FLAG_REQUIRED) {
4343 *err = "The '+' flag cannot be used in the main error log format";
4344 return NULL;
4345 }
4346 if (!is_main_fmt && item->min_loglevel) {
4347 *err = "The loglevel cannot be used as a condition in "
4348 "once-per-request or once-per-connection formats";
4349 return NULL;
4350 }
4351 if (item->min_loglevel > APLOG_TRACE8) {
4352 *err = "The specified loglevel modifier is out of range";
4353 return NULL;
4354 }
4355 }
4356
4357 if (is_main_fmt && !seen_msg_fmt) {
4358 *err = "main ErrorLogFormat must contain message format string '%M'";
4359 return NULL;
4360 }
4361
4362 return a;
4363}
4364
4365static const char *set_errorlog_format(cmd_parms *cmd, void *dummy,
4366 const char *arg1, const char *arg2)
4367{
4368 const char *err_string = NULL;
4369 core_server_config *conf =
4370 ap_get_core_module_config(cmd->server->module_config);
4371
4372 if (!arg2) {
4374 &err_string, 1);
4375 }
4376 else if (!ap_cstr_casecmp(arg1, "connection")) {
4377 if (!conf->error_log_conn) {
4378 conf->error_log_conn = apr_array_make(cmd->pool, 5,
4379 sizeof(apr_array_header_t *));
4380 }
4381
4382 if (*arg2) {
4385 *e = parse_errorlog_string(cmd->pool, arg2, &err_string, 0);
4386 }
4387 }
4388 else if (!ap_cstr_casecmp(arg1, "request")) {
4389 if (!conf->error_log_req) {
4390 conf->error_log_req = apr_array_make(cmd->pool, 5,
4391 sizeof(apr_array_header_t *));
4392 }
4393
4394 if (*arg2) {
4397 *e = parse_errorlog_string(cmd->pool, arg2, &err_string, 0);
4398 }
4399 }
4400 else {
4401 err_string = "ErrorLogFormat type must be one of request, connection";
4402 }
4403
4404 return err_string;
4405}
4406
4408 ap_errorlog_handler_fn_t *handler,
4409 int flags)
4410{
4412 log_struct->func = handler;
4413 log_struct->flags = flags;
4414
4415 apr_hash_set(errorlog_hash, tag, 1, (const void *)log_struct);
4416}
4417
4418
4419static const char *set_merge_trailers(cmd_parms *cmd, void *dummy, int arg)
4420{
4421 core_server_config *conf = ap_get_module_config(cmd->server->module_config,
4422 &core_module);
4425
4426 return NULL;
4427}
4428
4429#ifdef WIN32
4430static const char *set_unc_list(cmd_parms *cmd, void *d_, int argc, char *const argv[])
4431{
4432 core_server_config *sconf = ap_get_core_module_config(cmd->server->module_config);
4433 int i;
4434 const char *err;
4435
4437 return err;
4438
4439 sconf->unc_list = apr_array_make(cmd->pool, argc, sizeof(char *));
4440
4441 for (i = 0; i < argc; i++) {
4442 *(char **)apr_array_push(sconf->unc_list) = apr_pstrdup(cmd->pool, argv[i]);
4443 }
4444
4445 return NULL;
4446}
4447#endif
4448/* Note --- ErrorDocument will now work from .htaccess files.
4449 * The AllowOverride of Fileinfo allows webmasters to turn it off
4450 */
4451
4452static const command_rec core_cmds[] = {
4453
4454/* Old access config file commands */
4455
4457 "Container for directives affecting resources located in the specified "
4458 "directories"),
4460 "Container for directives affecting resources accessed through the "
4461 "specified URL paths"),
4463 "Container to map directives to a particular virtual host, takes one or "
4464 "more host addresses"),
4466 "Container for directives affecting files matching specified patterns"),
4468 "Container for authentication directives when accessed using specified HTTP "
4469 "methods"),
4470AP_INIT_RAW_ARGS("<LimitExcept", ap_limit_section, (void*)1,
4472 "Container for authentication directives to be applied when any HTTP "
4473 "method other than those specified is used to access the resource"),
4476 "Container for directives based on existence of specified modules"),
4479 "Container for directives based on existence of command line defines"),
4482 "Container for directives based on existence of files on disk"),
4485 "Container for directives based on existence of named directive"),
4488 "Container for directives based on existence of named section"),
4489AP_INIT_RAW_ARGS("<DirectoryMatch", dirsection, (void*)1, RSRC_CONF,
4490 "Container for directives affecting resources located in the "
4491 "specified directories"),
4492AP_INIT_RAW_ARGS("<LocationMatch", urlsection, (void*)1, RSRC_CONF,
4493 "Container for directives affecting resources accessed through the "
4494 "specified URL paths"),
4495AP_INIT_RAW_ARGS("<FilesMatch", filesection, (void*)1, OR_ALL,
4496 "Container for directives affecting files matching specified patterns"),
4497#ifdef GPROF
4499 "Directory to plop gmon.out files"),
4500#endif
4502 "The name of the default charset to add to any Content-Type without one or 'Off' to disable"),
4504 "Set to on or off for PATH_INFO to be accepted by handlers, or default for the per-handler preference"),
4506 "Define a variable, optionally to a value. Same as passing -D to the command line."),
4508 "Undefine the existence of a variable. Undo a Define."),
4510 "Generate error message from within configuration"),
4512 "Container for directives to be conditionally applied"),
4514 "Container for directives to be conditionally applied"),
4516 "Container for directives to be conditionally applied"),
4517
4518/* Old resource config file commands */
4519
4521 "Name(s) of per-directory config files (default: .htaccess)"),
4523 "Root directory of the document tree"),
4525 "Change responses for HTTP errors"),
4527 "Controls what groups of directives can be configured by per-directory "
4528 "config files"),
4530 "Controls what individual directives can be configured by per-directory "
4531 "config files"),
4533 "Set a number of attributes for a given directory"),
4535 "the default media type for otherwise untyped files (DEPRECATED)"),
4537 "Specify components used to construct a file's ETag"),
4539 "Controls whether memory-mapping may be used to read files"),
4541 "Controls whether sendfile may be used to transmit files"),
4543 "Size (in bytes) of the memory buffers used to read data"),
4545 "Maximum threshold above which pending data are flushed to the network"),
4547 "Maximum number of pipelined responses (pending) above which they are "
4548 "flushed to the network"),
4549#ifdef WIN32
4551 "Controls what UNC hosts may be looked up"),
4552#endif
4553
4554/* Old server config file commands */
4555
4557 "Set the Protocol for httpd to use."),
4558AP_INIT_TAKE2("AcceptFilter", set_accf_map, NULL, RSRC_CONF,
4559 "Set the Accept Filter to use for a protocol"),
4561 "Port was replaced with Listen in Apache 2.0"),
4562AP_INIT_TAKE1("HostnameLookups", set_hostname_lookups, NULL,
4564 "\"on\" to enable, \"off\" to disable reverse DNS lookups, or \"double\" to "
4565 "enable double-reverse DNS lookups"),
4567 (void *)APR_OFFSETOF(server_rec, server_admin), RSRC_CONF,
4568 "The email address of the server administrator"),
4570 "The hostname and port of the server"),
4571AP_INIT_TAKE1("ServerSignature", set_signature_flag, NULL, OR_ALL,
4572 "En-/disable server signature (on|off|email)"),
4574 "Common directory of server-related files (logs, confs, etc.)"),
4576 "Common directory for run-time files (shared memory, locks, etc.)"),
4578 (void *)APR_OFFSETOF(server_rec, error_fname), RSRC_CONF,
4579 "The filename of the error log"),
4581 "Format string for the ErrorLog"),
4583 "A name or names alternately used to access the server"),
4585 "The pathname the server can be reached at"),
4587 "Timeout duration (sec)"),
4588AP_INIT_FLAG("ContentDigest", set_content_md5, NULL, OR_OPTIONS,
4589 "whether or not to send a Content-MD5 header with each request"),
4590AP_INIT_TAKE1("UseCanonicalName", set_use_canonical_name, NULL,
4592 "How to work out the ServerName : Port when constructing URLs"),
4593AP_INIT_TAKE1("UseCanonicalPhysicalPort", set_use_canonical_phys_port, NULL,
4595 "Whether to use the physical Port when constructing URLs"),
4596/* TODO: RlimitFoo should all be part of mod_cgi, not in the core */
4597/* TODO: ListenBacklog in MPM */
4600 "Name(s) of the config file(s) to be included; fails if the wildcard does "
4601 "not match at least one file"),
4602AP_INIT_TAKE1("IncludeOptional", include_config, (void*)1,
4604 "Name or pattern of the config file(s) to be included; ignored if the file "
4605 "does not exist or the pattern does not match any files"),
4607 "Level of verbosity in error logging"),
4609 "A numeric IP address:port, or the name of a host"),
4611 "Determine tokens displayed in the Server: header - Min(imal), "
4612 "Major, Minor, Prod(uctOnly), OS, or Full"),
4613AP_INIT_TAKE1("LimitRequestLine", set_limit_req_line, NULL, RSRC_CONF,
4614 "Limit on maximum size of an HTTP request line"),
4615AP_INIT_TAKE1("LimitRequestFieldsize", set_limit_req_fieldsize, NULL,
4616 RSRC_CONF,
4617 "Limit on maximum size of an HTTP request header field"),
4618AP_INIT_TAKE1("LimitRequestFields", set_limit_req_fields, NULL, RSRC_CONF,
4619 "Limit (0 = unlimited) on max number of header fields in a request message"),
4620AP_INIT_TAKE1("LimitRequestBody", set_limit_req_body,
4621 (void*)APR_OFFSETOF(core_dir_config, limit_req_body), OR_ALL,
4622 "Limit (in bytes) on maximum size of request message body"),
4623AP_INIT_TAKE1("LimitXMLRequestBody", set_limit_xml_req_body, NULL, OR_ALL,
4624 "Limit (in bytes) on maximum size of an XML-based request "
4625 "body"),
4627 "mutex (or \"default\") and mechanism"),
4628
4630 "Maximum number of Ranges in a request before returning the entire "
4631 "resource, or 0 for unlimited"),
4633 "Maximum number of overlaps in Ranges in a request before returning the entire "
4634 "resource, or 0 for unlimited"),
4636 "Maximum number of reversals in Ranges in a request before returning the entire "
4637 "resource, or 0 for unlimited"),
4638/* System Resource Controls */
4639#ifdef RLIMIT_CPU
4640AP_INIT_TAKE12("RLimitCPU", set_limit_cpu,
4642 OR_ALL, "Soft/hard limits for max CPU usage in seconds"),
4643#else
4644AP_INIT_TAKE12("RLimitCPU", no_set_limit, NULL,
4645 OR_ALL, "Soft/hard limits for max CPU usage in seconds"),
4646#endif
4647#if defined (RLIMIT_DATA) || defined (RLIMIT_VMEM) || defined (RLIMIT_AS)
4648AP_INIT_TAKE12("RLimitMEM", set_limit_mem,
4650 OR_ALL, "Soft/hard limits for max memory usage per process"),
4651#else
4652AP_INIT_TAKE12("RLimitMEM", no_set_limit, NULL,
4653 OR_ALL, "Soft/hard limits for max memory usage per process"),
4654#endif
4655#ifdef RLIMIT_NPROC
4656AP_INIT_TAKE12("RLimitNPROC", set_limit_nproc,
4658 OR_ALL, "soft/hard limits for max number of processes per uid"),
4659#else
4660AP_INIT_TAKE12("RLimitNPROC", no_set_limit, NULL,
4661 OR_ALL, "soft/hard limits for max number of processes per uid"),
4662#endif
4663
4665 "default options for regexes (prefixed by '+' to add, '-' to del)"),
4666
4667/* internal recursion stopper */
4668AP_INIT_TAKE12("LimitInternalRecursion", set_recursion_limit, NULL, RSRC_CONF,
4669 "maximum recursion depth of internal redirects and subrequests"),
4670
4672 "Controls whether HTTP authorization headers, normally hidden, will "
4673 "be passed to scripts"),
4675 "Controls how some CGI variables are set"),
4677 "Controls whether the REDIRECT_URL environment variable is fully "
4678 "qualified"),
4679AP_INIT_FLAG("StrictHostCheck", set_core_server_flag,
4680 (void *)APR_OFFSETOF(core_server_config, strict_host_check),
4681 RSRC_CONF,
4682 "Controls whether a hostname match is required"),
4684 (void *)APR_OFFSETOF(core_dir_config, mime_type), OR_FILEINFO,
4685 "a mime type that overrides other configured type"),
4687 "a handler name that overrides any other configured handler"),
4688AP_INIT_TAKE1("SetOutputFilter", ap_set_string_slot,
4689 (void *)APR_OFFSETOF(core_dir_config, output_filters), OR_FILEINFO,
4690 "filter (or ; delimited list of filters) to be run on the request content"),
4691AP_INIT_TAKE1("SetInputFilter", ap_set_string_slot,
4692 (void *)APR_OFFSETOF(core_dir_config, input_filters), OR_FILEINFO,
4693 "filter (or ; delimited list of filters) to be run on the request body"),
4694AP_INIT_TAKE1("AllowEncodedSlashes", set_allow2f, NULL, RSRC_CONF,
4695 "Allow URLs containing '/' encoded as '%2F'"),
4696
4697/* scoreboard.c directives */
4698AP_INIT_TAKE1("ScoreBoardFile", ap_set_scoreboard, NULL, RSRC_CONF,
4699 "A file for Apache to maintain runtime process management information"),
4701 "\"On\" to track extended status information, \"Off\" to disable"),
4702AP_INIT_FLAG("SeeRequestTail", ap_set_reqtail, NULL, RSRC_CONF,
4703 "For extended status, \"On\" to see the last 63 chars of "
4704 "the request line, \"Off\" (default) to see the first 63"),
4705
4706/*
4707 * These are default configuration directives that mpms can/should
4708 * pay attention to.
4709 * XXX These are not for all platforms, and even some Unix MPMs might not want
4710 * some directives.
4711 */
4713 "A file for logging the server process ID"),
4714AP_INIT_TAKE1("MaxRequestsPerChild", ap_mpm_set_max_requests, NULL, RSRC_CONF,
4715 "Maximum number of connections a particular child serves before "
4716 "dying. (DEPRECATED, use MaxConnectionsPerChild)"),
4717AP_INIT_TAKE1("MaxConnectionsPerChild", ap_mpm_set_max_requests, NULL, RSRC_CONF,
4718 "Maximum number of connections a particular child serves before dying."),
4719AP_INIT_TAKE1("CoreDumpDirectory", ap_mpm_set_coredumpdir, NULL, RSRC_CONF,
4720 "The location of the directory Apache changes to before dumping core"),
4722 "Maximum number of 1k blocks a particular child's allocator may hold."),
4724 "Size in bytes of stack used by threads handling client connections"),
4725#if AP_ENABLE_EXCEPTION_HOOK
4726AP_INIT_TAKE1("EnableExceptionHook", ap_mpm_set_exception_hook, NULL, RSRC_CONF,
4727 "Controls whether exception hook may be called after a crash"),
4728#endif
4730 "'on' (default), 'off' or 'extended' to trace request body content"),
4732 "merge request trailers into request headers or not"),
4734 "Controls which protocols are allowed"),
4735AP_INIT_TAKE1("ProtocolsHonorOrder", set_protocols_honor_order, NULL, RSRC_CONF,
4736 "'off' (default) or 'on' to respect given order of protocols, "
4737 "by default the client specified order determines selection"),
4739 "'Allow0.9' or 'Require1.0' (default); "
4740 "'RegisteredMethods' or 'LenientMethods' (default); "
4741 "'Unsafe' or 'Strict' (default). Sets HTTP acceptance rules"),
4742AP_INIT_ITERATE("RegisterHttpMethod", set_http_method, NULL, RSRC_CONF,
4743 "Registers non-standard HTTP methods"),
4744AP_INIT_FLAG("MergeSlashes", set_core_server_flag,
4745 (void *)APR_OFFSETOF(core_server_config, merge_slashes),
4746 RSRC_CONF,
4747 "Controls whether consecutive slashes in the URI path are merged"),
4748{ NULL }
4749};
4750
4751/*****************************************************************
4752 *
4753 * Core handlers for various phases of server operation...
4754 */
4755
4757{
4758 apr_status_t rv;
4759 char *path;
4760
4761 /* XXX this seems too specific, this should probably become
4762 * some general-case test
4763 */
4764 if (r->proxyreq) {
4765 return HTTP_FORBIDDEN;
4766 }
4767 if (!r->uri || ((r->uri[0] != '/') && strcmp(r->uri, "*"))) {
4769 "Invalid URI in request '%s' '%s'", r->uri, r->the_request);
4770 return HTTP_BAD_REQUEST;
4771 }
4772
4773 if (r->server->path
4774 && !strncmp(r->uri, r->server->path, r->server->pathlen)
4775 && (r->server->path[r->server->pathlen - 1] == '/'
4776 || r->uri[r->server->pathlen] == '/'
4777 || r->uri[r->server->pathlen] == '\0'))
4778 {
4779 path = r->uri + r->server->pathlen;
4780 }
4781 else {
4782 path = r->uri;
4783 }
4784 /*
4785 * Make sure that we do not mess up the translation by adding two
4786 * /'s in a row. This happens under windows when the document
4787 * root ends with a /
4788 */
4789 /* skip all leading /'s (e.g. http://localhost///foo)
4790 * so we are looking at only the relative path.
4791 */
4792 while (*path == '/') {
4793 ++path;
4794 }
4798 != APR_SUCCESS) {
4800 "Cannot map %s to file", r->the_request);
4801 return HTTP_FORBIDDEN;
4802 }
4804
4805 return OK;
4806}
4807
4808/*****************************************************************
4809 *
4810 * Test the filesystem name through directory_walk and file_walk
4811 */
4813{
4814 int access_status;
4815
4817 return access_status;
4818 }
4819
4820 if ((access_status = ap_file_walk(r))) {
4821 return access_status;
4822 }
4823
4824 return OK;
4825}
4826
4827
4828static int do_nothing(request_rec *r) { return OK; }
4829
4831{
4832 core_dir_config *conf =
4834
4835 /* Check for overrides with ForceType / SetHandler
4836 */
4837 if (conf->mime_type && strcmp(conf->mime_type, "none"))
4838 ap_set_content_type_ex(r, (char*) conf->mime_type, 1);
4839
4840 if (conf->expr_handler) {
4841 const char *err;
4842 const char *val;
4844 if (err) {
4846 "Can't evaluate handler expression: %s", err);
4848 }
4849
4850 if (val != ap_strstr_c(val, "proxy:unix")) {
4851 /* Retained for compatibility -- but not for UDS */
4852 char *tmp = apr_pstrdup(r->pool, val);
4853 ap_str_tolower(tmp);
4854 val = tmp;
4855 }
4856
4857 if (strcmp(val, "none")) {
4858 r->handler = val;
4859 }
4860 }
4861 else if (conf->handler && strcmp(conf->handler, "none")) {
4862 r->handler = conf->handler;
4863 }
4864
4865 /* Deal with the poor soul who is trying to force path_info to be
4866 * accepted within the core_handler, where they will let the subreq
4867 * address its contents. This is toggled by the user in the very
4868 * beginning of the fixup phase (here!), so modules should override the user's
4869 * discretion in their own module fixup phase. It is tristate, if
4870 * the user doesn't specify, the result is AP_REQ_DEFAULT_PATH_INFO.
4871 * (which the module may interpret to its own customary behavior.)
4872 * It won't be touched if the value is no longer AP_ACCEPT_PATHINFO_UNSET,
4873 * so any module changing the value prior to the fixup phase
4874 * OVERRIDES the user's choice.
4875 */
4878 /* No module knew better, and the user coded AcceptPathInfo */
4880 }
4881
4882 return OK;
4883}
4884
4886{
4887 conn_rec *c = r->connection;
4889 apr_bucket *e;
4891 int errstatus;
4892 apr_file_t *fd = NULL;
4894 /* XXX if/when somebody writes a content-md5 filter we either need to
4895 * remove this support or coordinate when to use the filter vs.
4896 * when to use this code
4897 * The current choice of when to compute the md5 here matches the 1.3
4898 * support fairly closely (unlike 1.3, we don't handle computing md5
4899 * when the charset is translated).
4900 */
4901 int bld_content_md5;
4902
4904 bld_content_md5 = (d->content_md5 == AP_CONTENT_MD5_ON)
4906
4908
4909 /* If filters intend to consume the request body, they must
4910 * register an InputFilter to slurp the contents of the POST
4911 * data from the POST input stream. It no longer exists when
4912 * the output filters are invoked by the default handler.
4913 */
4914 if ((errstatus = ap_discard_request_body(r)) != OK) {
4915 return errstatus;
4916 }
4917
4918 if (r->method_number == M_GET || r->method_number == M_POST) {
4919 if (r->finfo.filetype == APR_NOFILE) {
4921 "File does not exist: %s",
4923 return HTTP_NOT_FOUND;
4924 }
4925
4926 /* Don't try to serve a dir. Some OSs do weird things with
4927 * raw I/O on a dir.
4928 */
4929 if (r->finfo.filetype == APR_DIR) {
4931 "Attempt to serve directory: %s", r->filename);
4932 return HTTP_NOT_FOUND;
4933 }
4934
4936 r->path_info && *r->path_info)
4937 {
4938 /* default to reject */
4940 "File does not exist: %s",
4942 return HTTP_NOT_FOUND;
4943 }
4944
4945 /* We understood the (non-GET) method, but it might not be legal for
4946 this particular resource. Check to see if the 'deliver_script'
4947 flag is set. If so, then we go ahead and deliver the file since
4948 it isn't really content (only GET normally returns content).
4949
4950 Note: based on logic further above, the only possible non-GET
4951 method at this point is POST. In the future, we should enable
4952 script delivery for all methods. */
4953 if (r->method_number != M_GET) {
4955
4957 if (!req_cfg->deliver_script) {
4958 /* The flag hasn't been set for this request. Punt. */
4960 "This resource does not accept the %s method.",
4961 r->method);
4963 }
4964 }
4965
4966
4969 | AP_SENDFILE_ENABLED(d->enable_sendfile)
4970#endif
4971 , 0, r->pool)) != APR_SUCCESS) {
4973 "file permissions deny server access: %s", r->filename);
4974 return HTTP_FORBIDDEN;
4975 }
4976
4982 if (bld_content_md5) {
4983 apr_table_setn(r->headers_out, "Content-MD5",
4984 ap_md5digest(r->pool, fd));
4985 }
4986
4987 bb = apr_brigade_create(r->pool, c->bucket_alloc);
4988
4989 if ((errstatus = ap_meets_conditions(r)) != OK) {
4991 r->status = errstatus;
4992 }
4993 else {
4994 e = apr_brigade_insert_file(bb, fd, 0, r->finfo.size, r->pool);
4995
4996#if APR_HAS_MMAP
4997 if (d->enable_mmap == ENABLE_MMAP_OFF) {
4999 }
5000#endif
5001#if APR_MAJOR_VERSION > 1 || (APU_MAJOR_VERSION == 1 && APU_MINOR_VERSION >= 6)
5002 if (d->read_buf_size) {
5003 apr_bucket_file_set_buf_size(e, d->read_buf_size);
5004 }
5005#endif
5006 }
5007
5008 e = apr_bucket_eos_create(c->bucket_alloc);
5010
5013
5014 if (status == APR_SUCCESS
5015 || r->status != HTTP_OK
5016 || c->aborted) {
5017 return OK;
5018 }
5019 else {
5020 /* no way to know what type of error occurred */
5022 "default_handler: ap_pass_brigade returned %i",
5023 status);
5024 return AP_FILTER_ERROR;
5025 }
5026 }
5027 else { /* unusual method (not GET or POST) */
5028 if (r->method_number == M_INVALID) {
5029 /* See if this looks like an undecrypted SSL handshake attempt.
5030 * It's safe to look a couple bytes into the_request if it exists, as it's
5031 * always allocated at least MIN_LINE_ALLOC (80) bytes.
5032 */
5033 if (r->the_request
5034 && r->the_request[0] == 0x16
5035 && (r->the_request[1] == 0x2 || r->the_request[1] == 0x3)) {
5037 "Invalid method in request %s - possible attempt to establish SSL connection on non-SSL port", r->the_request);
5038 } else {
5040 "Invalid method in request %s", r->the_request);
5041 }
5042 return HTTP_NOT_IMPLEMENTED;
5043 }
5044
5045 if (r->method_number == M_OPTIONS) {
5046 return ap_send_http_options(r);
5047 }
5049 }
5050}
5051
5052/* Optional function coming from mod_logio, used for logging of output
5053 * traffic
5054 */
5057
5058/* Insist that at least one module will undertake to provide system
5059 * security by dropping startup privileges.
5060 */
5061static int sys_privileges = 0;
5063{
5065 return sys_privileges;
5066}
5067
5069{
5070 if (!s->error_fname || s->error_fname[0] == '|'
5071 || strcmp(s->error_fname, "syslog") == 0
5072 || strncmp(s->error_fname, "syslog:", 7) == 0) {
5073 return APR_SUCCESS;
5074 }
5075 else {
5076 char *abs = ap_server_root_relative(p, s->error_fname);
5077 char *dir = ap_make_dirstr_parent(p, abs);
5078 apr_finfo_t finfo;
5079 apr_status_t rv = apr_stat(&finfo, dir, APR_FINFO_TYPE, p);
5080 if (rv == APR_SUCCESS && finfo.filetype != APR_DIR)
5081 rv = APR_ENOTDIR;
5082 if (rv != APR_SUCCESS) {
5083 const char *desc = "main error log";
5084 if (s->defn_name)
5085 desc = apr_psprintf(p, "error log of vhost defined at %s:%d",
5086 s->defn_name, s->defn_line_number);
5088 ap_server_conf, APLOGNO(02291)
5089 "Cannot access directory '%s' for %s", dir, desc);
5090 return !OK;
5091 }
5092 }
5093 return OK;
5094}
5095
5097{
5098 int rv = OK;
5099 while (s) {
5100 if (check_errorlog_dir(ptemp, s) != OK)
5101 rv = !OK;
5102 s = s->next;
5103 }
5104 return rv;
5105}
5106
5107
5123
5148
5150{
5153 const char *filter, *filters = conf->output_filters;
5154
5155 if (filters) {
5156 while (*filters && (filter = ap_getword(r->pool, &filters, ';'))) {
5158 }
5159 }
5160
5161 filters = conf->input_filters;
5162 if (filters) {
5163 while (*filters && (filter = ap_getword(r->pool, &filters, ';'))) {
5165 }
5166 }
5167}
5168
5170
5176
5183
5185{
5187
5188 if (note_num >= num_request_notes) {
5189 return NULL;
5190 }
5191
5194
5195 if (!req_cfg) {
5196 return NULL;
5197 }
5198
5199 return &(req_cfg->notes[note_num]);
5200}
5201
5206
5208{
5209 /* Alloc the config struct and the array of request notes in
5210 * a single block for efficiency
5211 */
5213
5215 sizeof(void *) * num_request_notes);
5216 req_cfg->notes = (void **)((char *)req_cfg + sizeof(core_request_config));
5217
5218 /* ### temporarily enable script delivery as the default */
5219 req_cfg->deliver_script = 1;
5220
5221 if (r->main) {
5224 req_cfg->bb = main_req_cfg->bb;
5225 }
5226 else {
5228 }
5229
5231
5232 return OK;
5233}
5234
5236{
5237 return core_create_req(pr);
5238}
5239
5241 apr_socket_t *csd, long id, void *sbh,
5242 apr_bucket_alloc_t *alloc)
5243{
5244 apr_status_t rv;
5245 conn_rec *c = (conn_rec *) apr_pcalloc(ptrans, sizeof(conn_rec));
5246
5247 c->sbh = sbh;
5249
5250 /* Got a connection structure, so initialize what fields we can
5251 * (the rest are zeroed out by pcalloc).
5252 */
5253 c->pool = ptrans;
5254 c->conn_config = ap_create_conn_config(ptrans);
5255 c->notes = apr_table_make(ptrans, 5);
5256
5257 if ((rv = apr_socket_addr_get(&c->local_addr, APR_LOCAL, csd))
5258 != APR_SUCCESS) {
5260 "apr_socket_addr_get(APR_LOCAL)");
5262 return NULL;
5263 }
5264 if (apr_sockaddr_ip_get(&c->local_ip, c->local_addr)) {
5265#if APR_HAVE_SOCKADDR_UN
5266 if (c->local_addr->family == APR_UNIX) {
5267 c->local_ip = apr_pstrndup(c->pool, c->local_addr->ipaddr_ptr,
5268 c->local_addr->ipaddr_len);
5269 }
5270 else
5271#endif
5272 c->local_ip = apr_pstrdup(c->pool, "unknown");
5273 }
5274
5275 if ((rv = apr_socket_addr_get(&c->client_addr, APR_REMOTE, csd))
5276 != APR_SUCCESS) {
5278 "apr_socket_addr_get(APR_REMOTE)");
5280 return NULL;
5281 }
5282 if (apr_sockaddr_ip_get(&c->client_ip, c->client_addr)) {
5283#if APR_HAVE_SOCKADDR_UN
5284 if (c->client_addr->family == APR_UNIX) {
5285 c->client_ip = apr_pstrndup(c->pool, c->client_addr->ipaddr_ptr,
5286 c->client_addr->ipaddr_len);
5287 }
5288 else
5289#endif
5290 c->client_ip = apr_pstrdup(c->pool, "unknown");
5291 }
5292
5293 c->base_server = server;
5294
5295 c->id = id;
5296 c->bucket_alloc = alloc;
5297
5298 c->clogging_input_filters = 0;
5299
5300 return c;
5301}
5302
5304{
5306 apr_status_t rv;
5307
5308 if (c->master) {
5309 return DONE;
5310 }
5311
5312 net = apr_palloc(c->pool, sizeof(*net));
5313 /* The Nagle algorithm says that we should delay sending partial
5314 * packets in hopes of getting more data. We don't want to do
5315 * this; we are not telnet. There are bad interactions between
5316 * persistent connections and Nagle's algorithm that have very severe
5317 * performance penalties. (Failing to disable Nagle is not much of a
5318 * problem with simple HTTP.)
5319 */
5321 if (rv != APR_SUCCESS && rv != APR_ENOTIMPL) {
5322 /* expected cause is that the client disconnected already,
5323 * hence the debug level
5324 */
5326 "apr_socket_opt_set(APR_TCP_NODELAY)");
5327 }
5328
5329 /* The core filter requires the timeout mode to be set, which
5330 * incidentally sets the socket to be nonblocking. If this
5331 * is not initialized correctly, Linux - for example - will
5332 * be initially blocking, while Solaris will be non blocking
5333 * and any initial read will fail.
5334 */
5335 rv = apr_socket_timeout_set(csd, c->base_server->timeout);
5336 if (rv != APR_SUCCESS) {
5337 /* expected cause is that the client disconnected already */
5339 "apr_socket_timeout_set");
5340 }
5341
5342 net->c = c;
5343 net->in_ctx = NULL;
5344 net->out_ctx = NULL;
5345 net->client_socket = csd;
5346
5347 ap_set_core_module_config(net->c->conn_config, csd);
5350 return DONE;
5351}
5352
5354{
5355 int rc = OK;
5356
5358 if (rc != OK && rc != DONE) {
5359 c->aborted = 1;
5360 /*
5361 * In case we errored, the pre_connection hook of the core
5362 * module maybe did not run (it is APR_HOOK_REALLY_LAST) and
5363 * hence we missed to
5364 *
5365 * - Put the socket in c->conn_config
5366 * - Setup core output and input filters
5367 * - Set socket options and timeouts
5368 *
5369 * Hence call it in this case.
5370 */
5371 if (!ap_get_conn_socket(c)) {
5373 }
5374 }
5375 return rc;
5376}
5377
5379{
5380 switch (query) {
5381 case AP_SQ_MAIN_STATE:
5382 return ap_main_state;
5383 case AP_SQ_RUN_MODE:
5384 return ap_run_mode;
5385 case AP_SQ_CONFIG_GEN:
5386 return ap_config_generation;
5387 default:
5388 return AP_SQ_NOT_SUPPORTED;
5389 }
5390}
5391
5393#if APR_HAS_THREADS
5395#endif
5396
5398{
5400#if APR_HAS_THREADS
5401 int threaded_mpm;
5403 && threaded_mpm)
5404 {
5406 }
5407#endif
5408 /* The MPMs use plain fork() and not apr_proc_fork(), so we have to call
5409 * apr_random_after_fork() manually in the child
5410 */
5411 proc.pid = getpid();
5413}
5414
5416{
5418}
5419
5421{
5422 /*
5423 * To ensure that the RNG state in the parent changes after the fork, we
5424 * pull some data from the RNG and discard it. This ensures that the RNG
5425 * states in the children are different even after the pid wraps around.
5426 * As we only use apr_random for insecure random bytes, pulling 2 bytes
5427 * should be enough.
5428 * XXX: APR should probably have some dedicated API to do this, but it
5429 * XXX: currently doesn't.
5430 */
5433}
5434
5436{
5437 unsigned char seed[8];
5438 apr_status_t rv;
5440 do {
5441 rv = apr_generate_random_bytes(seed, sizeof(seed));
5442 if (rv != APR_SUCCESS)
5443 goto error;
5444 apr_random_add_entropy(rng, seed, sizeof(seed));
5446 } while (rv == APR_ENOTENOUGHENTROPY);
5447 if (rv == APR_SUCCESS)
5448 return;
5449error:
5451 "Could not initialize random number generator");
5452 exit(1);
5453}
5454
5456{
5457#if APR_HAS_THREADS
5458 if (rng_mutex)
5460#endif
5461 /* apr_random_insecure_bytes can only fail with APR_ENOTENOUGHENTROPY,
5462 * and we have ruled that out during initialization. Therefore we don't
5463 * need to check the return code.
5464 */
5466#if APR_HAS_THREADS
5467 if (rng_mutex)
5469#endif
5470}
5471
5472/*
5473 * Finding a random number in a range.
5474 * n' = a + n(b-a+1)/(M+1)
5475 * where:
5476 * n' = random number in range
5477 * a = low end of range
5478 * b = high end of range
5479 * n = random number of 0..M
5480 * M = maxint
5481 * Algorithm 'borrowed' from PHP's rand() function.
5482 */
5483#define RAND_RANGE(__n, __min, __max, __tmax) \
5484(__n) = (__min) + (long) ((double) ((__max) - (__min) + 1.0) * ((__n) / ((__tmax) + 1.0)))
5486{
5487 apr_uint32_t number;
5488#if (!__GNUC__ || __GNUC__ >= 5 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 8) || \
5489 !__sparc__ || APR_SIZEOF_VOIDP != 8)
5490 /* This triggers a gcc bug on sparc/64bit with gcc < 4.8, PR 52900 */
5491 if (max < 16384) {
5495 number = num16;
5496 }
5497 else
5498#endif
5499 {
5500 ap_random_insecure_bytes(&number, sizeof(number));
5501 RAND_RANGE(number, min, max, APR_UINT32_MAX);
5502 }
5503 return number;
5504}
5505
5514
5517{
5518 return apr_stat(finfo, r->filename, wanted, r->pool);
5519}
5520
5522{
5524 apr_file_t *out = NULL;
5525 const char *tmp;
5526 const char **defines;
5527 int i;
5528 if (!ap_exists_config_define("DUMP_RUN_CFG"))
5529 return;
5530
5532 apr_file_printf(out, "ServerRoot: \"%s\"\n", ap_server_root);
5533 tmp = ap_server_root_relative(p, sconf->ap_document_root);
5534 apr_file_printf(out, "Main DocumentRoot: \"%s\"\n", tmp);
5535 if (s->error_fname[0] != '|'
5536 && strcmp(s->error_fname, "syslog") != 0
5537 && strncmp(s->error_fname, "syslog:", 7) != 0)
5538 tmp = ap_server_root_relative(p, s->error_fname);
5539 else
5540 tmp = s->error_fname;
5541 apr_file_printf(out, "Main ErrorLog: \"%s\"\n", tmp);
5542 if (ap_scoreboard_fname) {
5544 apr_file_printf(out, "ScoreBoardFile: \"%s\"\n", tmp);
5545 }
5548
5549 defines = (const char **)ap_server_config_defines->elts;
5550 for (i = 0; i < ap_server_config_defines->nelts; i++) {
5551 const char *name = defines[i];
5552 const char *val = NULL;
5555 if (val)
5556 apr_file_printf(out, "Define: %s=%s\n", name, val);
5557 else
5558 apr_file_printf(out, "Define: %s\n", name);
5559 }
5560}
5561
5563{
5564 conn_rec *c = r->connection;
5565 const char *upgrade;
5566
5567 if (c->master) {
5568 /* Not possible to perform an HTTP/1.1 upgrade from a slave
5569 * connection. */
5570 return DECLINED;
5571 }
5572
5573 upgrade = apr_table_get(r->headers_in, "Upgrade");
5574 if (upgrade && *upgrade) {
5575 const char *conn = apr_table_get(r->headers_in, "Connection");
5576 if (ap_find_token(r->pool, conn, "upgrade")) {
5578 const char *err;
5579
5580 err = ap_parse_token_list_strict(r->pool, upgrade, &offers, 0);
5581 if (err) {
5583 "parsing Upgrade header: %s", err);
5584 return DECLINED;
5585 }
5586
5587 if (offers && offers->nelts > 0) {
5588 const char *protocol = ap_select_protocol(c, r, NULL, offers);
5591 "Upgrade selects '%s'", protocol);
5592 /* Let the client know what we are upgrading to. */
5594 apr_table_setn(r->headers_out, "Upgrade", protocol);
5595 apr_table_setn(r->headers_out, "Connection", "Upgrade");
5596
5600
5602
5603 /* make sure httpd closes the connection after this */
5604 c->keepalive = AP_CONN_CLOSE;
5605 return DONE;
5606 }
5607 }
5608 }
5609 }
5610 else if (!c->keepalives) {
5611 /* first request on a master connection, if we have protocols other
5612 * than the current one enabled here, announce them to the
5613 * client. If the client is already talking a protocol with requests
5614 * on slave connections, leave it be. */
5617 if (upgrades && upgrades->nelts > 0) {
5618 char *protocols = apr_array_pstrcat(r->pool, upgrades, ',');
5619 apr_table_setn(r->headers_out, "Upgrade", protocols);
5620 apr_table_setn(r->headers_out, "Connection", "Upgrade");
5621 }
5622 }
5623
5624 return DECLINED;
5625}
5626
5628{
5629 if ((r->method_number == M_OPTIONS) && r->uri && (r->uri[0] == '*') &&
5630 (r->uri[1] == '\0')) {
5631 return core_upgrade_handler(r);
5632 }
5633 return DECLINED;
5634}
5635
5637 struct apr_pollfd_t *pfd,
5639{
5640 if (c && !c->master) {
5642 pfd->desc.s = ap_get_conn_socket(c);
5643 if (ptimeout) {
5645 }
5646 return APR_SUCCESS;
5647 }
5648 return APR_ENOTIMPL;
5649}
5650
5657
5658#ifdef WIN32
5659static apr_status_t check_unc(const char *path, apr_pool_t *p)
5660{
5661 int i;
5662 char *s, *teststring;
5665
5666 if (!ap_server_conf) {
5667 return APR_SUCCESS; /* this early, if we have a UNC, it's specified by an admin */
5668 }
5669
5670 if (!path || (path != ap_strstr_c(path, "\\\\") &&
5671 path != ap_strstr_c(path, "//"))) {
5672 return APR_SUCCESS; /* not a UNC */
5673 }
5674
5677 *s++ = '/';
5678 *s++ = '/';
5679
5681 "ap_filepath_merge: check converted path %s allowed %d",
5682 teststring,
5683 sconf->unc_list ? sconf->unc_list->nelts : 0);
5684
5685 for (i = 0; sconf->unc_list && i < sconf->unc_list->nelts; i++) {
5686 char *configured_unc = ((char **)sconf->unc_list->elts)[i];
5687 apr_uri_t uri;
5689 (uri.hostinfo == NULL ||
5690 !ap_cstr_casecmp(uri.hostinfo, configured_unc))) {
5691 rv = APR_SUCCESS;
5693 "ap_filepath_merge: match %s %s",
5694 uri.hostinfo, configured_unc);
5695 break;
5696 }
5697 else {
5699 "ap_filepath_merge: no match %s %s", uri.hostinfo,
5701 }
5702 }
5703 if (rv != APR_SUCCESS) {
5705 "ap_filepath_merge: UNC path %s not allowed by UNCList", teststring);
5706 }
5707
5708 return rv;
5709}
5710#endif
5711
5713 const char *rootpath,
5714 const char *addpath,
5716 apr_pool_t *p)
5717{
5718#ifdef WIN32
5719 apr_status_t rv;
5720
5721 if (APR_SUCCESS != (rv = check_unc(rootpath, p))) {
5722 return rv;
5723 }
5724 if (APR_SUCCESS != (rv = check_unc(addpath, p))) {
5725 return rv;
5726 }
5727#undef apr_filepath_merge
5728#endif
5730#ifdef WIN32
5731#define apr_filepath_merge ap_filepath_merge
5732#endif
5733}
5734
5735
5737{
5741 ap_expr_init(p);
5742
5743 /* create_connection and pre_connection should always be hooked
5744 * APR_HOOK_REALLY_LAST by core to give other modules the opportunity
5745 * to install alternate network transports and stop other functions
5746 * from being run.
5747 */
5752
5765 /* FIXME: I suspect we can eliminate the need for these do_nothings - Ben */
5781
5782 /* register the core's insert_filter hook and register core-provided
5783 * filters
5784 */
5786
5801 NULL, AP_FTYPE_RESOURCE - 10);
5802}
5803
5806 AP_PLATFORM_REWRITE_ARGS_HOOK, /* hook to run before apache parses args */
5807 create_core_dir_config, /* create per-directory config structure */
5808 merge_core_dir_configs, /* merge per-directory config structures */
5809 create_core_server_config, /* create per-server config structure */
5810 merge_core_server_configs, /* merge per-server config structures */
5811 core_cmds, /* command apr_table_t */
5812 register_hooks /* register hooks */
5813};
Symbol export macros and hook functions.
#define AP_DECLARE_DATA
Definition ap_config.h:89
#define AP_DECLARE_NONSTD(type)
Definition ap_config.h:77
#define AP_DECLARE(type)
Definition ap_config.h:67
#define AP_IMPLEMENT_HOOK_RUN_ALL(ret, name, args_decl, args_use, ok, decline)
Definition ap_hooks.h:117
#define AP_IMPLEMENT_HOOK_RUN_FIRST(ret, name, args_decl, args_use, decline)
Definition ap_hooks.h:137
Apache Listeners Library.
Apache Regex defines.
const char int cflags
Definition ap_regex.h:159
#define AP_REG_DEFAULT
Definition ap_regex.h:91
const char apr_size_t len
Definition ap_regex.h:187
#define AP_REG_MATCH
Definition ap_regex.h:89
const char * string
Definition ap_regex.h:171
#define AP_REG_EXTENDED
Definition ap_regex.h:78
#define AP_SERVER_BASEPRODUCT
Definition ap_release.h:42
#define AP_SERVER_PATCHLEVEL_NUMBER
Definition ap_release.h:46
#define AP_SERVER_MINORVERSION_NUMBER
Definition ap_release.h:45
#define AP_SERVER_MAJORVERSION
Definition ap_release.h:68
#define AP_SERVER_MAJORVERSION_NUMBER
Definition ap_release.h:44
#define AP_SERVER_ADD_STRING
Definition ap_release.h:52
#define AP_SERVER_MINORREVISION
Definition ap_release.h:73
#define APR_STRINGIFY(n)
Definition ap_release.h:62
#define AP_SERVER_BASEVERSION
Definition ap_release.h:75
#define socket
APR-UTIL Buckets/Bucket Brigades.
APR FNMatch Functions.
APR Hash Tables.
APR general purpose library routines.
#define min(a, b)
Definition apr_random.c:32
APR PRNG routines.
apr_size_t const unsigned char unsigned int unsigned int d
Definition apr_siphash.h:72
APR Strings library.
apr_array_append(apr_pool_t *p, const apr_array_header_t *first, const apr_array_header_t *second)
Definition apr_tables.c:213
APR Thread and Process Library.
APR Versioning Interface.
APR Standard Headers Support.
APR-util Versioning Interface.
const command_rec * ap_find_command_in_modules(const char *cmd_name, module **mod)
Definition config.c:1066
const char * ap_init_virtual_host(apr_pool_t *p, const char *hostname, server_rec *main_server, server_rec **ps)
Definition config.c:2083
void * ap_set_config_vectors(server_rec *server, ap_conf_vector_t *section_vector, const char *section, module *mod, apr_pool_t *pconf)
Definition config.c:1082
ap_conf_vector_t * ap_create_conn_config(apr_pool_t *p)
Definition config.c:361
ap_conf_vector_t * ap_create_per_dir_config(apr_pool_t *p)
Definition config.c:366
int ap_run_pre_connection(conn_rec *c, void *csd)
Definition connection.c:43
void ap_hook_create_connection(ap_HOOK_create_connection_t *pf, const char *const *aszPre, const char *const *aszSucc, int nOrder)
Definition connection.c:41
void ap_hook_pre_connection(ap_HOOK_pre_connection_t *pf, const char *const *aszPre, const char *const *aszSucc, int nOrder)
Definition connection.c:43
static apr_hash_t * errorlog_hash
Definition core.c:4167
static const char * dirsection(cmd_parms *cmd, void *mconfig, const char *arg)
Definition core.c:2450
static void core_child_init(apr_pool_t *pchild, server_rec *s)
Definition core.c:5397
#define AP_LIMIT_REQ_BODY_UNSET
Definition core.c:69
static const char * set_http_method(cmd_parms *cmd, void *conf, const char *arg)
Definition core.c:4158
static apr_array_header_t * saved_server_config_defines
Definition core.c:145
static const char * set_access_name(cmd_parms *cmd, void *dummy, const char *arg)
Definition core.c:1361
static const char * set_recursion_limit(cmd_parms *cmd, void *dummy, const char *arg1, const char *arg2)
Definition core.c:3927
static const char * start_cond_section(cmd_parms *cmd, void *mconfig, const char *arg)
Definition core.c:2849
static const char * set_etag_bits(cmd_parms *cmd, void *mconfig, const char *args_p)
Definition core.c:2122
static char * unclosed_directive(cmd_parms *cmd)
Definition core.c:2351
static enum server_token_type ap_server_tokens
Definition core.c:3568
static char errordocument_default
Definition core.c:140
static const char * set_limit_xml_req_body(cmd_parms *cmd, void *conf_, const char *arg)
Definition core.c:3768
static void init_config_defines(apr_pool_t *pconf)
Definition core.c:1484
static int core_map_to_storage(request_rec *r)
Definition core.c:4812
static const char * set_protocols(cmd_parms *cmd, void *dummy, const char *arg)
Definition core.c:4074
static const char * set_max_reversals(cmd_parms *cmd, void *conf_, const char *arg)
Definition core.c:3837
#define AP_MAX_LIMIT_XML_BODY
Definition core.c:76
static const char * set_runtime_dir(cmd_parms *cmd, void *dummy, const char *arg)
Definition core.c:3226
static const char * set_serverpath(cmd_parms *cmd, void *dummy, const char *arg)
Definition core.c:3298
static void core_insert_filter(request_rec *r)
Definition core.c:5149
static void set_banner(apr_pool_t *pconf)
Definition core.c:3628
static const char * set_content_md5(cmd_parms *cmd, void *d_, int arg)
Definition core.c:3312
static const char * set_enable_sendfile(cmd_parms *cmd, void *d_, const char *arg)
Definition core.c:2271
static int core_upgrade_handler(request_rec *r)
Definition core.c:5562
static apr_status_t reset_request_notes(void *dummy)
Definition core.c:5171
static const char * set_protocol(cmd_parms *cmd, void *dummy, const char *arg)
Definition core.c:3096
static char * server_banner
Definition core.c:3556
static void * merge_core_dir_configs(apr_pool_t *a, void *basev, void *newv)
Definition core.c:221
static apr_array_header_t * parse_errorlog_string(apr_pool_t *p, const char *s, const char **err, int is_main_fmt)
Definition core.c:4315
static const char * set_override(cmd_parms *cmd, void *d_, const char *l)
Definition core.c:1810
static const char * set_use_canonical_phys_port(cmd_parms *cmd, void *d_, const char *arg)
Definition core.c:3361
static char * parse_errorlog_misc_string(apr_pool_t *p, ap_errorlog_format_item *it, const char **sa)
Definition core.c:4176
static int sys_privileges
Definition core.c:5061
static const char * set_cgi_var(cmd_parms *cmd, void *d_, const char *var, const char *rule_)
Definition core.c:1894
static const char * set_allow_opts(cmd_parms *cmd, allow_options_t *opts, const char *l)
Definition core.c:1749
static const char * set_flush_max_threshold(cmd_parms *cmd, void *d_, const char *arg)
Definition core.c:2308
static char * parse_errorlog_item(apr_pool_t *p, ap_errorlog_format_item *it, const char **sa)
Definition core.c:4232
static const char * set_max_ranges(cmd_parms *cmd, void *conf_, const char *arg)
Definition core.c:3785
static const char * urlsection(cmd_parms *cmd, void *mconfig, const char *arg)
Definition core.c:2552
static apr_random_t * rng
Definition core.c:5392
static int core_create_req(request_rec *r)
Definition core.c:5207
static const char * set_flush_max_pipelined(cmd_parms *cmd, void *d_, const char *arg)
Definition core.c:2328
static const char * set_accf_map(cmd_parms *cmd, void *dummy, const char *iproto, const char *iaccf)
Definition core.c:3063
static const char * set_serv_tokens(cmd_parms *cmd, void *dummy, const char *arg)
Definition core.c:3656
static const char * server_description
Definition core.c:3558
static int core_check_config(apr_pool_t *pconf, apr_pool_t *plog, apr_pool_t *ptemp, server_rec *s)
Definition core.c:5096
static int test_ifmod_section(cmd_parms *cmd, const char *arg)
Definition core.c:2891
static const char * set_errorlog_format(cmd_parms *cmd, void *dummy, const char *arg1, const char *arg2)
Definition core.c:4365
return found
Definition core.c:2840
static const char * set_limit_req_fieldsize(cmd_parms *cmd, void *dummy, const char *arg)
Definition core.c:3710
#define AP_DEFAULT_LIMIT_XML_BODY
Definition core.c:74
#define SMALL_EXPANSION
static void * create_core_dir_config(apr_pool_t *a, char *dir)
Definition core.c:153
static void core_optional_fn_retrieve(void)
Definition core.c:5415
static const char * set_regex_default_options(cmd_parms *cmd, void *dummy, const char *arg)
Definition core.c:2988
static void log_backtrace(const request_rec *r)
Definition core.c:3963
static const char * set_core_server_flag(cmd_parms *cmd, void *s_, int flag)
Definition core.c:1928
static int banner_locked
Definition core.c:3557
static const char * set_limit_req_fields(cmd_parms *cmd, void *dummy, const char *arg)
Definition core.c:3731
#define COND_IF
Definition core.c:2711
static const char * set_options(cmd_parms *cmd, void *d_, const char *l)
Definition core.c:1990
static conn_rec * core_create_conn(apr_pool_t *ptrans, server_rec *server, apr_socket_t *csd, long id, void *sbh, apr_bucket_alloc_t *alloc)
Definition core.c:5240
static const char * set_signature_flag(cmd_parms *cmd, void *d_, const char *arg)
Definition core.c:3187
static apr_OFN_access_compat_ap_satisfies_t * access_compat_ap_satisfies
Definition core.c:819
static APR_INLINE int do_double_reverse(int double_reverse, const char *remote_host, apr_sockaddr_t *client_addr, apr_pool_t *pool)
Definition core.c:925
#define AP_FLUSH_MAX_THRESHOLD
Definition core.c:92
#define AP_CONTENT_MD5_OFF
Definition core.c:88
static int test_iffile_section(cmd_parms *cmd, const char *arg)
Definition core.c:2906
static const char * no_set_limit(cmd_parms *cmd, void *conf_, const char *arg, const char *arg2)
Definition core.c:3877
#define AP_CONTENT_MD5_ON
Definition core.c:89
static int default_handler(request_rec *r)
Definition core.c:4885
static const char * set_accept_path_info(cmd_parms *cmd, void *d_, const char *arg)
Definition core.c:3320
static const char * set_limit_req_line(cmd_parms *cmd, void *dummy, const char *arg)
Definition core.c:3690
static const char * set_server_root(cmd_parms *cmd, void *dummy, const char *arg)
Definition core.c:3208
static void register_hooks(apr_pool_t *p)
Definition core.c:5736
static const char * set_override_list(cmd_parms *cmd, void *d_, int argc, char *const argv[])
Definition core.c:1935
static int core_post_config(apr_pool_t *pconf, apr_pool_t *plog, apr_pool_t *ptemp, server_rec *s)
Definition core.c:5124
#define AP_LIMIT_UNSET
Definition core.c:73
static const char * server_hostname_port(cmd_parms *cmd, void *dummy, const char *arg)
Definition core.c:3140
static const char * include_config(cmd_parms *cmd, void *dummy, const char *name)
Definition core.c:3379
static const char * set_sethandler(cmd_parms *cmd, void *d_, const char *arg_)
Definition core.c:2101
static int core_create_proxy_req(request_rec *r, request_rec *pr)
Definition core.c:5235
static apr_OFN_authn_ap_auth_type_t * authn_ap_auth_type
Definition core.c:791
static void * create_core_server_config(apr_pool_t *a, server_rec *s)
Definition core.c:467
static int check_errorlog_dir(apr_pool_t *p, server_rec *s)
Definition core.c:5068
static const char * ifsection(cmd_parms *cmd, void *mconfig, const char *arg)
Definition core.c:2715
#define USE_ICASE
Definition core.c:2447
static apr_status_t core_dirwalk_stat(apr_finfo_t *finfo, request_rec *r, apr_int32_t wanted)
Definition core.c:5515
static const char * set_define(cmd_parms *cmd, void *dummy, const char *name, const char *value)
Definition core.c:1493
static const char * set_timeout(cmd_parms *cmd, void *dummy, const char *arg)
Definition core.c:3244
#define COND_ELSE
Definition core.c:2712
int(* test_cond_section_fn)(cmd_parms *cmd, const char *arg)
Definition core.c:2844
static const char * set_document_root(cmd_parms *cmd, void *dummy, const char *arg)
Definition core.c:1605
static const char * set_trace_enable(cmd_parms *cmd, void *dummy, const char *arg1)
Definition core.c:4052
static const char * set_max_overlaps(cmd_parms *cmd, void *conf_, const char *arg)
Definition core.c:3811
static const char * generate_error(cmd_parms *cmd, void *dummy, const char *arg)
Definition core.c:1550
apr_OFN_ap_logio_add_bytes_out_t * ap__logio_add_bytes_out
Definition core.c:5055
#define AP_CONTENT_MD5_UNSET
Definition core.c:90
static int test_ifdefine_section(cmd_parms *cmd, const char *arg)
Definition core.c:2901
static const char * set_http_protocol_options(cmd_parms *cmd, void *dummy, const char *arg)
Definition core.c:4116
#define AP_DEFAULT_LIMIT_REQ_BODY
Definition core.c:70
static const char * set_hostname_lookups(cmd_parms *cmd, void *d_, const char *arg)
Definition core.c:3277
static const char * virtualhost_section(cmd_parms *cmd, void *dummy, const char *arg)
Definition core.c:2935
static const char * set_allow2f(cmd_parms *cmd, void *d_, const char *arg)
Definition core.c:3256
#define AP_ACCEPT_PATHINFO_UNSET
Definition core.c:86
static int reorder_sorter(const void *va, const void *vb)
Definition core.c:686
static const char * set_merge_trailers(cmd_parms *cmd, void *dummy, int arg)
Definition core.c:4419
static int core_upgrade_storage(request_rec *r)
Definition core.c:5627
static const char * set_default_type(cmd_parms *cmd, void *d_, const char *arg)
Definition core.c:2089
static int reset_config_defines(void *dummy)
Definition core.c:1468
static apr_status_t core_insert_network_bucket(conn_rec *c, apr_bucket_brigade *bb, apr_socket_t *socket)
Definition core.c:5506
apr_OFN_authz_some_auth_required_t * ap__authz_ap_some_auth_required
Definition core.c:5056
#define COND_ELSEIF
Definition core.c:2713
server_token_type
Definition core.c:3560
@ SrvTk_OS
Definition core.c:3564
@ SrvTk_MAJOR
Definition core.c:3561
@ SrvTk_FULL
Definition core.c:3565
@ SrvTk_MINOR
Definition core.c:3562
@ SrvTk_MINIMAL
Definition core.c:3563
@ SrvTk_PRODUCT_ONLY
Definition core.c:3566
static const char * set_qualify_redirect_url(cmd_parms *cmd, void *d_, int flag)
Definition core.c:1919
static const char * set_use_canonical_name(cmd_parms *cmd, void *d_, const char *arg)
Definition core.c:3340
#define RAND_RANGE(__n, __min, __max, __tmax)
Definition core.c:5483
static char * missing_container_arg(cmd_parms *cmd)
Definition core.c:2360
static const char * unset_define(cmd_parms *cmd, void *dummy, const char *name)
Definition core.c:1519
static apr_size_t num_request_notes
Definition core.c:5169
static apr_table_t * server_config_defined_vars
Definition core.c:146
static int core_pre_config(apr_pool_t *pconf, apr_pool_t *plog, apr_pool_t *ptemp)
Definition core.c:5108
static const char * set_cgi_pass_auth(cmd_parms *cmd, void *d_, int flag)
Definition core.c:1885
int ap_pre_connection(conn_rec *c, void *csd)
Definition core.c:5353
static const char * set_server_alias(cmd_parms *cmd, void *dummy, const char *arg)
Definition core.c:3040
static int core_override_type(request_rec *r)
Definition core.c:4830
static int test_ifsection_section(cmd_parms *cmd, const char *arg)
Definition core.c:2927
static int do_nothing(request_rec *r)
Definition core.c:4828
static apr_OFN_ap_ident_lookup_t * ident_lookup
Definition core.c:1119
static const char * set_server_string_slot(cmd_parms *cmd, void *dummy, const char *arg)
Definition core.c:3115
static const char * set_error_document(cmd_parms *cmd, void *conf_, const char *errno_str, const char *msg)
Definition core.c:1667
static const char * set_enable_mmap(cmd_parms *cmd, void *d_, const char *arg)
Definition core.c:2253
#define AP_MAX_INCLUDE_DEPTH
Definition core.c:82
static const ap_directive_t * find_parent(const ap_directive_t *dirp, const char *what)
Definition core.c:1287
static const char * filesection(cmd_parms *cmd, void *mconfig, const char *arg)
Definition core.c:2624
static apr_status_t reset_banner(void *dummy)
Definition core.c:3570
static const char * set_add_default_charset(cmd_parms *cmd, void *d_, const char *arg)
Definition core.c:1585
static void core_dump_config(apr_pool_t *p, server_rec *s)
Definition core.c:5521
static int core_pre_connection(conn_rec *c, void *csd)
Definition core.c:5303
static apr_OFN_authn_ap_auth_name_t * authn_ap_auth_name
Definition core.c:805
#define AP_FLUSH_MAX_PIPELINED
Definition core.c:93
static const char * set_limit_req_body(cmd_parms *cmd, void *conf_, const char *arg)
Definition core.c:3752
static void * merge_core_server_configs(apr_pool_t *p, void *basev, void *virtv)
Definition core.c:532
static const char * set_loglevel(cmd_parms *cmd, void *config_, const char *arg_)
Definition core.c:3452
static apr_status_t core_get_pollfd_from_conn(conn_rec *c, struct apr_pollfd_t *pfd, apr_interval_time_t *ptimeout)
Definition core.c:5636
static int log_constant_item(const ap_errorlog_info *info, const char *arg, char *buf, int buflen)
Definition core.c:4169
static const char * set_read_buf_size(cmd_parms *cmd, void *d_, const char *arg)
Definition core.c:2289
static const command_rec core_cmds[]
Definition core.c:4452
static const char * set_protocols_honor_order(cmd_parms *cmd, void *dummy, const char *arg)
Definition core.c:4092
static int test_ifdirective_section(cmd_parms *cmd, const char *arg)
Definition core.c:2922
static apr_pool_t * pconf
Definition event.c:441
#define AP_DECLINED
Definition httpd.h:401
const char * ap_parse_log_level(const char *str, int *val)
Definition log.c:1983
const char * ap_build_cont_config(apr_pool_t *p, apr_pool_t *temp_pool, cmd_parms *parms, ap_directive_t **current, ap_directive_t **curr_parent, char *orig_directive)
Definition config.c:1251
#define AP_INIT_TAKE1(directive, func, mconfig, where, help)
#define ap_get_module_config(v, m)
apr_status_t ap_open_htaccess(request_rec *r, const char *dir_name, const char *access_name, ap_configfile_t **conffile, const char **full_name)
Definition config.c:1986
ap_module_symbol_t ap_prelinked_module_symbols[]
void ap_set_module_loglevel(apr_pool_t *p, struct ap_logconf *l, int index, int level)
Definition config.c:1570
const char * ap_set_string_slot_lower(cmd_parms *cmd, void *struct_ptr, const char *arg)
Definition config.c:1499
#define AP_INIT_TAKE_ARGV(directive, func, mconfig, where, help)
const char * ap_process_fnmatch_configs(server_rec *s, const char *fname, ap_directive_t **conftree, apr_pool_t *p, apr_pool_t *ptemp, int optional)
Definition config.c:1902
void ap_hook_post_config(ap_HOOK_post_config_t *pf, const char *const *aszPre, const char *const *aszSucc, int nOrder)
Definition config.c:105
const char * ap_soak_end_container(cmd_parms *cmd, char *directive)
Definition config.c:1629
void ap_hook_test_config(ap_HOOK_test_config_t *pf, const char *const *aszPre, const char *const *aszSucc, int nOrder)
Definition config.c:100
struct ap_conf_vector_t ap_conf_vector_t
#define AP_DECLARE_MODULE(foo)
int ap_exists_directive(apr_pool_t *p, const char *name)
Definition config.c:2509
#define AP_INIT_FLAG(directive, func, mconfig, where, help)
const char * ap_set_deprecated(cmd_parms *cmd, void *struct_ptr, const char *arg)
Definition config.c:1557
void ap_hook_open_logs(ap_HOOK_open_logs_t *pf, const char *const *aszPre, const char *const *aszSucc, int nOrder)
Definition config.c:163
ap_conf_vector_t * base
#define AP_INIT_ITERATE(directive, func, mconfig, where, help)
void ap_hook_check_config(ap_HOOK_check_config_t *pf, const char *const *aszPre, const char *const *aszSucc, int nOrder)
Definition config.c:96
char * ap_server_root_relative(apr_pool_t *p, const char *fname)
Definition config.c:1594
#define AP_INIT_RAW_ARGS(directive, func, mconfig, where, help)
void ap_hook_handler(ap_HOOK_handler_t *pf, const char *const *aszPre, const char *const *aszSucc, int nOrder)
Definition config.c:170
const char * ap_set_string_slot(cmd_parms *cmd, void *struct_ptr, const char *arg)
Definition config.c:1469
void ap_hook_pre_config(ap_HOOK_pre_config_t *pf, const char *const *aszPre, const char *const *aszSucc, int nOrder)
Definition config.c:91
#define AP_INIT_TAKE12(directive, func, mconfig, where, help)
void ap_merge_log_config(const struct ap_logconf *old_conf, struct ap_logconf *new_conf)
Definition config.c:2140
request_rec int int apr_table_t const char * path
const char * ap_set_flag_slot(cmd_parms *cmd, void *struct_ptr, int arg)
Definition config.c:1512
request_rec * r
void ap_hook_optional_fn_retrieve(ap_HOOK_optional_fn_retrieve_t *pf, const char *const *aszPre, const char *const *aszSucc, int nOrder)
Definition config.c:195
const char * ap_walk_config(ap_directive_t *conftree, cmd_parms *parms, ap_conf_vector_t *section_vector)
Definition config.c:1360
void ap_reset_module_loglevels(struct ap_logconf *l, int val)
Definition config.c:1564
void ap_hook_child_init(ap_HOOK_child_init_t *pf, const char *const *aszPre, const char *const *aszSucc, int nOrder)
Definition config.c:167
void ap_hook_open_htaccess(ap_HOOK_open_htaccess_t *pf, const char *const *aszPre, const char *const *aszSucc, int nOrder)
Definition config.c:179
const char server_rec * main_server
#define AP_INIT_TAKE2(directive, func, mconfig, where, help)
struct ap_logconf * ap_new_log_config(apr_pool_t *p, const struct ap_logconf *old)
Definition config.c:2123
void * csd
void ap_get_server_revision(ap_version_t *version)
Definition core.c:3579
void ap_add_version_component(apr_pool_t *pconf, const char *component)
Definition core.c:3598
#define ap_default_port(r)
Definition httpd.h:292
#define ap_http_scheme(r)
Definition httpd.h:297
#define MAX_STRING_LEN
Definition httpd.h:300
#define AP_FILTER_ERROR
Definition httpd.h:473
#define AP_IOBUFSIZE
Definition httpd.h:306
const char * ap_get_server_description(void)
Definition core.c:3587
#define DECLINED
Definition httpd.h:457
#define DEFAULT_ACCESS_FNAME
Definition httpd.h:140
#define AP_CORE_DECLARE
Definition httpd.h:381
#define OK
Definition httpd.h:456
#define DONE
Definition httpd.h:458
#define ap_is_default_port(port, r)
Definition httpd.h:287
const char * ap_get_server_banner(void)
Definition core.c:3593
#define AP_CORE_DECLARE_NONSTD
Definition httpd.h:390
#define DEFAULT_ADD_DEFAULT_CHARSET_NAME
Definition httpd.h:213
#define DOCUMENT_LOCATION
Definition httpd.h:113
apr_status_t ap_pass_brigade(ap_filter_t *filter, apr_bucket_brigade *bucket)
ap_filter_t * ap_add_input_filter(const char *name, void *ctx, request_rec *r, conn_rec *c)
ap_filter_t * ap_add_input_filter_handle(ap_filter_rec_t *f, void *ctx, request_rec *r, conn_rec *c)
ap_filter_rec_t * ap_register_output_filter(const char *name, ap_out_filter_func filter_func, ap_init_filter_func filter_init, ap_filter_type ftype)
ap_filter_t * ap_add_output_filter(const char *name, void *ctx, request_rec *r, conn_rec *c)
apr_status_t ap_filter_rec_t * ap_register_input_filter(const char *name, ap_in_filter_func filter_func, ap_init_filter_func filter_init, ap_filter_type ftype)
ap_filter_t * ap_add_output_filter_handle(ap_filter_rec_t *f, void *ctx, request_rec *r, conn_rec *c)
@ AP_FTYPE_CONTENT_SET
@ AP_FTYPE_NETWORK
@ AP_FTYPE_PROTOCOL
@ AP_FTYPE_RESOURCE
#define OPT_NONE
Definition http_core.h:70
#define OPT_SYM_OWNER
Definition http_core.h:84
#define OPT_ALL
Definition http_core.h:88
#define OPT_SYM_LINKS
Definition http_core.h:76
#define OPT_EXECCGI
Definition http_core.h:78
#define OPT_INC_WITH_EXEC
Definition http_core.h:82
#define OPT_UNSET
Definition http_core.h:80
#define OPT_INDEXES
Definition http_core.h:72
#define OPT_MULTI
Definition http_core.h:86
#define OPT_INCLUDES
Definition http_core.h:74
apr_status_t ap_run_get_pollfd_from_conn(conn_rec *c, struct apr_pollfd_t *pfd, apr_interval_time_t *ptimeout)
Definition core.c:113
#define AP_SQ_NOT_SUPPORTED
Definition http_core.h:1041
#define AP_SENDFILE_ENABLED(x)
Definition http_core.h:689
#define ETAG_INODE
Definition http_core.h:496
apr_port_t ap_get_server_port(const request_rec *r)
Definition core.c:1199
void ap_register_log_hooks(apr_pool_t *p)
Definition log.c:941
ap_filter_rec_t * ap_subreq_core_filter_handle
Definition core.c:131
apr_off_t ap_get_limit_req_body(const request_rec *r)
Definition core.c:1259
#define AP_ERRORLOG_FLAG_MESSAGE
Definition http_core.h:960
void ap_add_file_conf(apr_pool_t *p, core_dir_config *conf, void *url_config)
Definition core.c:632
int ap_exists_config_define(const char *name)
Definition core.c:2896
#define AP_ERRORLOG_FLAG_NULL_AS_HYPHEN
Definition http_core.h:964
int ap_state_query(int query)
Definition core.c:5378
const char * ap_get_server_name(request_rec *r)
Definition core.c:1145
#define AP_DEFAULT_MAX_INTERNAL_REDIRECTS
Definition http_core.h:134
#define ETAG_MTIME
Definition http_core.h:495
ap_filter_rec_t * ap_content_length_filter_handle
Definition core.c:133
apr_status_t ap_core_input_filter(ap_filter_t *f, apr_bucket_brigade *b, ap_input_mode_t mode, apr_read_type_e block, apr_off_t readbytes)
#define ETAG_NONE
Definition http_core.h:494
int ap_core_translate(request_rec *r)
Definition core.c:4756
#define AP_SQ_MAIN_STATE
Definition http_core.h:1030
#define ap_get_core_module_config(v)
Definition http_core.h:383
#define AP_NUM_STD_NOTES
Definition http_core.h:454
#define AP_SQ_RUN_MODE
Definition http_core.h:1032
apr_size_t ap_get_read_buf_size(const request_rec *r)
Definition core.c:1271
#define AP_CORE_MERGE_FLAG(field, to, base, over)
Definition http_core.h:509
unsigned char allow_options_t
Definition http_core.h:482
#define ETAG_DIGEST
Definition http_core.h:498
#define AP_CORE_CONFIG_UNSET
Definition http_core.h:506
const char * ap_auth_name(request_rec *r)
Definition core.c:807
const char * ap_add_if_conf(apr_pool_t *p, core_dir_config *conf, void *if_config)
Definition core.c:644
apr_socket_t * ap_get_conn_socket(conn_rec *c)
Definition core.c:5202
#define AP_DEFAULT_MAX_SUBREQ_DEPTH
Definition http_core.h:137
int ap_satisfies(request_rec *r)
Definition core.c:821
void ap_set_server_protocol(server_rec *s, const char *proto)
Definition core.c:3090
#define ETAG_SIZE
Definition http_core.h:497
int ap_is_recursion_limit_exceeded(const request_rec *r)
Definition core.c:3992
#define AP_SQ_CONFIG_GEN
Definition http_core.h:1034
#define AP_ERRORLOG_FLAG_FIELD_SEP
Definition http_core.h:958
const char * ap_document_root(request_rec *r)
Definition core.c:829
#define AP_SQ_MS_INITIAL_STARTUP
Definition http_core.h:1045
apr_status_t ap_get_pollfd_from_conn(conn_rec *c, struct apr_pollfd_t *pfd, apr_interval_time_t *ptimeout)
Definition core.c:5651
const char * ap_limit_section(cmd_parms *cmd, void *dummy, const char *arg)
Definition core.c:2366
void ap_custom_response(request_rec *r, int status, const char *string)
Definition core.c:1648
const char * ap_get_remote_logname(request_rec *r)
Definition core.c:1121
const char * ap_get_server_protocol(server_rec *s)
Definition core.c:3084
void ap_add_per_dir_conf(server_rec *s, void *dir_config)
Definition core.c:616
void ap_register_config_hooks(apr_pool_t *p)
Definition config.c:2288
apr_status_t ap_core_output_filter(ap_filter_t *f, apr_bucket_brigade *b)
#define AP_SQ_RM_UNKNOWN
Definition http_core.h:1059
apr_size_t ap_register_request_note(void)
Definition core.c:5177
void ap_add_per_url_conf(server_rec *s, void *url_config)
Definition core.c:624
void ap_register_errorlog_handler(apr_pool_t *p, char *tag, ap_errorlog_handler_fn_t *handler, int flags)
Definition core.c:4407
apr_size_t ap_get_limit_xml_body(const request_rec *r)
Definition core.c:3863
int ap_allow_overrides(request_rec *r)
Definition core.c:779
#define ETAG_UNSET
Definition http_core.h:493
#define SATISFY_NOSPEC
Definition http_core.h:127
#define AP_CORE_CONFIG_OFF
Definition http_core.h:504
ap_filter_rec_t * ap_core_output_filter_handle
Definition core.c:132
void ap_core_reorder_directories(apr_pool_t *p, server_rec *s)
Definition core.c:720
const char * ap_auth_type(request_rec *r)
Definition core.c:793
void ap_hook_get_pollfd_from_conn(ap_HOOK_get_pollfd_from_conn_t *pf, const char *const *aszPre, const char *const *aszSucc, int nOrder)
Definition core.c:113
int ap_errorlog_handler_fn_t(const ap_errorlog_info *info, const char *arg, char *buf, int buflen)
Definition http_core.h:938
void ** ap_get_request_note(request_rec *r, apr_size_t note_num)
Definition core.c:5184
#define AP_CORE_CONFIG_ON
Definition http_core.h:505
#define AP_ERRORLOG_FLAG_REQUIRED
Definition http_core.h:962
char * ap_construct_url(apr_pool_t *p, const char *uri, request_rec *r)
Definition core.c:1246
void ap_hook_insert_network_bucket(ap_HOOK_insert_network_bucket_t *pf, const char *const *aszPre, const char *const *aszSucc, int nOrder)
Definition core.c:108
const char * ap_get_server_name_for_url(request_rec *r)
Definition core.c:1187
unsigned long etag_components_t
Definition http_core.h:491
#define ap_set_core_module_config(v, val)
Definition http_core.h:385
ap_filter_rec_t * ap_core_input_filter_handle
Definition core.c:134
#define ETAG_ALL
Definition http_core.h:499
int ap_allow_options(request_rec *r)
Definition core.c:771
@ srv_sig_on
Definition http_core.h:520
@ srv_sig_off
Definition http_core.h:519
@ srv_sig_unset
Definition http_core.h:518
@ srv_sig_withmail
Definition http_core.h:521
#define APLOG_TRACE8
Definition http_log.h:79
#define APLOGNO(n)
Definition http_log.h:117
#define APLOG_NOTICE
Definition http_log.h:69
#define APLOGrdebug(r)
Definition http_log.h:245
#define APLOG_STARTUP
Definition http_log.h:105
#define APLOG_TRACE4
Definition http_log.h:75
#define APLOG_INFO
Definition http_log.h:70
#define ap_log_rerror
Definition http_log.h:454
#define APLOG_ERR
Definition http_log.h:67
#define APLOG_TRACE3
Definition http_log.h:74
#define ap_log_error
Definition http_log.h:370
#define ap_log_cerror
Definition http_log.h:498
#define APLOG_MARK
Definition http_log.h:283
#define ap_log_perror
Definition http_log.h:412
#define APLOG_WARNING
Definition http_log.h:68
#define APLOG_CRIT
Definition http_log.h:66
#define APLOG_EMERG
Definition http_log.h:64
void ap_logs_child_init(apr_pool_t *p, server_rec *s)
Definition log.c:233
int ap_open_logs(apr_pool_t *pconf, apr_pool_t *plog, apr_pool_t *ptemp, server_rec *s_main)
Definition log.c:472
#define APLOG_NO_MODULE
Definition http_log.h:129
#define APLOG_TRACE6
Definition http_log.h:77
#define APLOG_DEBUG
Definition http_log.h:71
const char * ap_server_root
Definition config.c:61
int ap_config_generation
Definition core.c:151
int ap_document_root_check
Definition core.c:137
int ap_main_state
Definition core.c:149
apr_array_header_t * ap_server_config_defines
Definition config.c:67
const char * ap_runtime_dir
Definition core.c:147
int ap_run_mode
Definition core.c:150
server_rec * ap_server_conf
Definition config.c:62
const unsigned char * buf
Definition util_md5.h:50
void ap_hook_child_status(ap_HOOK_child_status_t *pf, const char *const *aszPre, const char *const *aszSucc, int nOrder)
Definition mpm_common.c:109
const char * ap_set_mutex(cmd_parms *cmd, void *dummy, const char *arg)
Definition util_mutex.c:164
void ap_mutex_init(apr_pool_t *p)
Definition util_mutex.c:145
void ap_dump_mutexes(apr_pool_t *p, server_rec *s, apr_file_t *out)
Definition util_mutex.c:501
int ap_method_number_of(const char *method)
void ap_setup_make_content_type(apr_pool_t *pool)
Definition protocol.c:87
void ap_set_accept_ranges(request_rec *r)
apr_status_t ap_get_protocol_upgrades(conn_rec *c, request_rec *r, server_rec *s, int report_all, const apr_array_header_t **pupgrades)
Definition protocol.c:2403
int ap_meets_conditions(request_rec *r)
int ap_method_register(apr_pool_t *p, const char *methname)
void ap_set_etag_fd(request_rec *r, apr_file_t *fd)
Definition http_etag.c:391
void ap_send_interim_response(request_rec *r, int send_headers)
Definition protocol.c:2316
int ap_index_of_response(int status)
void ap_set_content_length(request_rec *r, apr_off_t length)
Definition protocol.c:160
apr_status_t ap_switch_protocol(conn_rec *c, request_rec *r, server_rec *s, const char *protocol)
Definition protocol.c:2532
const char * ap_get_protocol(conn_rec *c)
Definition protocol.c:2397
const char * ap_select_protocol(conn_rec *c, request_rec *r, server_rec *s, const apr_array_header_t *choices)
Definition protocol.c:2444
void ap_set_last_modified(request_rec *r)
Definition protocol.c:2280
void ap_set_content_type_ex(request_rec *r, const char *ct, int trusted)
void ap_setup_ssl_optional_fns(apr_pool_t *pool)
Definition ssl.c:197
apr_status_t ap_content_length_filter(ap_filter_t *, apr_bucket_brigade *)
Definition protocol.c:1861
const char * ap_get_status_line(int status)
int ap_discard_request_body(request_rec *r)
ap_filter_rec_t * ap_old_write_func
Definition protocol.c:75
apr_status_t ap_old_write_filter(ap_filter_t *f, apr_bucket_brigade *b)
Definition protocol.c:2039
void ap_setup_auth_internal(apr_pool_t *ptemp)
Definition request.c:2141
apr_status_t ap_sub_req_output_filter(ap_filter_t *f, apr_bucket_brigade *bb)
Definition request.c:2107
void ap_hook_dirwalk_stat(ap_HOOK_dirwalk_stat_t *pf, const char *const *aszPre, const char *const *aszSucc, int nOrder)
Definition request.c:103
int ap_directory_walk(request_rec *r)
Definition request.c:661
int ap_file_walk(request_rec *r)
Definition request.c:1655
void ap_hook_translate_name(ap_HOOK_translate_name_t *pf, const char *const *aszPre, const char *const *aszSucc, int nOrder)
Definition request.c:81
void ap_hook_map_to_storage(ap_HOOK_map_to_storage_t *pf, const char *const *aszPre, const char *const *aszSucc, int nOrder)
Definition request.c:83
void ap_hook_fixups(ap_HOOK_fixups_t *pf, const char *const *aszPre, const char *const *aszSucc, int nOrder)
Definition request.c:87
void ap_allow_standard_methods(request_rec *r, int reset,...)
void ap_hook_create_request(ap_HOOK_create_request_t *pf, const char *const *aszPre, const char *const *aszSucc, int nOrder)
Definition request.c:98
void ap_hook_type_checker(ap_HOOK_type_checker_t *pf, const char *const *aszPre, const char *const *aszSucc, int nOrder)
Definition request.c:89
#define MERGE_ALLOW
void ap_hook_insert_filter(ap_HOOK_insert_filter_t *pf, const char *const *aszPre, const char *const *aszSucc, int nOrder)
Definition request.c:96
void ap_update_mtime(request_rec *r, apr_time_t dependency_mtime)
Definition request.c:2557
const char apr_port_t port
Definition http_vhost.h:125
void * dummy
Definition http_vhost.h:62
const char * host
Definition http_vhost.h:124
void const char * arg
Definition http_vhost.h:63
void mpm_common_pre_config(apr_pool_t *pconf)
Definition mpm_common.c:164
int ap_sys_privileges_handlers(int inc)
Definition core.c:5062
const char * ap_mpm_set_pidfile(cmd_parms *cmd, void *dummy, const char *arg)
Definition mpm_common.c:300
const char * ap_mpm_set_coredumpdir(cmd_parms *cmd, void *dummy, const char *arg)
Definition mpm_common.c:341
void ap_mpm_dump_pidfile(apr_pool_t *p, apr_file_t *out)
Definition mpm_common.c:316
void ap_core_child_status(server_rec *s, pid_t pid, ap_generation_t gen, int slot, mpm_child_status status)
Definition mpm_common.c:477
const char * ap_mpm_set_max_requests(cmd_parms *cmd, void *dummy, const char *arg)
Definition mpm_common.c:322
apr_status_t ap_mpm_end_gen_helper(void *unused)
Definition mpm_common.c:441
const char * ap_mpm_set_thread_stacksize(cmd_parms *cmd, void *dummy, const char *arg)
Definition mpm_common.c:401
const char * ap_mpm_set_max_mem_free(cmd_parms *cmd, void *dummy, const char *arg)
Definition mpm_common.c:381
#define APR_EPATHWILD
Definition apr_errno.h:334
#define APR_EACCES
Definition apr_errno.h:641
#define APR_ENOTIMPL
Definition apr_errno.h:476
#define APR_ENOTENOUGHENTROPY
Definition apr_errno.h:340
#define APR_ENOTDIR
Definition apr_errno.h:669
#define APR_BRIGADE_INSERT_TAIL(b, e)
apr_bucket * e
apr_bucket apr_bucket_brigade * a
apr_file_t * fd
apr_brigade_flush void va_list va
apr_pool_t apr_dbd_t const char * query
Definition apr_dbd.h:396
apr_pool_t const char apr_dbd_t const char ** error
Definition apr_dbd.h:143
apr_pool_t apr_dbd_t apr_dbd_results_t ** res
Definition apr_dbd.h:287
const char apr_ssize_t int flags
Definition apr_encode.h:168
#define APR_HOOK_FIRST
Definition apr_hooks.h:301
#define APR_HOOK_LINK(name)
Definition apr_hooks.h:139
#define APR_HOOK_STRUCT(members)
Definition apr_hooks.h:135
#define APR_HOOK_REALLY_FIRST
Definition apr_hooks.h:299
#define APR_HOOK_MIDDLE
Definition apr_hooks.h:303
APU_DECLARE_DATA apr_pool_t * apr_hook_global_pool
Definition apr_hooks.c:36
#define APR_HOOK_REALLY_LAST
Definition apr_hooks.h:307
apr_memcache_server_t * server
#define APR_OPTIONAL_HOOK(ns, name, pfn, aszPre, aszSucc, nOrder)
#define APR_RETRIEVE_OPTIONAL_FN(name)
#define APR_OPTIONAL_FN_TYPE(name)
apr_redis_t * rc
Definition apr_redis.h:173
const char apr_int32_t inc
Definition apr_redis.h:337
const char * uri
Definition apr_uri.h:159
#define AP_EXPR_FLAG_STRING_RESULT
Definition ap_expr.h:68
#define ap_expr_parse_cmd(cmd, expr, flags, err, lookup_fn)
Definition ap_expr.h:340
const char * ap_expr_str_exec(request_rec *r, const ap_expr_info_t *expr, const char **err)
void ap_expr_init(apr_pool_t *pool)
#define ACCESS_CONF
#define OR_LIMIT
#define OR_INDEXES
#define NONFATAL_ALL
#define OR_ALL
#define RSRC_CONF
#define OR_FILEINFO
#define OR_UNSET
#define OR_OPTIONS
#define OR_NONE
#define EXEC_ON_READ
#define NONFATAL_UNKNOWN
#define NONFATAL_OVERRIDE
#define OR_AUTHCFG
#define HTTP_OK
Definition httpd.h:490
#define HTTP_BAD_REQUEST
Definition httpd.h:508
#define HTTP_INTERNAL_SERVER_ERROR
Definition httpd.h:535
#define HTTP_METHOD_NOT_ALLOWED
Definition httpd.h:513
#define HTTP_FORBIDDEN
Definition httpd.h:511
#define RESPONSE_CODES
Definition httpd.h:485
#define HTTP_SWITCHING_PROTOCOLS
Definition httpd.h:488
#define HTTP_NOT_FOUND
Definition httpd.h:512
#define HTTP_NOT_IMPLEMENTED
Definition httpd.h:536
char * ap_response_code_string(request_rec *r, int error_index)
Definition core.c:878
void ap_init_rng(apr_pool_t *p)
Definition core.c:5435
int ap_send_http_options(request_rec *r)
void ap_random_parent_after_fork(void)
Definition core.c:5420
#define M_OPTIONS
Definition httpd.h:597
#define AP_METHOD_BIT
Definition httpd.h:629
#define M_TRACE
Definition httpd.h:598
#define M_POST
Definition httpd.h:594
#define M_GET
Definition httpd.h:592
#define M_INVALID
Definition httpd.h:618
#define MPM20_MODULE_STUFF
#define ap_strchr(s, c)
Definition httpd.h:2351
void ap_random_insecure_bytes(void *buf, apr_size_t size)
Definition core.c:5455
void ap_set_document_root(request_rec *r, const char *document_root)
Definition core.c:857
int ap_is_directory(apr_pool_t *p, const char *name)
Definition util.c:2326
#define ap_strrchr(s, c)
Definition httpd.h:2355
int ap_is_url(const char *u)
Definition util.c:2377
int ap_count_dirs(const char *path)
Definition util.c:708
int ap_cstr_casecmp(const char *s1, const char *s2)
Definition util.c:3542
const char * ap_psignature(const char *prefix, request_rec *r)
Definition core.c:3516
const char * ap_parse_token_list_strict(apr_pool_t *p, const char *tok, apr_array_header_t **tokens, int skip_invalid)
Definition util.c:1562
char * ap_getword(apr_pool_t *p, const char **line, char stop)
Definition util.c:723
#define ap_strrchr_c(s, c)
Definition httpd.h:2357
#define ap_strstr_c(s, c)
Definition httpd.h:2361
void ap_set_context_info(request_rec *r, const char *context_prefix, const char *context_document_root)
Definition core.c:863
#define ap_strchr_c(s, c)
Definition httpd.h:2353
const char * ap_context_prefix(request_rec *r)
Definition core.c:839
const char * ap_context_document_root(request_rec *r)
Definition core.c:848
const char * ap_resolve_env(apr_pool_t *p, const char *word)
Definition core.c:1376
char * ap_make_dirstr_parent(apr_pool_t *p, const char *s)
Definition util.c:692
apr_status_t ap_filepath_merge(char **newpath, const char *rootpath, const char *addpath, apr_int32_t flags, apr_pool_t *p)
Definition core.c:5712
int ap_find_token(apr_pool_t *p, const char *line, const char *tok)
Definition util.c:1726
int ap_is_matchexp(const char *str)
Definition util.c:240
#define ap_escape_html(p, s)
Definition httpd.h:1860
void ap_str_tolower(char *s)
Definition util.c:2410
int ap_array_str_contains(const apr_array_header_t *array, const char *s)
Definition util.c:3446
#define ap_assert(exp)
Definition httpd.h:2271
ap_regex_t * ap_pregcomp(apr_pool_t *p, const char *pattern, int cflags)
Definition util.c:262
apr_uint32_t ap_random_pick(apr_uint32_t min, apr_uint32_t max)
Definition core.c:5485
char * ap_getword_conf(apr_pool_t *p, const char **line)
Definition util.c:833
@ AP_CONN_CLOSE
Definition httpd.h:1145
#define NOT_IN_FILES
#define NOT_IN_VIRTUALHOST
#define NOT_IN_HTACCESS
#define NOT_IN_DIRECTORY
#define NOT_IN_LIMIT
#define NOT_IN_DIR_CONTEXT
#define NOT_IN_PROXY
#define GLOBAL_ONLY
#define NOT_IN_DIR_LOC_FILE
const char * ap_check_cmd_context(cmd_parms *cmd, unsigned forbidden)
Definition core.c:1301
#define NOT_IN_LOCATION
apr_size_t size
apr_uint32_t val
Definition apr_atomic.h:66
const char int apr_pool_t * pool
Definition apr_cstr.h:84
#define apr_isdigit(c)
Definition apr_lib.h:209
const char * value
Definition apr_env.h:51
#define APR_SUCCESS
Definition apr_errno.h:225
int apr_status_t
Definition apr_errno.h:44
@ APR_DIR
@ APR_NOFILE
const char apr_int32_t flag
apr_seek_where_t apr_off_t * offset
void * data
int type
#define APR_READ
Definition apr_file_io.h:93
#define APR_BINARY
Definition apr_file_io.h:98
const char apr_int32_t wanted
#define APR_FINFO_TYPE
const char const char * addpath
const char * rootpath
#define APR_FILEPATH_SECUREROOT
#define APR_FILEPATH_TRUENAME
apr_array_header_t ** result
int strcasecmp(const char *a, const char *b)
apr_pool_t int argc
Definition apr_getopt.h:104
const char * opts
Definition apr_getopt.h:122
apr_hash_t * ht
Definition apr_hash.h:148
#define APR_HASH_KEY_STRING
Definition apr_hash.h:47
apr_vformatter_buff_t * c
Definition apr_lib.h:175
apr_int32_t opt
apr_sockaddr_t * sa
apr_size_t buflen
apr_shutdown_how_e how
#define APR_UNIX
apr_uint16_t apr_port_t
#define APR_UNSPEC
int int int protocol
const char apr_uint32_t * id
@ APR_LOCAL
@ APR_REMOTE
apr_uint32_t apr_pool_t apr_uint32_t apr_pollset_method_e method
Definition apr_poll.h:195
apr_interval_time_t apr_int32_t * num
Definition apr_poll.h:273
@ APR_POLL_SOCKET
Definition apr_poll.h:93
apr_pool_t * b
Definition apr_pools.h:529
apr_pool_t * parent
Definition apr_pools.h:197
#define apr_pool_create(newpool, parent)
Definition apr_pools.h:322
#define apr_pcalloc(p, size)
Definition apr_pools.h:465
apr_dir_t * dir
#define APR_TCP_NODELAY
const char char ** end
const char char ** last
const char * s
Definition apr_strings.h:95
int nelts
Definition apr_tables.h:122
#define APR_ARRAY_IDX(ary, i, type)
Definition apr_tables.h:141
const apr_array_header_t * first
Definition apr_tables.h:207
apr_proc_t * proc
apr_int32_t apr_int32_t apr_int32_t err
apr_cmdtype_e cmd
const char const char *const * args
int int status
apr_int64_t apr_interval_time_t
Definition apr_time.h:55
apr_size_t apr_size_t max
Definition apr_time.h:220
#define apr_time_from_sec(sec)
Definition apr_time.h:78
const char * ap_get_remote_host(conn_rec *conn, void *dir_config, int type, int *str_is_ip)
Definition core.c:957
const char * ap_get_useragent_host(request_rec *r, int type, int *str_is_ip)
Definition core.c:1036
#define REMOTE_NOLOOKUP
Definition http_core.h:111
#define REMOTE_HOST
Definition http_core.h:100
#define REMOTE_DOUBLE_REV
Definition http_core.h:118
apr_status_t ap_mpm_query(int query_code, int *result)
Definition mpm_common.c:421
#define AP_MPMQ_IS_THREADED
Definition ap_mpm.h:152
#define AP_REQ_DEFAULT_PATH_INFO
Definition httpd.h:765
#define AP_REQ_ACCEPT_PATH_INFO
Definition httpd.h:761
#define AP_REQ_REJECT_PATH_INFO
Definition httpd.h:763
static apr_pool_t * pchild
Definition h2_mplx.c:74
Apache Configuration.
Apache connection library.
CORE HTTP Daemon.
#define AP_TRACE_UNSET
Definition http_core.h:727
#define AP_CONDITION_ELSEIF
Definition http_core.h:639
#define AP_HTTP09_UNSET
Definition http_core.h:740
#define HOSTNAME_LOOKUP_ON
Definition http_core.h:552
#define ENABLE_SENDFILE_UNSET
Definition http_core.h:625
#define ENABLE_SENDFILE_ON
Definition http_core.h:624
#define ADD_DEFAULT_CHARSET_OFF
Definition http_core.h:574
#define AP_TRACE_ENABLE
Definition http_core.h:729
#define ENABLE_MMAP_UNSET
Definition http_core.h:620
#define AP_HTTP_CONFORMANCE_STRICT
Definition http_core.h:747
#define AP_HTTP09_DISABLE
Definition http_core.h:742
#define AP_CONDITION_IF
Definition http_core.h:637
#define ENABLE_MMAP_OFF
Definition http_core.h:618
#define USE_CANONICAL_NAME_ON
Definition http_core.h:560
#define ADD_DEFAULT_CHARSET_UNSET
Definition http_core.h:576
#define USE_CANONICAL_NAME_DNS
Definition http_core.h:561
#define AP_TRACE_EXTENDED
Definition http_core.h:730
#define AP_HTTP09_ENABLE
Definition http_core.h:741
#define USE_CANONICAL_PHYS_PORT_OFF
Definition http_core.h:628
#define AP_TRACE_DISABLE
Definition http_core.h:728
#define AP_MAXRANGES_NORANGES
Definition http_core.h:653
#define AP_CONDITION_ELSE
Definition http_core.h:638
#define AP_HTTP_CONFORMANCE_UNSET
Definition http_core.h:745
#define ADD_DEFAULT_CHARSET_ON
Definition http_core.h:575
#define HOSTNAME_LOOKUP_DOUBLE
Definition http_core.h:553
#define USE_CANONICAL_PHYS_PORT_ON
Definition http_core.h:629
#define USE_CANONICAL_NAME_UNSET
Definition http_core.h:562
#define AP_HTTP_METHODS_UNSET
Definition http_core.h:750
#define AP_MAXRANGES_UNLIMITED
Definition http_core.h:652
#define AP_MERGE_TRAILERS_DISABLE
Definition http_core.h:734
#define AP_CGI_PASS_AUTH_ON
Definition http_core.h:671
#define AP_CGI_PASS_AUTH_UNSET
Definition http_core.h:672
#define ENABLE_MMAP_ON
Definition http_core.h:619
#define AP_HTTP_METHODS_REGISTERED
Definition http_core.h:752
#define USE_CANONICAL_NAME_OFF
Definition http_core.h:559
#define AP_MERGE_TRAILERS_UNSET
Definition http_core.h:732
#define AP_MERGE_TRAILERS_ENABLE
Definition http_core.h:733
#define ENABLE_SENDFILE_OFF
Definition http_core.h:623
#define HOSTNAME_LOOKUP_UNSET
Definition http_core.h:554
#define AP_MAXRANGES_DEFAULT
Definition http_core.h:651
#define AP_CGI_PASS_AUTH_OFF
Definition http_core.h:670
#define HOSTNAME_LOOKUP_OFF
Definition http_core.h:551
#define AP_HTTP_CONFORMANCE_UNSAFE
Definition http_core.h:746
#define USE_CANONICAL_PHYS_PORT_UNSET
Definition http_core.h:630
#define AP_HTTP_METHODS_LENIENT
Definition http_core.h:751
#define AP_MAXRANGES_UNSET
Definition http_core.h:650
Apache Logging library.
Command line options.
HTTP protocol handling.
Apache Request library.
SSL protocol handling.
Virtual Host package.
HTTP Daemon routines.
apr_pool_t * p
Definition md_event.c:32
static int authz_some_auth_required(request_rec *r)
mod_core private header file
static const char * ap_ident_lookup(request_rec *r)
Definition mod_ident.c:303
static apr_file_t * out
Definition mod_info.c:85
static void ap_logio_add_bytes_out(conn_rec *c, apr_off_t bytes)
Definition mod_logio.c:67
const char * argv[3]
Proxy Extension Module for Apache.
return NULL
Definition mod_so.c:359
int i
Definition mod_so.c:347
sconf
Definition mod_so.c:349
Shared Object Loader Extension Module for Apache.
#define APR_UINT16_MAX
Multi-Processing Modules functions.
Apache scoreboard library.
#define SERVER_BUSY_READ
Definition scoreboard.h:59
const char * ap_scoreboard_fname
Definition scoreboard.c:45
void ap_init_scoreboard(void *shared_score)
Definition scoreboard.c:150
int ap_create_scoreboard(apr_pool_t *p, ap_scoreboard_e t)
Definition scoreboard.c:304
int ap_update_child_status(ap_sb_handle_t *sbh, int status, request_rec *r)
Definition scoreboard.c:590
const char * ap_set_scoreboard(cmd_parms *cmd, void *dummy, const char *arg)
Definition scoreboard.c:48
void ap_hook_pre_mpm(ap_HOOK_pre_mpm_t *pf, const char *const *aszPre, const char *const *aszSucc, int nOrder)
Definition scoreboard.c:102
const char * ap_set_extended_status(cmd_parms *cmd, void *dummy, int arg)
Definition scoreboard.c:63
const char * ap_set_reqtail(cmd_parms *cmd, void *dummy, int arg)
Definition scoreboard.c:75
char * name
Structure used to build the config tree.
struct ap_directive_t * parent
ap_errorlog_handler_fn_t * func
Definition http_core.h:953
This structure is used for recording information about the registered filters. It associates a name w...
ap_filter_type ftype
ap_filter_rec_t * frec
int level
Definition httpd.h:1317
This structure is used to assign symbol names to module pointers.
const char * name
The numeric version information is broken out into fields within this structure.
Definition httpd.h:409
int patch
Definition httpd.h:412
int minor
Definition httpd.h:411
int major
Definition httpd.h:410
const char * add_string
Definition httpd.h:413
apr_filetype_e filetype
apr_off_t size
apr_time_t mtime
apr_datatype_e desc_type
Definition apr_poll.h:110
apr_descriptor desc
Definition apr_poll.h:113
apr_sockaddr_t * next
apr_port_t port
Definition apr_uri.h:109
char * port_str
Definition apr_uri.h:97
Structure to store things which are per connection.
Definition httpd.h:1152
char * remote_logname
Definition httpd.h:1178
apr_sockaddr_t * client_addr
Definition httpd.h:1166
apr_pool_t * pool
Definition httpd.h:1154
apr_sockaddr_t * local_addr
Definition httpd.h:1162
struct apr_bucket_alloc_t * bucket_alloc
Definition httpd.h:1201
signed int double_reverse
Definition httpd.h:1216
char * client_ip
Definition httpd.h:1171
char * local_host
Definition httpd.h:1184
char * remote_host
Definition httpd.h:1175
Per-directory configuration.
Definition http_core.h:527
allow_options_t opts
Definition http_core.h:540
unsigned d_is_fnmatch
Definition http_core.h:569
unsigned add_default_charset
Definition http_core.h:577
apr_hash_t * response_code_exprs
Definition http_core.h:668
const char * output_filters
Definition http_core.h:604
apr_array_header_t * sec_file
Definition http_core.h:598
etag_components_t etag_add
Definition http_core.h:612
apr_size_t read_buf_size
Definition http_core.h:685
const char * handler
Definition http_core.h:603
unsigned int enable_mmap
Definition http_core.h:621
const char * mime_type
Definition http_core.h:602
const char * input_filters
Definition http_core.h:605
allow_options_t override_opts
Definition http_core.h:544
const char * add_default_charset_name
Definition http_core.h:578
server_signature_e server_signature
Definition http_core.h:595
apr_off_t limit_req_body
Definition http_core.h:590
apr_hash_t * cgi_var_rules
Definition http_core.h:683
struct ap_logconf * log
Definition http_core.h:645
unsigned int hostname_lookups
Definition http_core.h:555
allow_options_t opts_add
Definition http_core.h:541
apr_array_header_t * refs
Definition http_core.h:662
apr_array_header_t * sec_if
Definition http_core.h:599
unsigned int condition_ifelse
Definition http_core.h:640
ap_regex_t * r
Definition http_core.h:600
etag_components_t etag_remove
Definition http_core.h:613
unsigned use_canonical_name
Definition http_core.h:563
unsigned d_components
Definition http_core.h:531
ap_expr_info_t * expr_handler
Definition http_core.h:680
unsigned int content_md5
Definition http_core.h:557
unsigned int enable_sendfile
Definition http_core.h:626
unsigned int qualify_redirect_url
Definition http_core.h:679
unsigned int use_canonical_phys_port
Definition http_core.h:631
apr_table_t * override_list
Definition http_core.h:648
unsigned int allow_encoded_slashes
Definition http_core.h:633
ap_expr_info_t * condition
Definition http_core.h:642
overrides_t override
Definition http_core.h:543
unsigned int cgi_pass_auth
Definition http_core.h:678
allow_options_t opts_remove
Definition http_core.h:542
unsigned int decode_encoded_slashes
Definition http_core.h:635
etag_components_t etag_bits
Definition http_core.h:611
Per-request configuration.
Definition http_core.h:394
char ** response_code_strings
Definition http_core.h:409
const char * document_root
Definition http_core.h:416
const char * context_document_root
Definition http_core.h:425
struct apr_bucket_brigade * bb
Definition http_core.h:397
const char * context_prefix
Definition http_core.h:429
const char * ap_document_root
Definition http_core.h:702
const char * protocol
Definition http_core.h:714
apr_array_header_t * error_log_conn
Definition http_core.h:723
apr_array_header_t * error_log_req
Definition http_core.h:724
apr_array_header_t * sec_dir
Definition http_core.h:707
apr_int32_t flush_max_pipelined
Definition http_core.h:757
apr_array_header_t * protocols
Definition http_core.h:737
apr_size_t flush_max_threshold
Definition http_core.h:756
apr_table_t * accf_map
Definition http_core.h:715
unsigned int merge_slashes
Definition http_core.h:754
apr_array_header_t * error_log_format
Definition http_core.h:718
unsigned int strict_host_check
Definition http_core.h:758
apr_array_header_t * sec_url
Definition http_core.h:708
const char * name
ap_conf_vector_t * elt
Definition core.c:682
A structure that represents the current request.
Definition httpd.h:845
char * useragent_host
Definition httpd.h:1111
int status
Definition httpd.h:891
char * uri
Definition httpd.h:1016
struct ap_filter_t * output_filters
Definition httpd.h:1070
int double_reverse
Definition httpd.h:1115
char * useragent_ip
Definition httpd.h:1101
request_rec * prev
Definition httpd.h:856
const char * handler
Definition httpd.h:994
const char * hostname
Definition httpd.h:883
int used_path_info
Definition httpd.h:1036
char * the_request
Definition httpd.h:866
int method_number
Definition httpd.h:898
apr_pool_t * pool
Definition httpd.h:847
apr_sockaddr_t * useragent_addr
Definition httpd.h:1100
char * filename
Definition httpd.h:1018
apr_uri_t parsed_uri
Definition httpd.h:1092
int proxyreq
Definition httpd.h:873
conn_rec * connection
Definition httpd.h:849
apr_finfo_t finfo
Definition httpd.h:1094
char * canonical_filename
Definition httpd.h:1022
struct ap_conf_vector_t * request_config
Definition httpd.h:1049
apr_table_t * headers_in
Definition httpd.h:976
request_rec * main
Definition httpd.h:860
server_rec * server
Definition httpd.h:851
struct ap_conf_vector_t * per_dir_config
Definition httpd.h:1047
const char * status_line
Definition httpd.h:889
const char * method
Definition httpd.h:900
char * path_info
Definition httpd.h:1024
apr_table_t * headers_out
Definition httpd.h:978
A structure to store information for each virtual server.
Definition httpd.h:1322
const char * path
Definition httpd.h:1386
int pathlen
Definition httpd.h:1388
const char * defn_name
Definition httpd.h:1346
server_rec * next
Definition httpd.h:1326
char * server_hostname
Definition httpd.h:1365
char is_virtual
Definition httpd.h:1350
struct ap_conf_vector_t * module_config
Definition httpd.h:1341
apr_port_t port
Definition httpd.h:1356
char * server_admin
Definition httpd.h:1363
#define MSG
Definition testshm.h:37
apr_socket_t * s
Definition apr_poll.h:101
apr_status_t apr_socket_close(apr_socket_t *thesocket)
Definition sockets.c:211
apr_status_t apr_socket_opt_set(apr_socket_t *sock, apr_int32_t opt, apr_int32_t on)
Definition sockopt.c:113
apr_status_t apr_socket_timeout_set(apr_socket_t *sock, apr_interval_time_t t)
Definition sockopt.c:75
apr_status_t apr_socket_timeout_get(apr_socket_t *sock, apr_interval_time_t *t)
Definition sockopt.c:355
Utilities for EBCDIC conversion.
#define var
Apache filter library.
char * ap_md5digest(apr_pool_t *p, apr_file_t *infile)
Definition util_md5.c:150
Apache MD5 library.
Apache Mutex support library.
Apache date-time handling functions.
const char * ap_set_name_virtual_host(cmd_parms *cmd, void *dummy, const char *arg)
Definition vhost.c:270
typedef int(WSAAPI *apr_winapi_fpt_WSAPoll)(IN OUT LPWSAPOLLFD fdArray
INT info