1 /* ====================================================================
2 * Copyright (c) 1995-1997 The Apache Group. All rights reserved.
4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions
8 * 1. Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer.
11 * 2. Redistributions in binary form must reproduce the above copyright
12 * notice, this list of conditions and the following disclaimer in
13 * the documentation and/or other materials provided with the
16 * 3. All advertising materials mentioning features or use of this
17 * software must display the following acknowledgment:
18 * "This product includes software developed by the Apache Group
19 * for use in the Apache HTTP server project (http://www.apache.org/)."
21 * 4. The names "Apache Server" and "Apache Group" must not be used to
22 * endorse or promote products derived from this software without
23 * prior written permission.
25 * 5. Redistributions of any form whatsoever must retain the following
27 * "This product includes software developed by the Apache Group
28 * for use in the Apache HTTP server project (http://www.apache.org/)."
30 * THIS SOFTWARE IS PROVIDED BY THE APACHE GROUP ``AS IS'' AND ANY
31 * EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
32 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
33 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE APACHE GROUP OR
34 * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
35 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
36 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
37 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
38 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
39 * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
40 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
41 * OF THE POSSIBILITY OF SUCH DAMAGE.
42 * ====================================================================
44 * This software consists of voluntary contributions made by many
45 * individuals on behalf of the Apache Group and was originally based
46 * on public domain software written at the National Center for
47 * Supercomputing Applications, University of Illinois, Urbana-Champaign.
48 * For more information on the Apache Group and the Apache HTTP server
49 * project, please see <http://www.apache.org/>.
54 * httpd.h: header for simple (ha! not anymore) http daemon
57 /* Headers in which EVERYONE has an interest... */
63 /* ----------------------------- config dir ------------------------------ */
65 /* Define this to be the default server home dir. Anything later in this
66 * file with a relative pathname will have this added.
70 /* Set default for OS/2 file system */
71 #define HTTPD_ROOT "/os2httpd"
73 #define HTTPD_ROOT "/usr/local/etc/httpd"
77 #ifndef DOCUMENT_LOCATION
80 /* Set default for OS/2 file system */
81 #define DOCUMENT_LOCATION "/os2httpd/docs"
83 #define DOCUMENT_LOCATION "/usr/local/etc/httpd/htdocs"
87 /* Max. number of dynamically loaded modules */
88 #define DYNAMIC_MODULE_LIMIT 64
90 /* Default administrator's address */
91 #define DEFAULT_ADMIN "[no address given]"
94 * --------- You shouldn't have to edit anything below this line ----------
96 * Any modifications to any defaults not defined above should be done in the
97 * respective config. file.
102 /* -------------- Port number for server running standalone --------------- */
104 #define DEFAULT_PORT 80
106 /* --------- Default user name and group name running standalone ---------- */
107 /* --- These may be specified as numbers by placing a # before a number --- */
110 #define DEFAULT_USER "#-1"
112 #ifndef DEFAULT_GROUP
113 #define DEFAULT_GROUP "#-1"
116 /* The name of the log files */
117 #ifndef DEFAULT_XFERLOG
119 /* Set default for OS/2 file system */
120 #define DEFAULT_XFERLOG "logs/access.log"
122 #define DEFAULT_XFERLOG "logs/access_log"
124 #endif /* DEFAULT_XFERLOG */
125 #ifndef DEFAULT_ERRORLOG
127 /* Set default for OS/2 file system */
128 #define DEFAULT_ERRORLOG "logs/error.log"
130 #define DEFAULT_ERRORLOG "logs/error_log"
132 #endif /* DEFAULT_ERRORLOG */
133 #ifndef DEFAULT_PIDLOG
134 #define DEFAULT_PIDLOG "logs/httpd.pid"
136 #ifndef DEFAULT_SCOREBOARD
137 #define DEFAULT_SCOREBOARD "logs/apache_runtime_status"
139 #ifndef DEFAULT_LOCKFILE
140 #define DEFAULT_LOCKFILE "logs/accept.lock"
143 /* Define this to be what your HTML directory content files are called */
144 #define DEFAULT_INDEX "index.html"
146 /* Define this to 1 if you want fancy indexing, 0 otherwise */
147 #define DEFAULT_INDEXING 0
149 /* Define this to be what type you'd like returned for files with unknown */
151 #define DEFAULT_TYPE "text/plain"
153 /* Define this to be what your per-directory security files are called */
155 /* Set default for OS/2 file system */
156 #define DEFAULT_ACCESS_FNAME "htaccess"
158 #define DEFAULT_ACCESS_FNAME ".htaccess"
161 /* The name of the server config file */
162 #ifndef SERVER_CONFIG_FILE
163 #define SERVER_CONFIG_FILE "conf/httpd.conf"
166 #ifndef RESOURCE_CONFIG_FILE
167 /* The name of the document config file */
168 #define RESOURCE_CONFIG_FILE "conf/srm.conf"
171 #ifndef TYPES_CONFIG_FILE
172 /* The name of the MIME types file */
173 #define TYPES_CONFIG_FILE "conf/mime.types"
176 #ifndef ACCESS_CONFIG_FILE
177 /* The name of the access file */
178 #define ACCESS_CONFIG_FILE "conf/access.conf"
181 /* Whether we should enable rfc1413 identity checking */
182 #define DEFAULT_RFC1413 0
183 /* The default directory in user's home dir */
184 #define DEFAULT_USER_DIR "public_html"
186 /* The default path for CGI scripts if none is currently set */
188 #define DEFAULT_PATH "/bin:/usr/bin:/usr/ucb:/usr/bsd:/usr/local/bin"
191 /* The path to the Bourne shell, for parsed docs */
194 /* Set default for OS/2 file system */
195 #define SHELL_PATH "CMD.EXE"
197 #define SHELL_PATH "/bin/sh"
201 /* The path to the suExec wrapper, can be overridden in Configuration */
203 #define SUEXEC_BIN "/usr/local/etc/httpd/sbin/suexec"
206 /* The default string lengths */
207 #define MAX_STRING_LEN HUGE_STRING_LEN
208 #define HUGE_STRING_LEN 8192
210 /* The timeout for waiting for messages */
211 #define DEFAULT_TIMEOUT 300
213 /* The timeout for waiting for keepalive timeout until next request */
214 #define DEFAULT_KEEPALIVE_TIMEOUT 15
216 /* The number of requests to entertain per connection */
217 #define DEFAULT_KEEPALIVE 100
219 /* The size of the server's internal read-write buffers */
220 #define IOBUFSIZE 8192
222 /* Number of servers to spawn off by default --- also, if fewer than
223 * this free when the caretaker checks, it will spawn more.
225 #define DEFAULT_START_DAEMON 5
227 /* Maximum number of *free* server processes --- more than this, and
231 #define DEFAULT_MAX_FREE_DAEMON 10
233 /* Minimum --- fewer than this, and more will be created */
235 #define DEFAULT_MIN_FREE_DAEMON 5
237 /* Limit on the total --- clients will be locked out if more servers than
238 * this are needed. It is intended solely to keep the server from crashing
239 * when things get out of hand.
241 * We keep a hard maximum number of servers, for two reasons --- first off,
242 * in case something goes seriously wrong, we want to stop the fork bomb
243 * short of actually crashing the machine we're running on by filling some
244 * kernel table. Secondly, it keeps the size of the scoreboard file small
245 * enough that we can read the whole thing without worrying too much about
248 #ifndef HARD_SERVER_LIMIT
249 #define HARD_SERVER_LIMIT 256
252 /* Number of requests to try to handle in a single process. If <= 0,
253 * the children don't die off. That's the default here, since I'm still
254 * interested in finding and stanching leaks.
257 #define DEFAULT_MAX_REQUESTS_PER_CHILD 0
259 /* If you have altered Apache and wish to change the SERVER_VERSION
260 * identifier below, please keep to the HTTP specification. This states that
261 * the identification string should consist of product tokens with an optional
262 * slash and version designator. Sub-products which form a significant part
263 * of the application can be listed, separated by whitespace, by adding
264 * their product tokens to EXTRA_CFLAGS in the Configuration file like so.
266 * EXTRA_CFLAGS="-DSERVER_SUBVERSION="MrWidget/0.1-alpha"
268 * The tokens are listed in order of their significance for identifying the
271 * "Product tokens should be short and to the point -- use of them for
272 * advertizing or other non-essential information is explicitly forbidden."
274 * Example: "Apache/1.1.0 MrWidget/0.1-alpha"
277 #define SERVER_BASEVERSION "Apache/1.2.6" /* SEE COMMENTS ABOVE */
278 #ifdef SERVER_SUBVERSION
279 #define SERVER_VERSION SERVER_BASEVERSION " " SERVER_SUBVERSION
281 #define SERVER_VERSION SERVER_BASEVERSION
284 /* Numeric release version identifier: major minor bugfix betaseq
285 * Always increases along the same track as the source branch.
287 #define APACHE_RELEASE 1020600
289 #define SERVER_PROTOCOL "HTTP/1.1"
290 #define SERVER_SUPPORT "http://www.apache.org/"
292 #define DECLINED -1 /* Module declines to handle */
293 #define OK 0 /* Module has handled this stage. */
296 /* ----------------------- HTTP Status Codes ------------------------- */
298 #define RESPONSE_CODES 38
300 #define HTTP_CONTINUE 100
301 #define HTTP_SWITCHING_PROTOCOLS 101
303 #define HTTP_CREATED 201
304 #define HTTP_ACCEPTED 202
305 #define HTTP_NON_AUTHORITATIVE 203
306 #define HTTP_NO_CONTENT 204
307 #define HTTP_RESET_CONTENT 205
308 #define HTTP_PARTIAL_CONTENT 206
309 #define HTTP_MULTIPLE_CHOICES 300
310 #define HTTP_MOVED_PERMANENTLY 301
311 #define HTTP_MOVED_TEMPORARILY 302
312 #define HTTP_SEE_OTHER 303
313 #define HTTP_NOT_MODIFIED 304
314 #define HTTP_USE_PROXY 305
315 #define HTTP_BAD_REQUEST 400
316 #define HTTP_UNAUTHORIZED 401
317 #define HTTP_PAYMENT_REQUIRED 402
318 #define HTTP_FORBIDDEN 403
319 #define HTTP_NOT_FOUND 404
320 #define HTTP_METHOD_NOT_ALLOWED 405
321 #define HTTP_NOT_ACCEPTABLE 406
322 #define HTTP_PROXY_AUTHENTICATION_REQUIRED 407
323 #define HTTP_REQUEST_TIME_OUT 408
324 #define HTTP_CONFLICT 409
325 #define HTTP_GONE 410
326 #define HTTP_LENGTH_REQUIRED 411
327 #define HTTP_PRECONDITION_FAILED 412
328 #define HTTP_REQUEST_ENTITY_TOO_LARGE 413
329 #define HTTP_REQUEST_URI_TOO_LARGE 414
330 #define HTTP_UNSUPPORTED_MEDIA_TYPE 415
331 #define HTTP_INTERNAL_SERVER_ERROR 500
332 #define HTTP_NOT_IMPLEMENTED 501
333 #define HTTP_BAD_GATEWAY 502
334 #define HTTP_SERVICE_UNAVAILABLE 503
335 #define HTTP_GATEWAY_TIME_OUT 504
336 #define HTTP_VERSION_NOT_SUPPORTED 505
337 #define HTTP_VARIANT_ALSO_VARIES 506
339 #define DOCUMENT_FOLLOWS HTTP_OK
340 #define PARTIAL_CONTENT HTTP_PARTIAL_CONTENT
341 #define MULTIPLE_CHOICES HTTP_MULTIPLE_CHOICES
342 #define MOVED HTTP_MOVED_PERMANENTLY
343 #define REDIRECT HTTP_MOVED_TEMPORARILY
344 #define USE_LOCAL_COPY HTTP_NOT_MODIFIED
345 #define BAD_REQUEST HTTP_BAD_REQUEST
346 #define AUTH_REQUIRED HTTP_UNAUTHORIZED
347 #define FORBIDDEN HTTP_FORBIDDEN
348 #define NOT_FOUND HTTP_NOT_FOUND
349 #define METHOD_NOT_ALLOWED HTTP_METHOD_NOT_ALLOWED
350 #define NOT_ACCEPTABLE HTTP_NOT_ACCEPTABLE
351 #define LENGTH_REQUIRED HTTP_LENGTH_REQUIRED
352 #define PRECONDITION_FAILED HTTP_PRECONDITION_FAILED
353 #define SERVER_ERROR HTTP_INTERNAL_SERVER_ERROR
354 #define NOT_IMPLEMENTED HTTP_NOT_IMPLEMENTED
355 #define BAD_GATEWAY HTTP_BAD_GATEWAY
356 #define VARIANT_ALSO_VARIES HTTP_VARIANT_ALSO_VARIES
358 #define is_HTTP_INFO(x) (((x) >= 100)&&((x) < 200))
359 #define is_HTTP_SUCCESS(x) (((x) >= 200)&&((x) < 300))
360 #define is_HTTP_REDIRECT(x) (((x) >= 300)&&((x) < 400))
361 #define is_HTTP_ERROR(x) (((x) >= 400)&&((x) < 600))
362 #define is_HTTP_CLIENT_ERROR(x) (((x) >= 400)&&((x) < 500))
363 #define is_HTTP_SERVER_ERROR(x) (((x) >= 500)&&((x) < 600))
365 #define status_drops_connection(x) (((x) == HTTP_BAD_REQUEST) || \
366 ((x) == HTTP_REQUEST_TIME_OUT) || \
367 ((x) == HTTP_LENGTH_REQUIRED) || \
368 ((x) == HTTP_REQUEST_ENTITY_TOO_LARGE) || \
369 ((x) == HTTP_REQUEST_URI_TOO_LARGE) || \
370 ((x) == HTTP_INTERNAL_SERVER_ERROR) || \
371 ((x) == HTTP_SERVICE_UNAVAILABLE))
384 #define CGI_MAGIC_TYPE "application/x-httpd-cgi"
385 #define INCLUDES_MAGIC_TYPE "text/x-server-parsed-html"
386 #define INCLUDES_MAGIC_TYPE3 "text/x-server-parsed-html3"
387 #define MAP_FILE_MAGIC_TYPE "application/x-type-map"
388 #define ASIS_MAGIC_TYPE "httpd/send-as-is"
389 #define DIR_MAGIC_TYPE "httpd/unix-directory"
390 #define STATUS_MAGIC_TYPE "application/x-httpd-status"
392 /* Just in case your linefeed isn't the one the other end is expecting. */
396 /* Possible values for request_rec.read_body (set by handling module):
397 * REQUEST_NO_BODY Send 413 error if message has any body
398 * REQUEST_CHUNKED_ERROR Send 411 error if body without Content-Length
399 * REQUEST_CHUNKED_DECHUNK If chunked, remove the chunks for me.
400 * REQUEST_CHUNKED_PASS Pass the chunks to me without removal.
402 #define REQUEST_NO_BODY 0
403 #define REQUEST_CHUNKED_ERROR 1
404 #define REQUEST_CHUNKED_DECHUNK 2
405 #define REQUEST_CHUNKED_PASS 3
407 /* Things which may vary per file-lookup WITHIN a request ---
408 * e.g., state of MIME config. Basically, the name of an object, info
409 * about the object, and any other info we may ahve which may need to
410 * change as we go poking around looking for it (e.g., overridden by
413 * Note how the default state of almost all these things is properly
414 * zero, so that allocating it with pcalloc does the right thing without
415 * a whole lot of hairy initialization... so long as we are willing to
416 * make the (fairly) portable assumption that the bit pattern of a NULL
417 * pointer is, in fact, zero.
420 /* This represents the result of calling htaccess; these are cached for
423 struct htaccess_result
{
424 char *dir
; /* the directory to which this applies */
425 int override
; /* the overrides allowed for the .htaccess file */
426 void *htaccess
; /* the configuration directives */
427 /* the next one, or NULL if no more; N.B. never change this */
428 const struct htaccess_result
*next
;
432 typedef struct afs_conn_rec conn_rec
;
433 typedef struct server_rec server_rec
;
434 typedef struct request_rec request_rec
;
435 typedef struct listen_rec listen_rec
;
440 conn_rec
*connection
;
443 request_rec
*next
; /* If we wind up getting redirected,
444 * pointer to the request we redirected to.
446 request_rec
*prev
; /* If this is an internal redirect,
447 * pointer to where we redirected *from*.
450 request_rec
*main
; /* If this is a sub_request (see request.h)
451 * pointer back to the main request.
454 /* Info about the request itself... we begin with stuff that only
455 * protocol.c should ever touch...
458 char *the_request
; /* First line of request, so we can log it */
459 int assbackwards
; /* HTTP/0.9, "simple" request */
460 int proxyreq
; /* A proxy request */
461 int header_only
; /* HEAD request, as opposed to GET */
462 char *protocol
; /* Protocol, as given to us, or HTTP/0.9 */
463 int proto_num
; /* Number version of protocol; 1.1 = 1001 */
464 char *hostname
; /* Host, as set by full URI or Host: */
465 int hostlen
; /* Length of http://host:port in full URI */
467 time_t request_time
; /* When the request started */
469 char *status_line
; /* Status line, if set by script */
470 int status
; /* In any case */
472 /* Request method, two ways; also, protocol, etc.. Outside of protocol.c,
473 * look, but don't touch.
476 char *method
; /* GET, HEAD, POST, etc. */
477 int method_number
; /* M_GET, M_POST, etc. */
478 int allowed
; /* Allowed methods - for 405, OPTIONS, etc */
480 int sent_bodyct
; /* byte count in stream is for body */
481 long bytes_sent
; /* body byte count, for easy access */
483 /* HTTP/1.1 connection-level features */
485 int chunked
; /* sending chunked transfer-coding */
486 int byterange
; /* number of byte ranges */
487 char *boundary
; /* multipart/byteranges boundary */
488 char *range
; /* The Range: header */
489 long clength
; /* The "real" content length */
491 long remaining
; /* bytes left to read */
492 long read_length
; /* bytes that have been read */
493 int read_body
; /* how the request body should be read */
494 int read_chunked
; /* reading chunked transfer-coding */
496 /* MIME header environments, in and out. Also, an array containing
497 * environment variables to be passed to subprocesses, so people can
498 * write modules to add to that environment.
500 * The difference between headers_out and err_headers_out is that the
501 * latter are printed even on error, and persist across internal redirects
502 * (so the headers printed for ErrorDocument handlers will have them).
504 * The 'notes' table is for notes from one module to another, with no
505 * other set purpose in mind...
510 table
*err_headers_out
;
511 table
*subprocess_env
;
514 char *content_type
; /* Break these out --- we dispatch on 'em */
515 char *handler
; /* What we *really* dispatch on */
517 char *content_encoding
;
518 char *content_language
; /* for back-compat. only -- do not use */
519 array_header
*content_languages
; /* array of (char*) */
524 /* What object is being requested (either directly, or via include
525 * or content-negotiation mapping).
528 char *uri
; /* complete URI for a proxy req, or
529 * URL path for a non-proxy req */
532 char *args
; /* QUERY_ARGS, if any */
533 struct stat finfo
; /* ST_MODE set to zero if no such file */
535 /* Various other config info which may change with .htaccess files
536 * These are config vectors, with one void* pointer for each module
537 * (the thing pointed to being the module's business).
540 void *per_dir_config
; /* Options set in config files, etc. */
541 void *request_config
; /* Notes on *this* request */
544 * a linked list of the configuration directives in the .htaccess files
545 * accessed by this request.
546 * N.B. always add to the head of the list, _never_ to the end.
547 * that way, a sub request's list can (temporarily) point to a parent's list
549 const struct htaccess_result
*htaccess
;
553 /* Things which are per connection
556 struct afs_conn_rec
{
560 server_rec
*base_server
; /* Physical vhost this conn come in on */
562 /* Information about the connection itself */
564 int child_num
; /* The number of the child handling conn_rec */
565 BUFF
*client
; /* Connetion to the guy */
566 int aborted
; /* Are we still talking? */
568 /* Who is the client? */
570 struct sockaddr_in local_addr
; /* local address */
571 struct sockaddr_in remote_addr
; /* remote address */
572 char *remote_ip
; /* Client's IP address */
573 char *remote_host
; /* Client's DNS name, if known.
574 * NULL if DNS hasn't been checked,
575 * "" if it has and no address was found.
576 * N.B. Only access this though
577 * get_remote_host() */
578 char *remote_logname
; /* Only ever set if doing rfc1413 lookups.
579 * N.B. Only access this through
580 * get_remote_logname() */
581 char *user
; /* If an authentication check was made,
582 * this gets set to the user name. We assume
583 * that there's only one user per connection(!)
585 char *auth_type
; /* Ditto. */
587 int keepalive
; /* Are we using HTTP Keep-Alive? */
588 int keptalive
; /* Did we use HTTP Keep-Alive? */
589 int keepalives
; /* How many times have we used it? */
592 /* Per-vhost config... */
594 /* The address 255.255.255.255, when used as a virtualhost address,
595 * will become the "default" server when the ip doesn't match other vhosts.
597 #define DEFAULT_VHOST_ADDR 0xfffffffful
599 typedef struct server_addr_rec server_addr_rec
;
600 struct server_addr_rec
{
601 server_addr_rec
*next
;
602 struct in_addr host_addr
; /* The bound address, for this server */
603 unsigned short host_port
; /* The bound port, for this server */
604 char *virthost
; /* The name given in <VirtualHost> */
612 /* Full locations of server config info */
615 char *access_confname
;
617 /* Contact information */
620 char *server_hostname
;
621 unsigned short port
; /* for redirects, etc. */
623 /* Log files --- note that transfer log is now in the modules... */
628 /* Module-specific configuration for server, and defaults... */
630 int is_virtual
; /* true if this is the virtual server */
631 void *module_config
; /* Config vector containing pointers to
632 * modules' per-server config structures.
634 void *lookup_defaults
; /* MIME type info, etc., before we start
635 * checking per-directory info.
637 /* Transaction handling */
639 server_addr_rec
*addrs
;
640 int timeout
; /* Timeout, in seconds, before we give up */
641 int keep_alive_timeout
; /* Seconds we'll wait for another request */
642 int keep_alive_max
; /* Maximum requests per connection */
643 int keep_alive
; /* Use persistent connections? */
644 int send_buffer_size
; /* size of TCP send buffer (in bytes) */
646 char *path
; /* Pathname for ServerPath */
647 int pathlen
; /* Length of path */
649 char *names
; /* Wildcarded names for ServerAlias servers */
651 uid_t server_uid
; /* effective user id when calling exec wrapper */
652 gid_t server_gid
; /* effective group id when calling exec wrapper */
655 /* These are more like real hosts than virtual hosts */
658 struct sockaddr_in local_addr
; /* local IP address and port */
660 int used
; /* Only used during restart */
661 /* more stuff here, like which protocol is bound to the port */
664 /* Prototypes for utilities... util.c.
668 extern const char month_snames
[12][4];
670 struct tm
*get_gmtoff(int *tz
);
672 char *ht_time(pool
* p
, time_t t
, const char *fmt
, int gmt
);
673 char *gm_timestr_822(pool
* p
, time_t t
);
675 /* String handling. The *_nc variants allow you to use non-const char **s as
676 arguments (unfortunately C won't automatically convert a char ** to a const
679 char *getword(pool
* p
, const char **line
, char stop
);
680 char *getword_nc(pool
* p
, char **line
, char stop
);
681 char *getword_white(pool
* p
, const char **line
);
682 char *getword_white_nc(pool
* p
, char **line
);
683 char *getword_nulls(pool
* p
, const char **line
, char stop
);
684 char *getword_nulls_nc(pool
* p
, char **line
, char stop
);
685 char *getword_conf(pool
* p
, const char **line
);
686 char *getword_conf_nc(pool
* p
, char **line
);
688 char *get_token(pool
* p
, char **accept_line
, int accept_white
);
689 int find_token(pool
* p
, const char *line
, const char *tok
);
690 int find_last_token(pool
* p
, const char *line
, const char *tok
);
692 int is_url(const char *u
);
693 extern int unescape_url(char *url
);
694 void no2slash(char *name
);
695 void getparents(char *name
);
696 char *escape_path_segment(pool
* p
, const char *s
);
697 char *os_escape_path(pool
* p
, const char *path
, int partial
);
698 #define escape_uri(ppool,path) os_escape_path(ppool,path,1)
699 extern char *escape_html(pool
* p
, const char *s
);
700 char *construct_server(pool
* p
, const char *hostname
, unsigned port
);
701 char *construct_url(pool
* p
, const char *path
, const server_rec
* s
);
702 char *escape_shell_cmd(pool
* p
, const char *s
);
704 int count_dirs(const char *path
);
705 char *make_dirstr(pool
* a
, const char *s
, int n
);
706 char *make_full_path(pool
* a
, const char *dir
, const char *f
);
708 int is_matchexp(const char *str
);
709 int strcmp_match(const char *str
, const char *exp
);
710 int strcasecmp_match(const char *str
, const char *exp
);
711 char *uudecode(pool
*, const char *);
713 char *pregsub(pool
* p
, const char *input
, const char *source
, size_t nmatch
,
714 regmatch_t pmatch
[]);
716 void str_tolower(char *);
717 int ind(const char *, char); /* Sigh... */
718 int rind(const char *, char);
720 int cfg_getline(char *s
, int n
, FILE * f
);
723 char *strerror(int err
);
726 /* Misc system hackery */
728 uid_t
uname2id(const char *name
);
729 gid_t
gname2id(const char *name
);
730 int is_directory(const char *name
);
731 int can_exec(const struct stat
*);
732 void chdir_file(const char *file
);
734 char *get_local_host(pool
*);
735 unsigned long get_virthost_addr(const char *hostname
, unsigned short *port
);
737 extern time_t restart_time
;
740 * Apache tries to keep all of its long term filehandles (such as log files,
741 * and sockets) above this number. This is to workaround problems in many
742 * third party libraries that are compiled with a small FD_SETSIZE. There
743 * should be no reason to lower this, because it's only advisory. If a file
744 * can't be allocated above this number then it will remain in the "slack"
747 * Only the low slack line is used by default. If HIGH_SLACK_LINE is defined
748 * then an attempt is also made to keep all non-FILE * files above the high
749 * slack line. This is to work around a Solaris C library limitation, where it
750 * uses an unsigned char to store the file descriptor.
752 #ifndef LOW_SLACK_LINE
753 #define LOW_SLACK_LINE 15
755 /* #define HIGH_SLACK_LINE 255 */
758 * The ap_slack() function takes a fd, and tries to move it above the indicated
759 * line. It returns an fd which may or may not have moved above the line, and
760 * never fails. If the high line was requested and it fails it will also try
763 int ap_slack(int fd
, int line
);
764 #define AP_SLACK_LOW 1
765 #define AP_SLACK_HIGH 2