Apache2
httpd.h
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 
36 #ifndef APACHE_HTTPD_H
37 #define APACHE_HTTPD_H
38 
39 /* XXX - We need to push more stuff to other .h files, or even .c files, to
40  * make this file smaller
41  */
42 
43 /* Headers in which EVERYONE has an interest... */
44 #include "ap_config.h"
45 #include "ap_mmn.h"
46 
47 #include "ap_release.h"
48 
49 #include "apr.h"
50 #include "apr_general.h"
51 #include "apr_tables.h"
52 #include "apr_pools.h"
53 #include "apr_time.h"
54 #include "apr_network_io.h"
55 #include "apr_buckets.h"
56 #include "apr_poll.h"
57 #include "apr_thread_proc.h"
58 #include "apr_hash.h"
59 
60 #include "os.h"
61 
62 #include "ap_regex.h"
63 
64 #if APR_HAVE_STDLIB_H
65 #include <stdlib.h>
66 #endif
67 
68 /* Note: apr_uri.h is also included, see below */
69 
70 #ifdef __cplusplus
71 extern "C" {
72 #endif
73 
74 /* ----------------------------- config dir ------------------------------ */
75 
79 #ifndef HTTPD_ROOT
80 #ifdef OS2
81 
82 #define HTTPD_ROOT "/os2httpd"
83 #elif defined(WIN32)
84 
85 #define HTTPD_ROOT "/apache"
86 #elif defined (NETWARE)
87 
88 #define HTTPD_ROOT "/apache"
89 #else
90 
91 #define HTTPD_ROOT "/usr/local/apache"
92 #endif
93 #endif /* HTTPD_ROOT */
94 
95 /*
96  * --------- You shouldn't have to edit anything below this line ----------
97  *
98  * Any modifications to any defaults not defined above should be done in the
99  * respective configuration file.
100  *
101  */
102 
107 #ifndef DOCUMENT_LOCATION
108 #ifdef OS2
109 /* Set default for OS/2 file system */
110 #define DOCUMENT_LOCATION HTTPD_ROOT "/docs"
111 #else
112 /* Set default for non OS/2 file system */
113 #define DOCUMENT_LOCATION HTTPD_ROOT "/htdocs"
114 #endif
115 #endif /* DOCUMENT_LOCATION */
116 
118 #ifndef DYNAMIC_MODULE_LIMIT
119 #define DYNAMIC_MODULE_LIMIT 256
120 #endif
121 
123 #define DEFAULT_ADMIN "[no address given]"
124 
126 #ifndef DEFAULT_ERRORLOG
127 #if defined(OS2) || defined(WIN32)
128 #define DEFAULT_ERRORLOG "logs/error.log"
129 #else
130 #define DEFAULT_ERRORLOG "logs/error_log"
131 #endif
132 #endif /* DEFAULT_ERRORLOG */
133 
135 #ifndef DEFAULT_ACCESS_FNAME
136 #ifdef OS2
137 /* Set default for OS/2 file system */
138 #define DEFAULT_ACCESS_FNAME "htaccess"
139 #else
140 #define DEFAULT_ACCESS_FNAME ".htaccess"
141 #endif
142 #endif /* DEFAULT_ACCESS_FNAME */
143 
145 #ifndef SERVER_CONFIG_FILE
146 #define SERVER_CONFIG_FILE "conf/httpd.conf"
147 #endif
148 
150 #ifndef DEFAULT_PATH
151 #define DEFAULT_PATH "/bin:/usr/bin:/usr/ucb:/usr/bsd:/usr/local/bin"
152 #endif
153 
155 #ifndef SUEXEC_BIN
156 #define SUEXEC_BIN HTTPD_ROOT "/bin/suexec"
157 #endif
158 
160 #ifndef DEFAULT_TIMEOUT
161 #define DEFAULT_TIMEOUT 60
162 #endif
163 
165 #ifndef DEFAULT_KEEPALIVE_TIMEOUT
166 #define DEFAULT_KEEPALIVE_TIMEOUT 5
167 #endif
168 
170 #ifndef DEFAULT_KEEPALIVE
171 #define DEFAULT_KEEPALIVE 100
172 #endif
173 
174 /*
175  * Limits on the size of various request items. These limits primarily
176  * exist to prevent simple denial-of-service attacks on a server based
177  * on misuse of the protocol. The recommended values will depend on the
178  * nature of the server resources -- CGI scripts and database backends
179  * might require large values, but most servers could get by with much
180  * smaller limits than we use below. The request message body size can
181  * be limited by the per-dir config directive LimitRequestBody.
182  *
183  * Internal buffer sizes are two bytes more than the DEFAULT_LIMIT_REQUEST_LINE
184  * and DEFAULT_LIMIT_REQUEST_FIELDSIZE below, which explains the 8190.
185  * These two limits can be lowered or raised by the server config
186  * directives LimitRequestLine and LimitRequestFieldsize, respectively.
187  *
188  * DEFAULT_LIMIT_REQUEST_FIELDS can be modified or disabled (set = 0) by
189  * the server config directive LimitRequestFields.
190  */
191 
193 #ifndef DEFAULT_LIMIT_REQUEST_LINE
194 #define DEFAULT_LIMIT_REQUEST_LINE 8190
195 #endif
196 
197 #ifndef DEFAULT_LIMIT_REQUEST_FIELDSIZE
198 #define DEFAULT_LIMIT_REQUEST_FIELDSIZE 8190
199 #endif
200 
201 #ifndef DEFAULT_LIMIT_REQUEST_FIELDS
202 #define DEFAULT_LIMIT_REQUEST_FIELDS 100
203 #endif
204 
205 #ifndef DEFAULT_LIMIT_BLANK_LINES
206 #define DEFAULT_LIMIT_BLANK_LINES 10
207 #endif
208 
213 #define DEFAULT_ADD_DEFAULT_CHARSET_NAME "iso-8859-1"
214 
216 #define AP_SERVER_PROTOCOL "HTTP/1.1"
217 
218 
219 /* ------------------ stuff that modules are allowed to look at ----------- */
220 
222 #ifndef AP_DEFAULT_INDEX
223 #define AP_DEFAULT_INDEX "index.html"
224 #endif
225 
227 #ifndef AP_TYPES_CONFIG_FILE
228 #define AP_TYPES_CONFIG_FILE "conf/mime.types"
229 #endif
230 
231 /*
232  * Define the HTML doctype strings centrally.
233  */
235 #define DOCTYPE_HTML_2_0 "<!DOCTYPE HTML PUBLIC \"-//IETF//" \
236  "DTD HTML 2.0//EN\">\n"
237 
238 #define DOCTYPE_HTML_3_2 "<!DOCTYPE HTML PUBLIC \"-//W3C//" \
239  "DTD HTML 3.2 Final//EN\">\n"
240 
241 #define DOCTYPE_HTML_4_0S "<!DOCTYPE HTML PUBLIC \"-//W3C//" \
242  "DTD HTML 4.0//EN\"\n" \
243  "\"http://www.w3.org/TR/REC-html40/strict.dtd\">\n"
244 
245 #define DOCTYPE_HTML_4_0T "<!DOCTYPE HTML PUBLIC \"-//W3C//" \
246  "DTD HTML 4.0 Transitional//EN\"\n" \
247  "\"http://www.w3.org/TR/REC-html40/loose.dtd\">\n"
248 
249 #define DOCTYPE_HTML_4_0F "<!DOCTYPE HTML PUBLIC \"-//W3C//" \
250  "DTD HTML 4.0 Frameset//EN\"\n" \
251  "\"http://www.w3.org/TR/REC-html40/frameset.dtd\">\n"
252 
253 #define DOCTYPE_HTML_4_01 "<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.01//EN\" \"http://www.w3.org/TR/html4/strict.dtd\">\n"
254 
255 #define DOCTYPE_HTML_5 "<!DOCTYPE html>\n"
256 
257 #define DOCTYPE_XHTML_1_0S "<!DOCTYPE html PUBLIC \"-//W3C//" \
258  "DTD XHTML 1.0 Strict//EN\"\n" \
259  "\"http://www.w3.org/TR/xhtml1/DTD/" \
260  "xhtml1-strict.dtd\">\n"
261 
262 #define DOCTYPE_XHTML_1_0T "<!DOCTYPE html PUBLIC \"-//W3C//" \
263  "DTD XHTML 1.0 Transitional//EN\"\n" \
264  "\"http://www.w3.org/TR/xhtml1/DTD/" \
265  "xhtml1-transitional.dtd\">\n"
266 
267 #define DOCTYPE_XHTML_1_0F "<!DOCTYPE html PUBLIC \"-//W3C//" \
268  "DTD XHTML 1.0 Frameset//EN\"\n" \
269  "\"http://www.w3.org/TR/xhtml1/DTD/" \
270  "xhtml1-frameset.dtd\">"
271 
273 #define HTTP_VERSION(major,minor) (1000*(major)+(minor))
274 
275 #define HTTP_VERSION_MAJOR(number) ((number)/1000)
276 
277 #define HTTP_VERSION_MINOR(number) ((number)%1000)
278 
279 /* -------------- Port number for server running standalone --------------- */
280 
282 #define DEFAULT_HTTP_PORT 80
283 
284 #define DEFAULT_HTTPS_PORT 443
285 
291 #define ap_is_default_port(port,r) ((port) == ap_default_port(r))
292 
296 #define ap_default_port(r) ap_run_default_port(r)
297 
301 #define ap_http_scheme(r) ap_run_http_scheme(r)
302 
304 #define MAX_STRING_LEN HUGE_STRING_LEN
305 
307 #define HUGE_STRING_LEN 8192
308 
310 #define AP_IOBUFSIZE 8192
311 
313 #define AP_MAX_REG_MATCH 10
314 
321 #define AP_MAX_SENDFILE 16777216 /* 2^24 */
322 
329 #define APEXIT_OK 0x0
330 
331 #define APEXIT_INIT 0x2
332 
333 #define APEXIT_CHILDINIT 0x3
334 
339 #define APEXIT_CHILDSICK 0x7
340 
345 #define APEXIT_CHILDFATAL 0xf
346 
347 #ifndef AP_DECLARE
348 
353 # define AP_DECLARE(type) type
354 #endif
355 
356 #ifndef AP_DECLARE_NONSTD
357 
364 # define AP_DECLARE_NONSTD(type) type
365 #endif
366 #ifndef AP_DECLARE_DATA
367 # define AP_DECLARE_DATA
368 #endif
369 
370 #ifndef AP_MODULE_DECLARE
371 # define AP_MODULE_DECLARE(type) type
372 #endif
373 #ifndef AP_MODULE_DECLARE_NONSTD
374 # define AP_MODULE_DECLARE_NONSTD(type) type
375 #endif
376 #ifndef AP_MODULE_DECLARE_DATA
377 # define AP_MODULE_DECLARE_DATA
378 #endif
379 
384 #ifndef AP_CORE_DECLARE
385 # define AP_CORE_DECLARE AP_DECLARE
386 #endif
387 
393 #ifndef AP_CORE_DECLARE_NONSTD
394 # define AP_CORE_DECLARE_NONSTD AP_DECLARE_NONSTD
395 #endif
396 
401 #define AP_START_USERERR (APR_OS_START_USERERR + 2000)
402 #define AP_USERERR_LEN 1000
403 
405 #define AP_DECLINED (AP_START_USERERR + 0)
406 
413 typedef struct {
414  int major;
415  int minor;
416  int patch;
417  const char *add_string;
418 } ap_version_t;
419 
427 
434 AP_DECLARE(const char *) ap_get_server_banner(void);
435 
443 AP_DECLARE(const char *) ap_get_server_description(void);
444 
450 AP_DECLARE(void) ap_add_version_component(apr_pool_t *pconf, const char *component);
451 
456 AP_DECLARE(const char *) ap_get_server_built(void);
457 
458 /* non-HTTP status codes returned by hooks */
459 
460 #define OK 0
461 #define DECLINED -1
462 #define DONE -2
465 #define SUSPENDED -3
470 #define AP_NOBODY_WROTE -100
471 
473 #define AP_NOBODY_READ -101
474 
477 #define AP_FILTER_ERROR -102
478 
489 #define RESPONSE_CODES 103
490 
491 #define HTTP_CONTINUE 100
492 #define HTTP_SWITCHING_PROTOCOLS 101
493 #define HTTP_PROCESSING 102
494 #define HTTP_OK 200
495 #define HTTP_CREATED 201
496 #define HTTP_ACCEPTED 202
497 #define HTTP_NON_AUTHORITATIVE 203
498 #define HTTP_NO_CONTENT 204
499 #define HTTP_RESET_CONTENT 205
500 #define HTTP_PARTIAL_CONTENT 206
501 #define HTTP_MULTI_STATUS 207
502 #define HTTP_ALREADY_REPORTED 208
503 #define HTTP_IM_USED 226
504 #define HTTP_MULTIPLE_CHOICES 300
505 #define HTTP_MOVED_PERMANENTLY 301
506 #define HTTP_MOVED_TEMPORARILY 302
507 #define HTTP_SEE_OTHER 303
508 #define HTTP_NOT_MODIFIED 304
509 #define HTTP_USE_PROXY 305
510 #define HTTP_TEMPORARY_REDIRECT 307
511 #define HTTP_PERMANENT_REDIRECT 308
512 #define HTTP_BAD_REQUEST 400
513 #define HTTP_UNAUTHORIZED 401
514 #define HTTP_PAYMENT_REQUIRED 402
515 #define HTTP_FORBIDDEN 403
516 #define HTTP_NOT_FOUND 404
517 #define HTTP_METHOD_NOT_ALLOWED 405
518 #define HTTP_NOT_ACCEPTABLE 406
519 #define HTTP_PROXY_AUTHENTICATION_REQUIRED 407
520 #define HTTP_REQUEST_TIME_OUT 408
521 #define HTTP_CONFLICT 409
522 #define HTTP_GONE 410
523 #define HTTP_LENGTH_REQUIRED 411
524 #define HTTP_PRECONDITION_FAILED 412
525 #define HTTP_REQUEST_ENTITY_TOO_LARGE 413
526 #define HTTP_REQUEST_URI_TOO_LARGE 414
527 #define HTTP_UNSUPPORTED_MEDIA_TYPE 415
528 #define HTTP_RANGE_NOT_SATISFIABLE 416
529 #define HTTP_EXPECTATION_FAILED 417
530 #define HTTP_IM_A_TEAPOT 418
531 #define HTTP_MISDIRECTED_REQUEST 421
532 #define HTTP_UNPROCESSABLE_ENTITY 422
533 #define HTTP_LOCKED 423
534 #define HTTP_FAILED_DEPENDENCY 424
535 #define HTTP_TOO_EARLY 425
536 #define HTTP_UPGRADE_REQUIRED 426
537 #define HTTP_PRECONDITION_REQUIRED 428
538 #define HTTP_TOO_MANY_REQUESTS 429
539 #define HTTP_REQUEST_HEADER_FIELDS_TOO_LARGE 431
540 #define HTTP_UNAVAILABLE_FOR_LEGAL_REASONS 451
541 #define HTTP_INTERNAL_SERVER_ERROR 500
542 #define HTTP_NOT_IMPLEMENTED 501
543 #define HTTP_BAD_GATEWAY 502
544 #define HTTP_SERVICE_UNAVAILABLE 503
545 #define HTTP_GATEWAY_TIME_OUT 504
546 #define HTTP_VERSION_NOT_SUPPORTED 505
547 #define HTTP_VARIANT_ALSO_VARIES 506
548 #define HTTP_INSUFFICIENT_STORAGE 507
549 #define HTTP_LOOP_DETECTED 508
550 #define HTTP_NOT_EXTENDED 510
551 #define HTTP_NETWORK_AUTHENTICATION_REQUIRED 511
554 #define ap_is_HTTP_INFO(x) (((x) >= 100)&&((x) < 200))
555 
556 #define ap_is_HTTP_SUCCESS(x) (((x) >= 200)&&((x) < 300))
558 #define ap_is_HTTP_REDIRECT(x) (((x) >= 300)&&((x) < 400))
560 #define ap_is_HTTP_ERROR(x) (((x) >= 400)&&((x) < 600))
562 #define ap_is_HTTP_CLIENT_ERROR(x) (((x) >= 400)&&((x) < 500))
564 #define ap_is_HTTP_SERVER_ERROR(x) (((x) >= 500)&&((x) < 600))
566 #define ap_is_HTTP_VALID_RESPONSE(x) (((x) >= 100)&&((x) < 600))
569 #define ap_status_drops_connection(x) \
570  (((x) == HTTP_BAD_REQUEST) || \
571  ((x) == HTTP_REQUEST_TIME_OUT) || \
572  ((x) == HTTP_LENGTH_REQUIRED) || \
573  ((x) == HTTP_REQUEST_ENTITY_TOO_LARGE) || \
574  ((x) == HTTP_REQUEST_URI_TOO_LARGE) || \
575  ((x) == HTTP_INTERNAL_SERVER_ERROR) || \
576  ((x) == HTTP_SERVICE_UNAVAILABLE) || \
577  ((x) == HTTP_NOT_IMPLEMENTED))
578 
580 #define AP_STATUS_IS_HEADER_ONLY(x) ((x) == HTTP_NO_CONTENT || \
581  (x) == HTTP_NOT_MODIFIED)
582 
598 #define M_GET 0
599 #define M_PUT 1 /* : */
600 #define M_POST 2
601 #define M_DELETE 3
602 #define M_CONNECT 4
603 #define M_OPTIONS 5
604 #define M_TRACE 6
605 #define M_PATCH 7
606 #define M_PROPFIND 8
607 #define M_PROPPATCH 9 /* : */
608 #define M_MKCOL 10
609 #define M_COPY 11
610 #define M_MOVE 12
611 #define M_LOCK 13
612 #define M_UNLOCK 14
613 #define M_VERSION_CONTROL 15
614 #define M_CHECKOUT 16 /* : */
615 #define M_UNCHECKOUT 17
616 #define M_CHECKIN 18
617 #define M_UPDATE 19
618 #define M_LABEL 20
619 #define M_REPORT 21
620 #define M_MKWORKSPACE 22
621 #define M_MKACTIVITY 23
622 #define M_BASELINE_CONTROL 24
623 #define M_MERGE 25
624 /* Additional methods must be registered by the implementor, we have only
625  * room for 64 bit-wise methods available, so do not squander them (more of
626  * the above methods should probably move here)
627  */
628 /* #define M_BREW nn */
629 /* #define M_WHEN nn */
630 #define M_INVALID 26
638 #define METHODS 64
639 
647 #define AP_METHOD_BIT ((ap_method_mask_t)1)
648 
651 
659 struct ap_method_list_t {
661  ap_method_mask_t method_mask;
663  apr_array_header_t *method_list;
664 };
679 
685 #define AP_REQUEST_STRONG_ETAG 1 >> 0
686 
691 #define AP_REQUEST_GET_BNOTE(r, mask) \
692  ((mask) & ((r)->bnotes))
693 
698 #define AP_REQUEST_SET_BNOTE(r, mask, val) \
699  (r)->bnotes = (((r)->bnotes & ~(mask)) | (val))
700 
704 #define AP_REQUEST_IS_STRONG_ETAG(r) \
705  AP_REQUEST_GET_BNOTE((r), AP_REQUEST_STRONG_ETAG)
706 
714 #define CGI_MAGIC_TYPE "application/x-httpd-cgi"
715 
716 #define INCLUDES_MAGIC_TYPE "text/x-server-parsed-html"
718 #define INCLUDES_MAGIC_TYPE3 "text/x-server-parsed-html3"
720 #define DIR_MAGIC_TYPE "httpd/unix-directory"
722 #define AP_DEFAULT_HANDLER_NAME ""
723 #define AP_IS_DEFAULT_HANDLER_NAME(x) (*x == '\0')
724 
726 /* Just in case your linefeed isn't the one the other end is expecting. */
727 #if !APR_CHARSET_EBCDIC
728 
729 #define LF 10
730 
731 #define CR 13
733 #define CRLF "\015\012"
734 #else /* APR_CHARSET_EBCDIC */
735 /* For platforms using the EBCDIC charset, the transition ASCII->EBCDIC is done
736  * in the buff package (bread/bputs/bwrite). Everywhere else, we use
737  * "native EBCDIC" CR and NL characters. These are therefore
738  * defined as
739  * '\r' and '\n'.
740  */
741 #define CR '\r'
742 #define LF '\n'
743 #define CRLF "\r\n"
744 #endif /* APR_CHARSET_EBCDIC */
745 
746 #define CRLF_ASCII "\015\012"
747 #define ZERO_ASCII "\060"
748 
756 #define REQUEST_NO_BODY 0
757 
758 #define REQUEST_CHUNKED_ERROR 1
760 #define REQUEST_CHUNKED_DECHUNK 2
771 #define AP_REQ_ACCEPT_PATH_INFO 0
772 
773 #define AP_REQ_REJECT_PATH_INFO 1
775 #define AP_REQ_DEFAULT_PATH_INFO 2
780 /*
781  * Things which may vary per file-lookup WITHIN a request ---
782  * e.g., state of MIME config. Basically, the name of an object, info
783  * about the object, and any other info we may have which may need to
784  * change as we go poking around looking for it (e.g., overridden by
785  * .htaccess files).
786  *
787  * Note how the default state of almost all these things is properly
788  * zero, so that allocating it with pcalloc does the right thing without
789  * a whole lot of hairy initialization... so long as we are willing to
790  * make the (fairly) portable assumption that the bit pattern of a NULL
791  * pointer is, in fact, zero.
792  */
793 
798 struct htaccess_result {
800  const char *dir;
802  int override;
804  int override_opts;
806  apr_table_t *override_list;
808  struct ap_conf_vector_t *htaccess;
810  const struct htaccess_result *next;
811 };
812 
813 /* The following four types define a hierarchy of activities, so that
814  * given a request_rec r you can write r->connection->server->process
815  * to get to the process_rec. While this reduces substantially the
816  * number of arguments that various hooks require beware that in
817  * threaded versions of the server you must consider multiplexing
818  * issues. */
819 
820 
822 typedef struct process_rec process_rec;
824 typedef struct server_rec server_rec;
826 typedef struct conn_rec conn_rec;
828 typedef struct conn_slave_rec conn_slave_rec;
830 typedef struct request_rec request_rec;
832 typedef struct conn_state_t conn_state_t;
834 /* ### would be nice to not include this from httpd.h ... */
835 /* This comes after we have defined the request_rec type */
836 #include "apr_uri.h"
837 
841 struct process_rec {
843  apr_pool_t *pool;
845  apr_pool_t *pconf;
847  const char *short_name;
849  const char * const *argv;
851  int argc;
852 };
853 
857 struct request_rec {
859  apr_pool_t *pool;
861  conn_rec *connection;
863  server_rec *server;
866  request_rec *next;
868  request_rec *prev;
872  request_rec *main;
873 
874  /* Info about the request itself... we begin with stuff that only
875  * protocol.c should ever touch...
876  */
878  char *the_request;
880  int assbackwards;
885  int proxyreq;
887  int header_only;
889  int proto_num;
891  const char *protocol;
895  const char *hostname;
896 
898  apr_time_t request_time;
899 
901  const char *status_line;
903  int status;
905  /* Request method, two ways; also, protocol, etc.. Outside of protocol.c,
906  * look, but don't touch.
907  */
908 
910  int method_number;
912  const char *method;
934  ap_method_mask_t allowed;
936  apr_array_header_t *allowed_xmethods;
938  ap_method_list_t *allowed_methods;
941  apr_off_t sent_bodyct;
943  apr_off_t bytes_sent;
945  apr_time_t mtime;
947  /* HTTP/1.1 connection-level features */
950  const char *range;
952  apr_off_t clength;
954  int chunked;
959  int read_body;
961  int read_chunked;
963  unsigned expecting_100;
965  apr_bucket_brigade *kept_body;
967  /* XXX: ap_body_to_table has been removed. Remove body_table too or
968  * XXX: keep it to reintroduce ap_body_to_table without major bump? */
969  apr_table_t *body_table;
971  apr_off_t remaining;
973  apr_off_t read_length;
975  /* MIME header environments, in and out. Also, an array containing
976  * environment variables to be passed to subprocesses, so people can
977  * write modules to add to that environment.
978  *
979  * The difference between headers_out and err_headers_out is that the
980  * latter are printed even on error, and persist across internal redirects
981  * (so the headers printed for ErrorDocument handlers will have them).
982  *
983  * The 'notes' apr_table_t is for notes from one module to another, with no
984  * other set purpose in mind...
985  */
986 
988  apr_table_t *headers_in;
990  apr_table_t *headers_out;
993  apr_table_t *err_headers_out;
995  apr_table_t *subprocess_env;
997  apr_table_t *notes;
999  /* content_type, handler, content_encoding, and all content_languages
1000  * MUST be lowercased strings. They may be pointers to static strings;
1001  * they should not be modified in place.
1002  */
1004  const char *content_type; /* Break these out --- we dispatch on 'em */
1006  const char *handler; /* What we *really* dispatch on */
1009  const char *content_encoding;
1011  apr_array_header_t *content_languages;
1014  char *vlist_validator;
1015 
1017  char *user;
1019  char *ap_auth_type;
1021  /* What object is being requested (either directly, or via include
1022  * or content-negotiation mapping).
1023  */
1024 
1026  char *unparsed_uri;
1028  char *uri;
1030  char *filename;
1034  char *canonical_filename;
1036  char *path_info;
1038  char *args;
1048  int used_path_info;
1049 
1051  int eos_sent;
1052 
1053  /* Various other config info which may change with .htaccess files
1054  * These are config vectors, with one void* pointer for each module
1055  * (the thing pointed to being the module's business).
1056  */
1057 
1059  struct ap_conf_vector_t *per_dir_config;
1061  struct ap_conf_vector_t *request_config;
1066  const struct ap_logconf *log;
1067 
1071  const char *log_id;
1072 
1079  const struct htaccess_result *htaccess;
1080 
1082  struct ap_filter_t *output_filters;
1084  struct ap_filter_t *input_filters;
1088  struct ap_filter_t *proto_output_filters;
1091  struct ap_filter_t *proto_input_filters;
1092 
1094  int no_cache;
1096  int no_local_copy;
1101 #if APR_HAS_THREADS
1102  apr_thread_mutex_t *invoke_mtx;
1103 #endif
1104 
1106  apr_uri_t parsed_uri;
1108  apr_finfo_t finfo;
1114  apr_sockaddr_t *useragent_addr;
1115  char *useragent_ip;
1116 
1118  apr_table_t *trailers_in;
1120  apr_table_t *trailers_out;
1125  char *useragent_host;
1130  int double_reverse;
1135  int taint;
1140  unsigned int flushed:1;
1145  ap_request_bnotes_t bnotes;
1146 };
1147 
1158 #define PROXYREQ_NONE 0
1159 #define PROXYREQ_PROXY 1
1160 #define PROXYREQ_REVERSE 2
1161 #define PROXYREQ_RESPONSE 3
1163 /* @} */
1168 typedef enum {
1170  AP_CONN_CLOSE,
1174 /* For struct ap_filter and ap_filter_conn_ctx */
1175 #include "util_filter.h"
1176 
1180 struct conn_rec {
1182  apr_pool_t *pool;
1184  server_rec *base_server;
1186  void *vhost_lookup_data;
1188  /* Information about the connection itself */
1190  apr_sockaddr_t *local_addr;
1194  apr_sockaddr_t *client_addr;
1195 
1199  char *client_ip;
1203  char *remote_host;
1206  /* TODO: Remove from request_rec, make local to mod_ident */
1207  char *remote_logname;
1208 
1210  char *local_ip;
1213  char *local_host;
1214 
1216  long id;
1219  struct ap_conf_vector_t *conn_config;
1222  apr_table_t *notes;
1224  struct ap_filter_t *input_filters;
1226  struct ap_filter_t *output_filters;
1228  void *sbh;
1230  struct apr_bucket_alloc_t *bucket_alloc;
1232  conn_state_t *cs;
1237  unsigned int clogging_input_filters:1;
1238 
1241  signed int double_reverse:2;
1242 
1244  unsigned aborted;
1245 
1248  ap_conn_keepalive_e keepalive;
1249 
1251  int keepalives;
1252 
1255  const struct ap_logconf *log;
1256 
1260  const char *log_id;
1261 
1262 
1268 #if APR_HAS_THREADS
1269  apr_thread_t *current_thread;
1270 #endif
1271 
1273  apr_array_header_t *slaves;
1274 
1276  conn_rec *master;
1277 
1279  void *ctx;
1280 
1282  void *suspended_baton;
1283 
1286 
1288  struct ap_filter_conn_ctx *filter_conn_ctx;
1289 
1291  int async_filter;
1292 
1293  int outgoing;
1294 };
1295 
1297  conn_rec *c;
1298 };
1305 typedef enum {
1311  CONN_STATE_LINGER, /* connection may be closed with lingering */
1312  CONN_STATE_LINGER_NORMAL, /* MPM has started lingering close with normal timeout */
1313  CONN_STATE_LINGER_SHORT, /* MPM has started lingering close with short timeout */
1315  CONN_STATE_NUM /* Number of states (keep/kept last) */
1317 
1318 typedef enum {
1320  CONN_SENSE_WANT_READ, /* next event must be read */
1321  CONN_SENSE_WANT_WRITE /* next event must be write */
1327 struct conn_state_t {
1329  conn_state_e state;
1331  conn_sense_e sense;
1332 };
1333 
1334 /* Per-vhost config... */
1335 
1340 #define DEFAULT_VHOST_ADDR 0xfffffffful
1341 
1342 
1347 typedef struct server_addr_rec server_addr_rec;
1348 struct server_addr_rec {
1352  char *virthost;
1354  apr_sockaddr_t *host_addr;
1356  apr_port_t host_port;
1357 };
1358 
1359 struct ap_logconf {
1361  signed char *module_levels;
1364  int level;
1365 };
1369 struct server_rec {
1371  process_rec *process;
1373  server_rec *next;
1375  /* Log files --- note that transfer log is now in the modules... */
1378  char *error_fname;
1382  struct ap_logconf log;
1384  struct ap_errorlog_provider *errorlog_provider;
1386  void *errorlog_provider_handle;
1388  /* Module-specific configuration for server, and defaults... */
1392  struct ap_conf_vector_t *module_config;
1394  struct ap_conf_vector_t *lookup_defaults;
1397  const char *defn_name;
1399  unsigned defn_line_number;
1401  char is_virtual;
1403 
1404  /* Information for redirects */
1405 
1407  apr_port_t port;
1409  const char *server_scheme;
1411  /* Contact information */
1414  char *server_admin;
1416  char *server_hostname;
1418  /* Transaction handling */
1421  server_addr_rec *addrs;
1423  apr_interval_time_t timeout;
1425  apr_interval_time_t keep_alive_timeout;
1427  int keep_alive_max;
1429  int keep_alive;
1434  apr_array_header_t *wild_names;
1437  const char *path;
1439  int pathlen;
1442  int limit_req_line;
1444  int limit_req_fieldsize;
1446  int limit_req_fields;
1449  void *context;
1450 
1454  unsigned int keep_alive_timeout_set:1;
1455 };
1456 
1461 typedef struct ap_sload_t ap_sload_t;
1462 struct ap_sload_t {
1463  /* percentage of process/threads ready/idle (0->100)*/
1464  int idle;
1465  /* percentage of process/threads busy (0->100) */
1466  int busy;
1467  /* total bytes served */
1468  apr_off_t bytes_served;
1469  /* total access count */
1470  unsigned long access_count;
1471 };
1472 
1477 typedef struct ap_loadavg_t ap_loadavg_t;
1478 struct ap_loadavg_t {
1479  /* current loadavg, ala getloadavg() */
1480  float loadavg;
1481  /* 5 min loadavg */
1482  float loadavg5;
1483  /* 15 min loadavg */
1484  float loadavg15;
1485 };
1486 
1497 
1503 AP_DECLARE(const char *) ap_context_prefix(request_rec *r);
1504 
1513 AP_DECLARE(void) ap_set_context_info(request_rec *r, const char *prefix,
1514  const char *document_root);
1515 
1521 AP_DECLARE(void) ap_set_document_root(request_rec *r, const char *document_root);
1522 
1530 AP_DECLARE(char *) ap_field_noparam(apr_pool_t *p, const char *intype);
1531 
1540 AP_DECLARE(char *) ap_ht_time(apr_pool_t *p, apr_time_t t, const char *fmt, int gmt);
1541 
1542 /* String handling. The *_nc variants allow you to use non-const char **s as
1543  arguments (unfortunately C won't automatically convert a char ** to a const
1544  char **) */
1545 
1553 AP_DECLARE(char *) ap_getword(apr_pool_t *p, const char **line, char stop);
1554 
1563 AP_DECLARE(char *) ap_getword_nc(apr_pool_t *p, char **line, char stop);
1564 
1572 AP_DECLARE(char *) ap_getword_white(apr_pool_t *p, const char **line);
1573 
1582 AP_DECLARE(char *) ap_getword_white_nc(apr_pool_t *p, char **line);
1583 
1592 AP_DECLARE(char *) ap_getword_nulls(apr_pool_t *p, const char **line,
1593  char stop);
1594 
1604 AP_DECLARE(char *) ap_getword_nulls_nc(apr_pool_t *p, char **line, char stop);
1605 
1612 AP_DECLARE(char *) ap_getword_conf(apr_pool_t *p, const char **line);
1613 
1621 AP_DECLARE(char *) ap_getword_conf_nc(apr_pool_t *p, char **line);
1622 
1630 AP_DECLARE(char *) ap_getword_conf2(apr_pool_t *p, const char **line);
1631 
1640 AP_DECLARE(char *) ap_getword_conf2_nc(apr_pool_t *p, char **line);
1641 
1652 AP_DECLARE(const char *) ap_resolve_env(apr_pool_t *p, const char * word);
1653 
1663 AP_DECLARE(const char *) ap_size_list_item(const char **field, int *len);
1664 
1675 AP_DECLARE(char *) ap_get_list_item(apr_pool_t *p, const char **field);
1676 
1685 AP_DECLARE(int) ap_find_list_item(apr_pool_t *p, const char *line, const char *tok);
1686 
1694 AP_DECLARE(int) ap_find_etag_weak(apr_pool_t *p, const char *line, const char *tok);
1695 
1703 AP_DECLARE(int) ap_find_etag_strong(apr_pool_t *p, const char *line, const char *tok);
1704 
1705 /* Scan a string for field content chars, as defined by RFC7230 section 3.2
1706  * including VCHAR/obs-text, as well as HT and SP
1707  * @param ptr The string to scan
1708  * @return A pointer to the first (non-HT) ASCII ctrl character.
1709  * @note lws and trailing whitespace are scanned, the caller is responsible
1710  * for trimming leading and trailing whitespace
1711  */
1712 AP_DECLARE(const char *) ap_scan_http_field_content(const char *ptr);
1713 
1714 /* Scan a string for token characters, as defined by RFC7230 section 3.2.6
1715  * @param ptr The string to scan
1716  * @return A pointer to the first non-token character.
1717  */
1718 AP_DECLARE(const char *) ap_scan_http_token(const char *ptr);
1719 
1720 /* Scan a string for visible ASCII (0x21-0x7E) or obstext (0x80+)
1721  * and return a pointer to the first SP/CTL/NUL character encountered.
1722  * @param ptr The string to scan
1723  * @return A pointer to the first SP/CTL character.
1724  */
1725 AP_DECLARE(const char *) ap_scan_vchar_obstext(const char *ptr);
1726 
1740 AP_DECLARE(const char *) ap_parse_token_list_strict(apr_pool_t *p, const char *tok,
1741  apr_array_header_t **tokens,
1742  int skip_invalid);
1743 
1754 AP_DECLARE(char *) ap_get_token(apr_pool_t *p, const char **accept_line, int accept_white);
1755 
1763 AP_DECLARE(int) ap_find_token(apr_pool_t *p, const char *line, const char *tok);
1764 
1772 AP_DECLARE(int) ap_find_last_token(apr_pool_t *p, const char *line, const char *tok);
1773 
1779 AP_DECLARE(int) ap_is_url(const char *u);
1780 
1786 AP_DECLARE(int) ap_unescape_all(char *url);
1787 
1794 AP_DECLARE(int) ap_unescape_url(char *url);
1795 
1803 AP_DECLARE(int) ap_unescape_url_keep2f(char *url, int decode_slashes);
1804 
1811 AP_DECLARE(int) ap_unescape_urlencoded(char *query);
1812 
1818 AP_DECLARE(void) ap_no2slash(char *name)
1827 AP_DECLARE(void) ap_no2slash_ex(char *name, int is_fs_path)
1828  AP_FN_ATTR_NONNULL_ALL;
1829 
1830 #define AP_NORMALIZE_ALLOW_RELATIVE (1u << 0)
1831 #define AP_NORMALIZE_NOT_ABOVE_ROOT (1u << 1)
1832 #define AP_NORMALIZE_DECODE_UNRESERVED (1u << 2)
1833 #define AP_NORMALIZE_MERGE_SLASHES (1u << 3)
1834 #define AP_NORMALIZE_DROP_PARAMETERS (1u << 4)
1843 AP_DECLARE(int) ap_normalize_path(char *path, unsigned int flags)
1844  AP_FN_ATTR_NONNULL((1));
1845 
1851 AP_DECLARE(void) ap_getparents(char *name)
1852  AP_FN_ATTR_NONNULL_ALL;
1853 
1861 AP_DECLARE(char *) ap_escape_path_segment(apr_pool_t *p, const char *s)
1862  AP_FN_ATTR_NONNULL_ALL;
1863 
1871 AP_DECLARE(char *) ap_escape_path_segment_buffer(char *c, const char *s)
1872  AP_FN_ATTR_NONNULL_ALL;
1873 
1884 AP_DECLARE(char *) ap_os_escape_path(apr_pool_t *p, const char *path, int partial)
1885  AP_FN_ATTR_NONNULL_ALL;
1886 
1888 #define ap_escape_uri(ppool,path) ap_os_escape_path(ppool,path,1)
1889 
1897 AP_DECLARE(char *) ap_escape_urlencoded(apr_pool_t *p, const char *s)
1898  AP_FN_ATTR_NONNULL_ALL;
1899 
1907 AP_DECLARE(char *) ap_escape_urlencoded_buffer(char *c, const char *s)
1908  AP_FN_ATTR_NONNULL_ALL;
1909 
1917 #define ap_escape_html(p,s) ap_escape_html2(p,s,0)
1918 
1926 AP_DECLARE(char *) ap_escape_html2(apr_pool_t *p, const char *s, int toasc)
1927  AP_FN_ATTR_NONNULL_ALL;
1928 
1936 AP_DECLARE(char *) ap_escape_logitem(apr_pool_t *p, const char *str)
1937  AP_FN_ATTR_NONNULL((1));
1938 
1947 AP_DECLARE(apr_size_t) ap_escape_errorlog_item(char *dest, const char *source,
1948  apr_size_t buflen)
1949  AP_FN_ATTR_NONNULL((1));
1950 
1959 AP_DECLARE(char *) ap_construct_server(apr_pool_t *p, const char *hostname,
1960  apr_port_t port, const request_rec *r)
1961  AP_FN_ATTR_NONNULL((1,4));
1962 
1970 AP_DECLARE(char *) ap_escape_shell_cmd(apr_pool_t *p, const char *s)
1971  AP_FN_ATTR_NONNULL_ALL;
1972 
1978 AP_DECLARE(int) ap_count_dirs(const char *path)
1979  AP_FN_ATTR_NONNULL_ALL;
1980 
1992 AP_DECLARE(char *) ap_make_dirstr_prefix(char *d, const char *s, int n)
1993  AP_FN_ATTR_NONNULL_ALL;
1994 
2002 AP_DECLARE(char *) ap_make_dirstr_parent(apr_pool_t *p, const char *s)
2003  AP_FN_ATTR_NONNULL_ALL;
2004 
2018 AP_DECLARE(char *) ap_make_full_path(apr_pool_t *a, const char *dir, const char *f)
2019  AP_FN_ATTR_NONNULL_ALL;
2020 
2029 AP_DECLARE(int) ap_os_is_path_absolute(apr_pool_t *p, const char *dir)
2030  AP_FN_ATTR_NONNULL_ALL;
2031 
2039 AP_DECLARE(int) ap_is_matchexp(const char *str)
2040  AP_FN_ATTR_NONNULL_ALL;
2041 
2048 AP_DECLARE(int) ap_strcmp_match(const char *str, const char *expected)
2049  AP_FN_ATTR_NONNULL_ALL;
2050 
2058 AP_DECLARE(int) ap_strcasecmp_match(const char *str, const char *expected)
2059  AP_FN_ATTR_NONNULL_ALL;
2060 
2068 AP_DECLARE(char *) ap_strcasestr(const char *s1, const char *s2)
2069  AP_FN_ATTR_NONNULL_ALL;
2070 
2077 AP_DECLARE(const char *) ap_stripprefix(const char *bigstring,
2078  const char *prefix)
2079  AP_FN_ATTR_NONNULL_ALL;
2080 
2088 AP_DECLARE(char *) ap_pbase64decode(apr_pool_t *p, const char *bufcoded);
2089 
2108  const char *encoded,
2109  char **decoded,
2110  apr_size_t *len);
2111 
2119 AP_DECLARE(char *) ap_pbase64encode(apr_pool_t *p, char *string);
2120 
2134 AP_DECLARE(ap_regex_t *) ap_pregcomp(apr_pool_t *p, const char *pattern,
2135  int cflags);
2136 
2145 
2159 AP_DECLARE(char *) ap_pregsub(apr_pool_t *p, const char *input,
2160  const char *source, apr_size_t nmatch,
2161  ap_regmatch_t pmatch[]);
2162 
2177 AP_DECLARE(apr_status_t) ap_pregsub_ex(apr_pool_t *p, char **result,
2178  const char *input, const char *source,
2179  apr_size_t nmatch,
2180  ap_regmatch_t pmatch[],
2181  apr_size_t maxlen);
2182 
2188 AP_DECLARE(void) ap_content_type_tolower(char *s);
2189 
2194 AP_DECLARE(void) ap_str_tolower(char *s);
2195 
2200 AP_DECLARE(void) ap_str_toupper(char *s);
2201 
2209 AP_DECLARE(int) ap_ind(const char *str, char c); /* Sigh... */
2210 
2218 AP_DECLARE(int) ap_rind(const char *str, char c);
2219 
2227 AP_DECLARE(char *) ap_escape_quotes(apr_pool_t *p, const char *instring);
2228 
2239 AP_DECLARE(char *) ap_append_pid(apr_pool_t *p, const char *string,
2240  const char *delim);
2241 
2249 AP_DECLARE(int) ap_parse_strict_length(apr_off_t *len, const char *str);
2250 
2270  const char *timeout_parameter,
2271  apr_interval_time_t *timeout,
2272  const char *default_time_unit);
2273 
2281 
2283 #define AP_TAINT_HTACCESS 0x1
2284 
2292 
2304  const char **dest);
2305 
2315 AP_DECLARE(apr_status_t) ap_str2_alnum(const char *src, char *dest);
2316 
2325 typedef struct {
2326  const char *name;
2327  apr_bucket_brigade *value;
2341  apr_array_header_t **ptr,
2342  apr_size_t num, apr_size_t size);
2343 
2344 /* Misc system hackery */
2351 AP_DECLARE(int) ap_is_rdirectory(apr_pool_t *p, const char *name);
2352 
2359 AP_DECLARE(int) ap_is_directory(apr_pool_t *p, const char *name);
2360 
2361 #ifdef _OSD_POSIX
2362 extern int os_init_job_environment(server_rec *s, const char *user_name, int one_process);
2363 #endif /* _OSD_POSIX */
2364 
2370 char *ap_get_local_host(apr_pool_t *p);
2371 
2378 AP_DECLARE(void) ap_log_assert(const char *szExp, const char *szFile, int nLine)
2379  __attribute__((noreturn));
2380 
2384 #define ap_assert(exp) ((exp) ? (void)0 : ap_log_assert(#exp,__FILE__,__LINE__))
2385 
2393 #ifdef AP_DEBUG
2394 #define AP_DEBUG_ASSERT(exp) ap_assert(exp)
2395 #else
2396 #define AP_DEBUG_ASSERT(exp) ((void)0)
2397 #endif
2398 
2408 #define SIGSTOP_DETACH 1
2409 
2410 #define SIGSTOP_MAKE_CHILD 2
2412 #define SIGSTOP_SPAWN_CHILD 4
2414 #define SIGSTOP_PIPED_LOG_SPAWN 8
2416 #define SIGSTOP_CGI_CHILD 16
2419 #ifdef DEBUG_SIGSTOP
2420 extern int raise_sigstop_flags;
2421 #define RAISE_SIGSTOP(x) do { \
2422  if (raise_sigstop_flags & SIGSTOP_##x) raise(SIGSTOP);\
2423  } while (0)
2424 #else
2425 #define RAISE_SIGSTOP(x)
2426 #endif
2427 
2434 AP_DECLARE(const char *) ap_psignature(const char *prefix, request_rec *r);
2435 
2436  /* The C library has functions that allow const to be silently dropped ...
2437  these macros detect the drop in maintainer mode, but use the native
2438  methods for normal builds
2439 
2440  Note that on some platforms (e.g., AIX with gcc, Solaris with gcc), string.h needs
2441  to be included before the macros are defined or compilation will fail.
2442  */
2443 #include <string.h>
2444 
2445 AP_DECLARE(char *) ap_strchr(char *s, int c);
2446 AP_DECLARE(const char *) ap_strchr_c(const char *s, int c);
2447 AP_DECLARE(char *) ap_strrchr(char *s, int c);
2448 AP_DECLARE(const char *) ap_strrchr_c(const char *s, int c);
2449 AP_DECLARE(char *) ap_strstr(char *s, const char *c);
2450 AP_DECLARE(const char *) ap_strstr_c(const char *s, const char *c);
2453 
2454 #ifdef AP_DEBUG
2455 
2456 #undef strchr
2457 # define strchr(s, c) ap_strchr(s,c)
2458 #undef strrchr
2459 # define strrchr(s, c) ap_strrchr(s,c)
2460 #undef strstr
2461 # define strstr(s, c) ap_strstr(s,c)
2462 
2463 #if !defined(AP_DEBUG_NO_ALLOC_POISON) && !APR_POOL_DEBUG
2464 /*
2465  * ap_palloc_debug initializes allocated memory to non-zero
2466  */
2467 #define apr_palloc ap_palloc_debug
2468 /*
2469  * this is necessary to avoid useless double memset of memory
2470  * with ap_palloc_debug
2471  */
2472 #ifdef apr_pcalloc
2473 #undef apr_pcalloc
2474 #endif
2475 #define apr_pcalloc ap_pcalloc_debug
2476 #endif
2477 
2478 #else
2479 
2481 # define ap_strchr(s, c) strchr(s, c)
2482 
2483 # define ap_strchr_c(s, c) strchr(s, c)
2485 # define ap_strrchr(s, c) strrchr(s, c)
2487 # define ap_strrchr_c(s, c) strrchr(s, c)
2489 # define ap_strstr(s, c) strstr(s, c)
2491 # define ap_strstr_c(s, c) strstr(s, c)
2493 #endif
2504 AP_DECLARE(void) ap_random_insecure_bytes(void *buf, apr_size_t size);
2505 
2513 
2517 AP_DECLARE(void) ap_abort_on_oom(void) __attribute__((noreturn));
2518 
2525 AP_DECLARE(void *) ap_malloc(size_t size)
2528 
2536 AP_DECLARE(void *) ap_calloc(size_t nelem, size_t size)
2539 
2547 AP_DECLARE(void *) ap_realloc(void *ptr, size_t size)
2549  AP_FN_ATTR_ALLOC_SIZE(2);
2550 
2556  AP_FN_ATTR_NONNULL_ALL;
2557 
2563  AP_FN_ATTR_NONNULL_ALL;
2564 
2573 AP_DECLARE(void) ap_bin2hex(const void *src, apr_size_t srclen, char *dest)
2574  AP_FN_ATTR_NONNULL_ALL;
2575 
2589  const char *username,
2590  const char *passwd,
2591  const char *hash);
2592 
2602  const char *cmd,
2603  const char * const *argv);
2604 
2605 
2606 #define AP_NORESTART APR_OS_START_USEERR + 1
2607 
2618  const char *s,
2619  int start);
2620 
2628  const char *s);
2629 
2642 AP_DECLARE(int) ap_cstr_casecmp(const char *s1, const char *s2);
2643 
2656 AP_DECLARE(int) ap_cstr_casecmpn(const char *s1, const char *s2, apr_size_t n);
2657 
2661 #define AP_DIR_FLAG_NONE 0
2662 
2667 #define AP_DIR_FLAG_OPTIONAL 1
2668 
2673 #define AP_DIR_FLAG_RECURSIVE 2
2674 
2678 typedef struct ap_dir_match_t ap_dir_match_t;
2679 
2683 struct ap_dir_match_t {
2685  apr_pool_t *p;
2687  apr_pool_t *ptemp;
2689  const char *prefix;
2691  const char *(*cb)(ap_dir_match_t *w, const char *fname);
2693  void *ctx;
2695  int flags;
2697  unsigned int depth;
2698 };
2699 
2720 AP_DECLARE(const char *)ap_dir_nofnmatch(ap_dir_match_t *w, const char *fname)
2721  __attribute__((nonnull(1,2)));
2722 
2741 AP_DECLARE(const char *)ap_dir_fnmatch(ap_dir_match_t *w, const char *path,
2742  const char *fname) __attribute__((nonnull(1,3)));
2743 
2751 AP_DECLARE(int) ap_is_chunked(apr_pool_t *p, const char *line);
2752 
2753 #ifdef __cplusplus
2754 }
2755 #endif
2756 
2757 #endif /* !APACHE_HTTPD_H */
2758 
void void * ap_realloc(void *ptr, size_t size) AP_FN_ATTR_WARN_UNUSED_RESULT AP_FN_ATTR_ALLOC_SIZE(2)
size_t apr_size_t
Definition: apr.h:393
int major
Definition: httpd.h:414
ap_regex_t * ap_pregcomp(apr_pool_t *p, const char *pattern, int cflags)
char * ap_getword(apr_pool_t *p, const char **line, char stop)
int ap_os_is_path_absolute(apr_pool_t *p, const char *dir) AP_FN_ATTR_NONNULL_ALL
char * ap_pbase64encode(apr_pool_t *p, char *string)
char * ap_pregsub(apr_pool_t *p, const char *input, const char *source, apr_size_t nmatch, ap_regmatch_t pmatch[])
#define ap_strrchr_c(s, c)
Definition: httpd.h:2490
APR Network library.
const char * ap_context_prefix(request_rec *r)
char * ap_make_dirstr_parent(apr_pool_t *p, const char *s) AP_FN_ATTR_NONNULL_ALL
Definition: apr_arch_thread_mutex.h:28
Definition: apr_arch_file_io.h:107
Definition: httpd.h:1318
Definition: apr_tables.h:62
const char * ap_size_list_item(const char **field, int *len)
#define ap_strrchr(s, c)
Definition: httpd.h:2488
int ap_unescape_urlencoded(char *query)
char * ap_getword_conf(apr_pool_t *p, const char **line)
char * ap_getword_nc(apr_pool_t *p, char **line, char stop)
char * ap_pbase64decode(apr_pool_t *p, const char *bufcoded)
void * ap_palloc_debug(apr_pool_t *p, apr_size_t size)
apr_size_t ap_escape_errorlog_item(char *dest, const char *source, apr_size_t buflen) AP_FN_ATTR_NONNULL((1))
The representation of a filter chain.
Definition: util_filter.h:278
Definition: httpd.h:1312
A structure to be used for Per-vhost config.
Definition: httpd.h:1351
Definition: httpd.h:2686
apr_uint32_t ap_random_pick(apr_uint32_t min, apr_uint32_t max)
struct apr_bucket_alloc_t apr_bucket_alloc_t
Definition: apr_buckets.h:123
void ap_set_document_root(request_rec *r, const char *document_root)
apr_bucket_brigade request_rec apr_pool_t * pool
Definition: mod_dav.h:555
const char * ap_get_server_description(void)
char * ap_get_local_host(apr_pool_t *p)
#define AP_DECLARE(x)
Definition: macros.h:1
#define ap_strstr_c(s, c)
Definition: httpd.h:2494
char * ap_getword_conf_nc(apr_pool_t *p, char **line)
void ap_no2slash_ex(char *name, int is_fs_path) AP_FN_ATTR_NONNULL_ALL
void ap_bin2hex(const void *src, apr_size_t srclen, char *dest) AP_FN_ATTR_NONNULL_ALL
char * ap_make_dirstr_prefix(char *d, const char *s, int n) AP_FN_ATTR_NONNULL_ALL
const char * ap_get_server_banner(void)
APR Hash Tables.
Apache Regex defines.
AP_FN_ATTR_NONNULL((1, 2, 5)) AP_FN_ATTR_WARN_UNUSED_RESULT
int ap_cstr_casecmp(const char *s1, const char *s2)
This represents the result of calling htaccess; these are cached for each request.
Definition: httpd.h:801
#define ap_strchr_c(s, c)
Definition: httpd.h:2486
int ap_is_url(const char *u)
char * ap_escape_urlencoded(apr_pool_t *p, const char *s) AP_FN_ATTR_NONNULL_ALL
char * ap_get_list_item(apr_pool_t *p, const char **field)
Definition: httpd.h:1173
const char const char * uri
Definition: mod_dav.h:631
A structure that represents one process.
Definition: httpd.h:844
char * ap_getword_conf2(apr_pool_t *p, const char **line)
Definition: apr_buckets.h:258
The numeric version information is broken out into fields within this structure.
Definition: httpd.h:413
int handler(request_rec *r)
apr_status_t ap_pstr2_alnum(apr_pool_t *p, const char *src, const char **dest)
apr_int64_t apr_interval_time_t
Definition: apr_time.h:55
const char * prefix
Definition: mod_dav.h:631
APR Miscellaneous library routines.
int ap_parse_form_data(request_rec *r, struct ap_filter_t *f, apr_array_header_t **ptr, apr_size_t num, apr_size_t size)
APR Poll interface.
int ap_ind(const char *str, char c)
char * ap_escape_quotes(apr_pool_t *p, const char *instring)
int ap_strcmp_match(const char *str, const char *expected) AP_FN_ATTR_NONNULL_ALL
Structure to store things which are per connection.
Definition: httpd.h:1183
dav_lockdb const dav_resource int int depth
Definition: mod_dav.h:1442
Definition: httpd.h:1311
char * ap_ht_time(apr_pool_t *p, apr_time_t t, const char *fmt, int gmt)
Definition: httpd.h:1314
dav_buffer apr_size_t size
Definition: mod_dav.h:460
const char * ap_resolve_env(apr_pool_t *p, const char *word)
Symbol export macros and hook functions.
char * ap_escape_html2(apr_pool_t *p, const char *s, int toasc) AP_FN_ATTR_NONNULL_ALL
apr_status_t ap_pbase64decode_strict(apr_pool_t *p, const char *encoded, char **decoded, apr_size_t *len)
char * ap_getword_white_nc(apr_pool_t *p, char **line)
int ap_normalize_path(char *path, unsigned int flags) AP_FN_ATTR_NONNULL((1))
int ap_find_etag_weak(apr_pool_t *p, const char *line, const char *tok)
#define AP_FN_ATTR_NONNULL_ALL
Definition: ap_config.h:260
char * ap_getword_nulls(apr_pool_t *p, const char **line, char stop)
apr_int64_t apr_time_t
Definition: apr_time.h:45
conn_state_e
Definition: httpd.h:1308
APR memory allocation.
Definition: httpd.h:1299
const char * ap_stripprefix(const char *bigstring, const char *prefix) AP_FN_ATTR_NONNULL_ALL
int ap_parse_strict_length(apr_off_t *len, const char *str)
const char const char * ap_dir_fnmatch(ap_dir_match_t *w, const char *path, const char *fname) __attribute__((nonnull(1
uint64_t apr_uint64_t
Definition: apr.h:386
struct ap_conf_vector_t * htaccess
Definition: httpd.h:811
Definition: httpd.h:1313
A structure to store information for each virtual server.
Definition: httpd.h:1372
char * ap_getword_white(apr_pool_t *p, const char **line)
int ap_array_str_contains(const apr_array_header_t *array, const char *s)
int ap_find_etag_strong(apr_pool_t *p, const char *line, const char *tok)
const struct htaccess_result * next
Definition: httpd.h:813
A structure to contain connection state information.
Definition: httpd.h:1330
dav_error * src
Definition: mod_dav.h:186
char * ap_escape_path_segment(apr_pool_t *p, const char *s) AP_FN_ATTR_NONNULL_ALL
const char * add_string
Definition: httpd.h:417
const char * ap_scan_vchar_obstext(const char *ptr)
char * ap_escape_urlencoded_buffer(char *c, const char *s) AP_FN_ATTR_NONNULL_ALL
APR Table library.
const char * ap_context_document_root(request_rec *r)
int ap_array_str_index(const apr_array_header_t *array, const char *s, int start)
ap_conn_keepalive_e
Enumeration of connection keepalive options.
Definition: httpd.h:1171
Definition: apr_arch_threadproc.h:42
Definition: ap_regex.h:111
A structure to hold server load params.
Definition: httpd.h:1465
APR-UTIL Buckets/Bucket Brigades.
void ap_no2slash(char *name) AP_FN_ATTR_NONNULL_ALL
proxy_worker proxy_server_conf char * url
Definition: mod_proxy.h:637
const char * ap_parse_token_list_strict(apr_pool_t *p, const char *tok, apr_array_header_t **tokens, int skip_invalid)
char * ap_strcasestr(const char *s1, const char *s2) AP_FN_ATTR_NONNULL_ALL
int ap_unescape_all(char *url)
apr_status_t ap_password_validate(request_rec *r, const char *username, const char *passwd, const char *hash)
int ap_cstr_casecmpn(const char *s1, const char *s2, apr_size_t n)
int ap_unescape_url(char *url)
unsigned int apr_uint32_t
Definition: apr.h:347
APR Platform Definitions.
const char * ap_dir_nofnmatch(ap_dir_match_t *w, const char *fname) __attribute__((nonnull(1
void ap_pregfree(apr_pool_t *p, ap_regex_t *reg)
char * ap_make_full_path(apr_pool_t *a, const char *dir, const char *f) AP_FN_ATTR_NONNULL_ALL
char * ap_escape_path_segment_buffer(char *c, const char *s) AP_FN_ATTR_NONNULL_ALL
Definition: httpd.h:1315
void ap_abort_on_oom(void) __attribute__((noreturn))
Definition: httpd.h:1316
apr_uint64_t ap_method_mask_t
Definition: httpd.h:646
Definition: httpd.h:1310
Definition: apr_uri.h:85
void ap_add_version_component(apr_pool_t *pconf, const char *component)
void * ap_malloc(size_t size) __attribute__((malloc)) AP_FN_ATTR_ALLOC_SIZE(1)
void ap_log_assert(const char *szExp, const char *szFile, int nLine) __attribute__((noreturn))
int ap_unescape_url_keep2f(char *url, int decode_slashes)
apr_pool_t * p
Version Release defines.
int ap_find_token(apr_pool_t *p, const char *line, const char *tok)
Definition: httpd.h:1324
#define AP_FN_ATTR_ALLOC_SIZE(x)
Definition: ap_config.h:248
APR Thread and Process Library.
int ap_strcasecmp_match(const char *str, const char *expected) AP_FN_ATTR_NONNULL_ALL
char * ap_escape_logitem(apr_pool_t *p, const char *str) AP_FN_ATTR_NONNULL((1))
apr_status_t ap_timeout_parameter_parse(const char *timeout_parameter, apr_interval_time_t *timeout, const char *default_time_unit)
int ap_count_dirs(const char *path) AP_FN_ATTR_NONNULL_ALL
int ap_find_last_token(apr_pool_t *p, const char *line, const char *tok)
A structure that represents the current request.
Definition: httpd.h:860
int minor
Definition: httpd.h:415
char * ap_get_exec_line(apr_pool_t *p, const char *cmd, const char *const *argv)
Apache filter library.
Definition: httpd.h:1322
int ap_rind(const char *str, char c)
Structure for handling HTTP methods.
Definition: httpd.h:662
int ap_is_directory(apr_pool_t *p, const char *name)
A structure to hold various server loadavg.
Definition: httpd.h:1481
const char * ap_scan_http_field_content(const char *ptr)
void * ap_pcalloc_debug(apr_pool_t *p, apr_size_t size)
dav_buffer const char * str
Definition: mod_dav.h:464
void ap_content_type_tolower(char *s)
int status
Definition: mod_dav.h:141
int int const char dav_error * prev
Definition: mod_dav.h:170
Definition: httpd.h:1323
void ap_get_loadavg(ap_loadavg_t *ld) AP_FN_ATTR_NONNULL_ALL
int ap_is_matchexp(const char *str) AP_FN_ATTR_NONNULL_ALL
struct apr_table_t apr_table_t
Definition: apr_tables.h:56
#define __attribute__(__x)
Definition: apr.h:63
void ap_get_server_revision(ap_version_t *version)
const char * name
Definition: mod_dav.h:805
char * ap_field_noparam(apr_pool_t *p, const char *intype)
struct apr_pool_t apr_pool_t
Definition: apr_pools.h:60
const char * ap_auth_type(request_rec *r)
Definition: httpd.h:2328
apr_status_t ap_pregsub_ex(apr_pool_t *p, char **result, const char *input, const char *source, apr_size_t nmatch, ap_regmatch_t pmatch[], apr_size_t maxlen)
void ap_str_tolower(char *s)
Definition: ap_regex.h:118
const char const char int ap_is_chunked(apr_pool_t *p, const char *line)
int apr_status_t
Definition: apr_errno.h:44
char * ap_getword_conf2_nc(apr_pool_t *p, char **line)
Definition: httpd.h:1172
request_rec * r
Definition: mod_dav.h:518
char * ap_get_token(apr_pool_t *p, const char **accept_line, int accept_white)
#define ap_strstr(s, c)
Definition: httpd.h:2492
char * ap_getword_nulls_nc(apr_pool_t *p, char **line, char stop)
char * ap_construct_server(apr_pool_t *p, const char *hostname, apr_port_t port, const request_rec *r) AP_FN_ATTR_NONNULL((1
void ap_random_insecure_bytes(void *buf, apr_size_t size)
APR-UTIL URI Routines.
apr_uint16_t apr_port_t
Definition: apr_network_io.h:257
APR Time Library.
Module Magic Number.
apr_status_t ap_str2_alnum(const char *src, char *dest)
void ap_getparents(char *name) AP_FN_ATTR_NONNULL_ALL
conn_sense_e
Definition: httpd.h:1321
void ap_str_toupper(char *s)
struct ap_conf_vector_t ap_conf_vector_t
Definition: http_config.h:519
int ap_request_has_body(request_rec *r)
Definition: httpd.h:1362
void * ap_calloc(size_t nelem, size_t size) __attribute__((malloc)) AP_FN_ATTR_ALLOC_SIZE2(1
void error_log(const ap_errorlog_info *info, const char *errstr)
#define malloc(x)
Definition: apr_private.h:170
const char AP_FN_ATTR_WARN_UNUSED_RESULT
Definition: ssl_private.h:1119
dav_resource int dav_locktoken dav_response int flags
Definition: mod_dav.h:1452
void ap_get_sload(ap_sload_t *ld) AP_FN_ATTR_NONNULL_ALL
char char * ap_escape_shell_cmd(apr_pool_t *p, const char *s) AP_FN_ATTR_NONNULL_ALL
void ap_set_context_info(request_rec *r, const char *prefix, const char *document_root)
char * ap_os_escape_path(apr_pool_t *p, const char *path, int partial) AP_FN_ATTR_NONNULL_ALL
Definition: httpd.h:1174
apr_uint64_t ap_request_bnotes_t
Definition: httpd.h:681
int ap_request_tainted(request_rec *r, int flags)
int ap_find_list_item(apr_pool_t *p, const char *line, const char *tok)
off_t apr_off_t
Definition: apr.h:395
Definition: apr_file_info.h:174
int ap_is_rdirectory(apr_pool_t *p, const char *name)
int patch
Definition: httpd.h:416
#define ap_strchr(s, c)
Definition: httpd.h:2484
Definition: apr_network_io.h:266
#define AP_FN_ATTR_ALLOC_SIZE2(x, y)
Definition: ap_config.h:249
const char * ap_psignature(const char *prefix, request_rec *r)
char * ap_append_pid(apr_pool_t *p, const char *string, const char *delim)
const char * ap_scan_http_token(const char *ptr)
const char * ap_get_server_built(void)
Definition: http_core.h:932