Google
 

include/httpd.h

Go to the documentation of this file.
00001 /* Licensed to the Apache Software Foundation (ASF) under one or more
00002  * contributor license agreements.  See the NOTICE file distributed with
00003  * this work for additional information regarding copyright ownership.
00004  * The ASF licenses this file to You under the Apache License, Version 2.0
00005  * (the "License"); you may not use this file except in compliance with
00006  * the License.  You may obtain a copy of the License at
00007  *
00008  *     http://www.apache.org/licenses/LICENSE-2.0
00009  *
00010  * Unless required by applicable law or agreed to in writing, software
00011  * distributed under the License is distributed on an "AS IS" BASIS,
00012  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
00013  * See the License for the specific language governing permissions and
00014  * limitations under the License.
00015  */
00016 
00035 #ifndef APACHE_HTTPD_H
00036 #define APACHE_HTTPD_H
00037 
00038 /* XXX - We need to push more stuff to other .h files, or even .c files, to
00039  * make this file smaller
00040  */
00041 
00042 /* Headers in which EVERYONE has an interest... */
00043 #include "ap_config.h"
00044 #include "ap_mmn.h"
00045 
00046 #include "ap_release.h"
00047 
00048 #include "apr.h"
00049 #include "apr_general.h"
00050 #include "apr_tables.h"
00051 #include "apr_pools.h"
00052 #include "apr_time.h"
00053 #include "apr_network_io.h"
00054 #include "apr_buckets.h"
00055 #include "apr_poll.h"
00056 
00057 #include "os.h"
00058 
00059 #include "ap_regex.h"
00060 
00061 #if APR_HAVE_STDLIB_H
00062 #include <stdlib.h>
00063 #endif
00064 
00065 /* Note: apr_uri.h is also included, see below */
00066 
00067 #ifdef __cplusplus
00068 extern "C" {
00069 #endif
00070 
00071 #ifdef CORE_PRIVATE
00072 
00073 /* ----------------------------- config dir ------------------------------ */
00074 
00078 #ifndef HTTPD_ROOT
00079 #ifdef OS2
00080 
00081 #define HTTPD_ROOT "/os2httpd"
00082 #elif defined(WIN32)
00083 
00084 #define HTTPD_ROOT "/apache"
00085 #elif defined (BEOS)
00086 
00087 #define HTTPD_ROOT "/boot/home/apache"
00088 #elif defined (NETWARE)
00089 
00090 #define HTTPD_ROOT "/apache"
00091 #else
00092 
00093 #define HTTPD_ROOT "/usr/local/apache"
00094 #endif
00095 #endif /* HTTPD_ROOT */
00096 
00097 /* 
00098  * --------- You shouldn't have to edit anything below this line ----------
00099  *
00100  * Any modifications to any defaults not defined above should be done in the 
00101  * respective configuration file. 
00102  *
00103  */
00104 
00109 #ifndef DOCUMENT_LOCATION
00110 #ifdef OS2
00111 /* Set default for OS/2 file system */
00112 #define DOCUMENT_LOCATION  HTTPD_ROOT "/docs"
00113 #else
00114 /* Set default for non OS/2 file system */
00115 #define DOCUMENT_LOCATION  HTTPD_ROOT "/htdocs"
00116 #endif
00117 #endif /* DOCUMENT_LOCATION */
00118 
00120 #ifndef DYNAMIC_MODULE_LIMIT
00121 #define DYNAMIC_MODULE_LIMIT 128
00122 #endif
00123 
00125 #define DEFAULT_ADMIN "[no address given]"
00126 
00128 #ifndef DEFAULT_ERRORLOG
00129 #if defined(OS2) || defined(WIN32)
00130 #define DEFAULT_ERRORLOG "logs/error.log"
00131 #else
00132 #define DEFAULT_ERRORLOG "logs/error_log"
00133 #endif
00134 #endif /* DEFAULT_ERRORLOG */
00135 
00137 #ifndef DEFAULT_ACCESS_FNAME
00138 #ifdef OS2
00139 /* Set default for OS/2 file system */
00140 #define DEFAULT_ACCESS_FNAME "htaccess"
00141 #else
00142 #define DEFAULT_ACCESS_FNAME ".htaccess"
00143 #endif
00144 #endif /* DEFAULT_ACCESS_FNAME */
00145 
00147 #ifndef SERVER_CONFIG_FILE
00148 #define SERVER_CONFIG_FILE "conf/httpd.conf"
00149 #endif
00150 
00152 #ifndef DEFAULT_PATH
00153 #define DEFAULT_PATH "/bin:/usr/bin:/usr/ucb:/usr/bsd:/usr/local/bin"
00154 #endif
00155 
00157 #ifndef SUEXEC_BIN
00158 #define SUEXEC_BIN  HTTPD_ROOT "/bin/suexec"
00159 #endif
00160 
00162 #ifndef DEFAULT_TIMEOUT
00163 #define DEFAULT_TIMEOUT 300 
00164 #endif
00165 
00167 #ifndef DEFAULT_KEEPALIVE_TIMEOUT
00168 #define DEFAULT_KEEPALIVE_TIMEOUT 5
00169 #endif
00170 
00172 #ifndef DEFAULT_KEEPALIVE
00173 #define DEFAULT_KEEPALIVE 100
00174 #endif
00175 
00176 /*
00177  * Limits on the size of various request items.  These limits primarily
00178  * exist to prevent simple denial-of-service attacks on a server based
00179  * on misuse of the protocol.  The recommended values will depend on the
00180  * nature of the server resources -- CGI scripts and database backends
00181  * might require large values, but most servers could get by with much
00182  * smaller limits than we use below.  The request message body size can
00183  * be limited by the per-dir config directive LimitRequestBody.
00184  *
00185  * Internal buffer sizes are two bytes more than the DEFAULT_LIMIT_REQUEST_LINE
00186  * and DEFAULT_LIMIT_REQUEST_FIELDSIZE below, which explains the 8190.
00187  * These two limits can be lowered (but not raised) by the server config
00188  * directives LimitRequestLine and LimitRequestFieldsize, respectively.
00189  *
00190  * DEFAULT_LIMIT_REQUEST_FIELDS can be modified or disabled (set = 0) by
00191  * the server config directive LimitRequestFields.
00192  */
00193 
00195 #ifndef DEFAULT_LIMIT_REQUEST_LINE
00196 #define DEFAULT_LIMIT_REQUEST_LINE 8190
00197 #endif 
00198 
00199 #ifndef DEFAULT_LIMIT_REQUEST_FIELDSIZE
00200 #define DEFAULT_LIMIT_REQUEST_FIELDSIZE 8190
00201 #endif 
00202 
00203 #ifndef DEFAULT_LIMIT_REQUEST_FIELDS
00204 #define DEFAULT_LIMIT_REQUEST_FIELDS 100
00205 #endif 
00206 
00211 #define DEFAULT_ADD_DEFAULT_CHARSET_NAME "iso-8859-1"
00212 
00213 #endif /* CORE_PRIVATE */
00214 
00216 #define AP_SERVER_PROTOCOL "HTTP/1.1"
00217 
00218 
00219 /* ------------------ stuff that modules are allowed to look at ----------- */
00220 
00222 #ifndef AP_DEFAULT_INDEX
00223 #define AP_DEFAULT_INDEX "index.html"
00224 #endif
00225 
00226 
00232 #ifndef DEFAULT_CONTENT_TYPE
00233 #define DEFAULT_CONTENT_TYPE "text/plain"
00234 #endif
00235 
00237 #ifndef AP_TYPES_CONFIG_FILE
00238 #define AP_TYPES_CONFIG_FILE "conf/mime.types"
00239 #endif
00240 
00241 /*
00242  * Define the HTML doctype strings centrally.
00243  */
00245 #define DOCTYPE_HTML_2_0  "<!DOCTYPE HTML PUBLIC \"-//IETF//" \
00246                           "DTD HTML 2.0//EN\">\n"
00247 
00248 #define DOCTYPE_HTML_3_2  "<!DOCTYPE HTML PUBLIC \"-//W3C//" \
00249                           "DTD HTML 3.2 Final//EN\">\n"
00250 
00251 #define DOCTYPE_HTML_4_0S "<!DOCTYPE HTML PUBLIC \"-//W3C//" \
00252                           "DTD HTML 4.0//EN\"\n" \
00253                           "\"http://www.w3.org/TR/REC-html40/strict.dtd\">\n"
00254 
00255 #define DOCTYPE_HTML_4_0T "<!DOCTYPE HTML PUBLIC \"-//W3C//" \
00256                           "DTD HTML 4.0 Transitional//EN\"\n" \
00257                           "\"http://www.w3.org/TR/REC-html40/loose.dtd\">\n"
00258 
00259 #define DOCTYPE_HTML_4_0F "<!DOCTYPE HTML PUBLIC \"-//W3C//" \
00260                           "DTD HTML 4.0 Frameset//EN\"\n" \
00261                           "\"http://www.w3.org/TR/REC-html40/frameset.dtd\">\n"
00262 
00263 #define DOCTYPE_XHTML_1_0S "<!DOCTYPE html PUBLIC \"-//W3C//" \
00264                            "DTD XHTML 1.0 Strict//EN\"\n" \
00265                            "\"http://www.w3.org/TR/xhtml1/DTD/" \
00266                            "xhtml1-strict.dtd\">\n"
00267 
00268 #define DOCTYPE_XHTML_1_0T "<!DOCTYPE html PUBLIC \"-//W3C//" \
00269                            "DTD XHTML 1.0 Transitional//EN\"\n" \
00270                            "\"http://www.w3.org/TR/xhtml1/DTD/" \
00271                            "xhtml1-transitional.dtd\">\n"
00272 
00273 #define DOCTYPE_XHTML_1_0F "<!DOCTYPE html PUBLIC \"-//W3C//" \
00274                            "DTD XHTML 1.0 Frameset//EN\"\n" \
00275                            "\"http://www.w3.org/TR/xhtml1/DTD/" \
00276                            "xhtml1-frameset.dtd\">"
00277 
00279 #define HTTP_VERSION(major,minor) (1000*(major)+(minor))
00280 
00281 #define HTTP_VERSION_MAJOR(number) ((number)/1000)
00282 
00283 #define HTTP_VERSION_MINOR(number) ((number)%1000)
00284 
00285 /* -------------- Port number for server running standalone --------------- */
00286 
00288 #define DEFAULT_HTTP_PORT       80
00289 
00290 #define DEFAULT_HTTPS_PORT      443
00291 
00297 #define ap_is_default_port(port,r)      ((port) == ap_default_port(r))
00298 
00302 #define ap_default_port(r)      ap_run_default_port(r)
00303 
00307 #define ap_http_scheme(r)       ap_run_http_scheme(r)
00308 
00310 #define MAX_STRING_LEN HUGE_STRING_LEN
00311 
00313 #define HUGE_STRING_LEN 8192
00314 
00316 #define AP_IOBUFSIZE 8192
00317 
00319 #define AP_MAX_REG_MATCH 10
00320 
00327 #define AP_MAX_SENDFILE 16777216  /* 2^24 */
00328 
00335 #define APEXIT_OK               0x0
00336 
00337 #define APEXIT_INIT             0x2
00338 
00339 #define APEXIT_CHILDINIT        0x3
00340 
00345 #define APEXIT_CHILDSICK        0x7
00346 
00351 #define APEXIT_CHILDFATAL       0xf
00352 
00353 #ifndef AP_DECLARE
00354 
00359 # define AP_DECLARE(type)    type
00360 #endif
00361 
00362 #ifndef AP_DECLARE_NONSTD
00363 
00370 # define AP_DECLARE_NONSTD(type)    type
00371 #endif
00372 #ifndef AP_DECLARE_DATA
00373 # define AP_DECLARE_DATA
00374 #endif
00375 
00376 #ifndef AP_MODULE_DECLARE
00377 # define AP_MODULE_DECLARE(type)    type
00378 #endif
00379 #ifndef AP_MODULE_DECLARE_NONSTD
00380 # define AP_MODULE_DECLARE_NONSTD(type)  type
00381 #endif
00382 #ifndef AP_MODULE_DECLARE_DATA
00383 # define AP_MODULE_DECLARE_DATA
00384 #endif
00385 
00390 #ifndef AP_CORE_DECLARE
00391 # define AP_CORE_DECLARE        AP_DECLARE
00392 #endif
00393 
00399 #ifndef AP_CORE_DECLARE_NONSTD
00400 # define AP_CORE_DECLARE_NONSTD AP_DECLARE_NONSTD
00401 #endif
00402 
00407 typedef struct {
00408     int major;              
00409     int minor;              
00410     int patch;              
00411     const char *add_string; 
00412 } ap_version_t;
00413 
00420 AP_DECLARE(void) ap_get_server_revision(ap_version_t *version);
00421 
00428 AP_DECLARE(const char *) ap_get_server_banner(void);
00429 
00437 AP_DECLARE(const char *) ap_get_server_description(void);
00438 
00444 AP_DECLARE(void) ap_add_version_component(apr_pool_t *pconf, const char *component);
00445 
00450 AP_DECLARE(const char *) ap_get_server_built(void);
00451 
00452 #define DECLINED -1             
00453 #define DONE -2                 
00456 #define OK 0                    
00468 #define RESPONSE_CODES 57
00469 
00470 #define HTTP_CONTINUE                      100
00471 #define HTTP_SWITCHING_PROTOCOLS           101
00472 #define HTTP_PROCESSING                    102
00473 #define HTTP_OK                            200
00474 #define HTTP_CREATED                       201
00475 #define HTTP_ACCEPTED                      202
00476 #define HTTP_NON_AUTHORITATIVE             203
00477 #define HTTP_NO_CONTENT                    204
00478 #define HTTP_RESET_CONTENT                 205
00479 #define HTTP_PARTIAL_CONTENT               206
00480 #define HTTP_MULTI_STATUS                  207
00481 #define HTTP_MULTIPLE_CHOICES              300
00482 #define HTTP_MOVED_PERMANENTLY             301
00483 #define HTTP_MOVED_TEMPORARILY             302
00484 #define HTTP_SEE_OTHER                     303
00485 #define HTTP_NOT_MODIFIED                  304
00486 #define HTTP_USE_PROXY                     305
00487 #define HTTP_TEMPORARY_REDIRECT            307
00488 #define HTTP_BAD_REQUEST                   400
00489 #define HTTP_UNAUTHORIZED                  401
00490 #define HTTP_PAYMENT_REQUIRED              402
00491 #define HTTP_FORBIDDEN                     403
00492 #define HTTP_NOT_FOUND                     404
00493 #define HTTP_METHOD_NOT_ALLOWED            405
00494 #define HTTP_NOT_ACCEPTABLE                406
00495 #define HTTP_PROXY_AUTHENTICATION_REQUIRED 407
00496 #define HTTP_REQUEST_TIME_OUT              408
00497 #define HTTP_CONFLICT                      409
00498 #define HTTP_GONE                          410
00499 #define HTTP_LENGTH_REQUIRED               411
00500 #define HTTP_PRECONDITION_FAILED           412
00501 #define HTTP_REQUEST_ENTITY_TOO_LARGE      413
00502 #define HTTP_REQUEST_URI_TOO_LARGE         414
00503 #define HTTP_UNSUPPORTED_MEDIA_TYPE        415
00504 #define HTTP_RANGE_NOT_SATISFIABLE         416
00505 #define HTTP_EXPECTATION_FAILED            417
00506 #define HTTP_UNPROCESSABLE_ENTITY          422
00507 #define HTTP_LOCKED                        423
00508 #define HTTP_FAILED_DEPENDENCY             424
00509 #define HTTP_UPGRADE_REQUIRED              426
00510 #define HTTP_INTERNAL_SERVER_ERROR         500
00511 #define HTTP_NOT_IMPLEMENTED               501
00512 #define HTTP_BAD_GATEWAY                   502
00513 #define HTTP_SERVICE_UNAVAILABLE           503
00514 #define HTTP_GATEWAY_TIME_OUT              504
00515 #define HTTP_VERSION_NOT_SUPPORTED         505
00516 #define HTTP_VARIANT_ALSO_VARIES           506
00517 #define HTTP_INSUFFICIENT_STORAGE          507
00518 #define HTTP_NOT_EXTENDED                  510
00519 
00521 #define ap_is_HTTP_INFO(x)         (((x) >= 100)&&((x) < 200))
00522 
00523 #define ap_is_HTTP_SUCCESS(x)      (((x) >= 200)&&((x) < 300))
00524 
00525 #define ap_is_HTTP_REDIRECT(x)     (((x) >= 300)&&((x) < 400))
00526 
00527 #define ap_is_HTTP_ERROR(x)        (((x) >= 400)&&((x) < 600))
00528 
00529 #define ap_is_HTTP_CLIENT_ERROR(x) (((x) >= 400)&&((x) < 500))
00530 
00531 #define ap_is_HTTP_SERVER_ERROR(x) (((x) >= 500)&&((x) < 600))
00532 
00533 #define ap_is_HTTP_VALID_RESPONSE(x) (((x) >= 100)&&((x) < 600))
00534 
00536 #define ap_status_drops_connection(x) \
00537                                    (((x) == HTTP_BAD_REQUEST)           || \
00538                                     ((x) == HTTP_REQUEST_TIME_OUT)      || \
00539                                     ((x) == HTTP_LENGTH_REQUIRED)       || \
00540                                     ((x) == HTTP_REQUEST_ENTITY_TOO_LARGE) || \
00541                                     ((x) == HTTP_REQUEST_URI_TOO_LARGE) || \
00542                                     ((x) == HTTP_INTERNAL_SERVER_ERROR) || \
00543                                     ((x) == HTTP_SERVICE_UNAVAILABLE) || \
00544                                     ((x) == HTTP_NOT_IMPLEMENTED))
00545 
00561 #define M_GET                   0       
00562 #define M_PUT                   1       /*  :             */
00563 #define M_POST                  2
00564 #define M_DELETE                3
00565 #define M_CONNECT               4
00566 #define M_OPTIONS               5
00567 #define M_TRACE                 6       
00568 #define M_PATCH                 7       
00569 #define M_PROPFIND              8       
00570 #define M_PROPPATCH             9       /*  :               */
00571 #define M_MKCOL                 10
00572 #define M_COPY                  11
00573 #define M_MOVE                  12
00574 #define M_LOCK                  13
00575 #define M_UNLOCK                14      
00576 #define M_VERSION_CONTROL       15      
00577 #define M_CHECKOUT              16      /*  :                          */
00578 #define M_UNCHECKOUT            17
00579 #define M_CHECKIN               18
00580 #define M_UPDATE                19
00581 #define M_LABEL                 20
00582 #define M_REPORT                21
00583 #define M_MKWORKSPACE           22
00584 #define M_MKACTIVITY            23
00585 #define M_BASELINE_CONTROL      24
00586 #define M_MERGE                 25
00587 #define M_INVALID               26      
00593 #define METHODS     64
00594 
00598 #define AP_METHOD_BIT ((apr_int64_t)1)
00599 
00603 typedef struct ap_method_list_t ap_method_list_t;
00604 
00612 struct ap_method_list_t {
00614     apr_int64_t method_mask;
00616     apr_array_header_t *method_list;
00617 };
00618 
00624 #define CGI_MAGIC_TYPE "application/x-httpd-cgi"
00625 
00626 #define INCLUDES_MAGIC_TYPE "text/x-server-parsed-html"
00627 
00628 #define INCLUDES_MAGIC_TYPE3 "text/x-server-parsed-html3"
00629 
00630 #define DIR_MAGIC_TYPE "httpd/unix-directory"
00631 
00633 /* Just in case your linefeed isn't the one the other end is expecting. */
00634 #if !APR_CHARSET_EBCDIC
00635 
00636 #define LF 10
00637 
00638 #define CR 13
00639 
00640 #define CRLF "\015\012"
00641 #else /* APR_CHARSET_EBCDIC */
00642 /* For platforms using the EBCDIC charset, the transition ASCII->EBCDIC is done
00643  * in the buff package (bread/bputs/bwrite).  Everywhere else, we use
00644  * "native EBCDIC" CR and NL characters. These are therefore
00645  * defined as
00646  * '\r' and '\n'.
00647  */
00648 #define CR '\r'
00649 #define LF '\n'
00650 #define CRLF "\r\n"
00651 #endif /* APR_CHARSET_EBCDIC */                                   
00652 
00660 #define REQUEST_NO_BODY          0
00661 
00662 #define REQUEST_CHUNKED_ERROR    1
00663 
00664 #define REQUEST_CHUNKED_DECHUNK  2
00665 
00675 #define AP_REQ_ACCEPT_PATH_INFO    0
00676 
00677 #define AP_REQ_REJECT_PATH_INFO    1
00678 
00679 #define AP_REQ_DEFAULT_PATH_INFO   2
00680 
00684 /*
00685  * Things which may vary per file-lookup WITHIN a request ---
00686  * e.g., state of MIME config.  Basically, the name of an object, info
00687  * about the object, and any other info we may ahve which may need to
00688  * change as we go poking around looking for it (e.g., overridden by
00689  * .htaccess files).
00690  *
00691  * Note how the default state of almost all these things is properly
00692  * zero, so that allocating it with pcalloc does the right thing without
00693  * a whole lot of hairy initialization... so long as we are willing to
00694  * make the (fairly) portable assumption that the bit pattern of a NULL
00695  * pointer is, in fact, zero.
00696  */
00697 
00702 struct htaccess_result {
00704     const char *dir;
00706     int override;
00708     int override_opts;
00710     struct ap_conf_vector_t *htaccess;
00712     const struct htaccess_result *next;
00713 };
00714 
00715 /* The following four types define a hierarchy of activities, so that
00716  * given a request_rec r you can write r->connection->server->process
00717  * to get to the process_rec.  While this reduces substantially the
00718  * number of arguments that various hooks require beware that in
00719  * threaded versions of the server you must consider multiplexing
00720  * issues.  */
00721 
00722 
00724 typedef struct process_rec process_rec;
00726 typedef struct server_rec server_rec;
00728 typedef struct conn_rec conn_rec;
00730 typedef struct request_rec request_rec;
00732 typedef struct conn_state_t conn_state_t;
00733 
00734 /* ### would be nice to not include this from httpd.h ... */
00735 /* This comes after we have defined the request_rec type */
00736 #include "apr_uri.h"
00737 
00741 struct process_rec {
00743     apr_pool_t *pool;
00745     apr_pool_t *pconf;
00747     int argc;
00749     const char * const *argv;
00751     const char *short_name;
00752 };
00753 
00757 struct request_rec {
00759     apr_pool_t *pool;
00761     conn_rec *connection;
00763     server_rec *server;
00764 
00766     request_rec *next;
00768     request_rec *prev;
00769 
00772     request_rec *main;
00773 
00774     /* Info about the request itself... we begin with stuff that only
00775      * protocol.c should ever touch...
00776      */
00778     char *the_request;
00780     int assbackwards;
00785     int proxyreq;
00787     int header_only;
00789     char *protocol;
00791     int proto_num;
00793     const char *hostname;
00794 
00796     apr_time_t request_time;
00797 
00799     const char *status_line;
00801     int status;
00802 
00803     /* Request method, two ways; also, protocol, etc..  Outside of protocol.c,
00804      * look, but don't touch.
00805      */
00806 
00808     const char *method;
00810     int method_number;
00811 
00832     apr_int64_t allowed;
00834     apr_array_header_t *allowed_xmethods; 
00836     ap_method_list_t *allowed_methods; 
00837 
00839     apr_off_t sent_bodyct;
00841     apr_off_t bytes_sent;
00843     apr_time_t mtime;
00844 
00845     /* HTTP/1.1 connection-level features */
00846 
00848     int chunked;
00850     const char *range;
00852     apr_off_t clength;
00853 
00855     apr_off_t remaining;
00857     apr_off_t read_length;
00861     int read_body;
00863     int read_chunked;
00865     unsigned expecting_100;
00866 
00867     /* MIME header environments, in and out.  Also, an array containing
00868      * environment variables to be passed to subprocesses, so people can
00869      * write modules to add to that environment.
00870      *
00871      * The difference between headers_out and err_headers_out is that the
00872      * latter are printed even on error, and persist across internal redirects
00873      * (so the headers printed for ErrorDocument handlers will have them).
00874      *
00875      * The 'notes' apr_table_t is for notes from one module to another, with no
00876      * other set purpose in mind...
00877      */
00878 
00880     apr_table_t *headers_in;
00882     apr_table_t *headers_out;
00885     apr_table_t *err_headers_out;
00887     apr_table_t *subprocess_env;
00889     apr_table_t *notes;
00890 
00891     /* content_type, handler, content_encoding, and all content_languages 
00892      * MUST be lowercased strings.  They may be pointers to static strings;
00893      * they should not be modified in place.
00894      */
00896     const char *content_type;   /* Break these out --- we dispatch on 'em */
00898     const char *handler;        /* What we *really* dispatch on */
00899 
00901     const char *content_encoding;
00903     apr_array_header_t *content_languages;
00904 
00906     char *vlist_validator;
00907     
00909     char *user; 
00911     char *ap_auth_type;
00912 
00914     int no_cache;
00916     int no_local_copy;
00917 
00918     /* What object is being requested (either directly, or via include
00919      * or content-negotiation mapping).
00920      */
00921 
00923     char *unparsed_uri; 
00925     char *uri;
00927     char *filename;
00928     /* XXX: What does this mean? Please define "canonicalize" -aaron */
00930     char *canonical_filename;
00932     char *path_info;
00934     char *args; 
00936     apr_finfo_t finfo;
00938     apr_uri_t parsed_uri;
00939 
00948     int used_path_info;
00949 
00950     /* Various other config info which may change with .htaccess files
00951      * These are config vectors, with one void* pointer for each module
00952      * (the thing pointed to being the module's business).
00953      */
00954 
00956     struct ap_conf_vector_t *per_dir_config;
00958     struct ap_conf_vector_t *request_config;
00959 
00966     const struct htaccess_result *htaccess;
00967 
00969     struct ap_filter_t *output_filters;
00971     struct ap_filter_t *input_filters;
00972 
00975     struct ap_filter_t *proto_output_filters;
00978     struct ap_filter_t *proto_input_filters;
00979 
00981     int eos_sent;
00982 
00983 /* Things placed at the end of the record to avoid breaking binary
00984  * compatibility.  It would be nice to remember to reorder the entire
00985  * record to improve 64bit alignment the next time we need to break
00986  * binary compatibility for some other reason.
00987  */
00988 };
00989 
01000 #define PROXYREQ_NONE 0         
01001 #define PROXYREQ_PROXY 1        
01002 #define PROXYREQ_REVERSE 2      
01003 #define PROXYREQ_RESPONSE 3 
01005 /* @} */
01006 
01010 typedef enum {
01011     AP_CONN_UNKNOWN,
01012     AP_CONN_CLOSE,
01013     AP_CONN_KEEPALIVE
01014 } ap_conn_keepalive_e;
01015 
01019 struct conn_rec {
01021     apr_pool_t *pool;
01023     server_rec *base_server;
01025     void *vhost_lookup_data;
01026 
01027     /* Information about the connection itself */
01029     apr_sockaddr_t *local_addr;
01031     apr_sockaddr_t *remote_addr;
01032 
01034     char *remote_ip;
01038     char *remote_host;
01041     char *remote_logname;
01042 
01044     unsigned aborted:1;
01045 
01048     ap_conn_keepalive_e keepalive;
01049 
01052     signed int double_reverse:2;
01053 
01055     int keepalives;
01057     char *local_ip;
01060     char *local_host;
01061 
01063     long id; 
01066     struct ap_conf_vector_t *conn_config;
01069     apr_table_t *notes;
01071     struct ap_filter_t *input_filters;
01073     struct ap_filter_t *output_filters;
01075     void *sbh;
01077     struct apr_bucket_alloc_t *bucket_alloc;
01079     conn_state_t *cs;
01081     int data_in_input_filters;
01083     int data_in_output_filters;
01084 
01088     int clogging_input_filters;
01089 };
01090 
01094 typedef enum  {
01095     CONN_STATE_CHECK_REQUEST_LINE_READABLE,
01096     CONN_STATE_READ_REQUEST_LINE,
01097     CONN_STATE_HANDLER,
01098     CONN_STATE_WRITE_COMPLETION,
01099     CONN_STATE_LINGER
01100 } conn_state_e;
01101 
01105 struct conn_state_t {
01107     APR_RING_ENTRY(conn_state_t) timeout_list;
01109     apr_time_t expiration_time;
01111     conn_state_e state;
01113     conn_rec *c;
01115     apr_pool_t *p;
01117     apr_bucket_alloc_t *bucket_alloc;
01119     apr_pollfd_t pfd;
01120 };
01121 
01122 /* Per-vhost config... */
01123 
01128 #define DEFAULT_VHOST_ADDR 0xfffffffful
01129 
01130 
01135 typedef struct server_addr_rec server_addr_rec;
01136 struct server_addr_rec {
01138     server_addr_rec *next;
01140     apr_sockaddr_t *host_addr;
01142     apr_port_t host_port;
01144     char *virthost;
01145 };
01146 
01150 struct server_rec {
01152     process_rec *process;
01154     server_rec *next;
01155 
01157     const char *defn_name;
01159     unsigned defn_line_number;
01160 
01161     /* Contact information */
01162 
01164     char *server_admin;
01166     char *server_hostname;
01168     apr_port_t port;
01169 
01170     /* Log files --- note that transfer log is now in the modules... */
01171 
01173     char *error_fname;
01175     apr_file_t *error_log;
01177     int loglevel;
01178 
01179     /* Module-specific configuration for server, and defaults... */
01180 
01182     int is_virtual;
01185     struct ap_conf_vector_t *module_config; 
01187     struct ap_conf_vector_t *lookup_defaults;
01188 
01189     /* Transaction handling */
01190 
01192     server_addr_rec *addrs;
01194     apr_interval_time_t timeout;
01196     apr_interval_time_t keep_alive_timeout;
01198     int keep_alive_max;
01200     int keep_alive;
01201 
01203     const char *path;
01205     int pathlen;
01206 
01208     apr_array_header_t *names;
01210     apr_array_header_t *wild_names;
01211 
01213     int limit_req_line;
01215     int limit_req_fieldsize;
01217     int limit_req_fields; 
01218 
01220     const char *server_scheme;
01221 };
01222 
01223 typedef struct core_output_filter_ctx {
01224     apr_bucket_brigade *buffered_bb;
01225     apr_size_t bytes_in;
01226     apr_size_t bytes_written;
01227 } core_output_filter_ctx_t;
01228  
01229 typedef struct core_filter_ctx {
01230     apr_bucket_brigade *b;
01231     apr_bucket_brigade *tmpbb;
01232 } core_ctx_t;
01233  
01234 typedef struct core_net_rec {
01236     apr_socket_t *client_socket;
01237 
01239     conn_rec *c;
01240  
01241     core_output_filter_ctx_t *out_ctx;
01242     core_ctx_t *in_ctx;
01243 } core_net_rec;
01244 
01252 AP_DECLARE(char *) ap_field_noparam(apr_pool_t *p, const char *intype);
01253 
01262 AP_DECLARE(char *) ap_ht_time(apr_pool_t *p, apr_time_t t, const char *fmt, int gmt);
01263 
01264 /* String handling. The *_nc variants allow you to use non-const char **s as
01265    arguments (unfortunately C won't automatically convert a char ** to a const
01266    char **) */
01267 
01275 AP_DECLARE(char *) ap_getword(apr_pool_t *p, const char **line, char stop);
01276 
01285 AP_DECLARE(char *) ap_getword_nc(apr_pool_t *p, char **line, char stop);
01286 
01294 AP_DECLARE(char *) ap_getword_white(apr_pool_t *p, const char **line);
01295 
01304 AP_DECLARE(char *) ap_getword_white_nc(apr_pool_t *p, char **line);
01305 
01314 AP_DECLARE(char *) ap_getword_nulls(apr_pool_t *p, const char **line,
01315                                     char stop);
01316 
01326 AP_DECLARE(char *) ap_getword_nulls_nc(apr_pool_t *p, char **line, char stop);
01327 
01334 AP_DECLARE(char *) ap_getword_conf(apr_pool_t *p, const char **line);
01335 
01343 AP_DECLARE(char *) ap_getword_conf_nc(apr_pool_t *p, char **line);
01344 
01354 AP_DECLARE(const char *) ap_resolve_env(apr_pool_t *p, const char * word); 
01355 
01365 AP_DECLARE(const char *) ap_size_list_item(const char **field, int *len);
01366 
01377 AP_DECLARE(char *) ap_get_list_item(apr_pool_t *p, const char **field);
01378 
01387 AP_DECLARE(int) ap_find_list_item(apr_pool_t *p, const char *line, const char *tok);
01388 
01399 AP_DECLARE(char *) ap_get_token(apr_pool_t *p, const char **accept_line, int accept_white);
01400 
01408 AP_DECLARE(int) ap_find_token(apr_pool_t *p, const char *line, const char *tok);
01409 
01417 AP_DECLARE(int) ap_find_last_token(apr_pool_t *p, const char *line, const char *tok);
01418 
01424 AP_DECLARE(int) ap_is_url(const char *u);
01425 
01431 AP_DECLARE(int) ap_unescape_url(char *url);
01432 
01438 AP_DECLARE(int) ap_unescape_url_keep2f(char *url);
01439 
01444 AP_DECLARE(void) ap_no2slash(char *name);
01445 
01451 AP_DECLARE(void) ap_getparents(char *name);
01452 
01459 AP_DECLARE(char *) ap_escape_path_segment(apr_pool_t *p, const char *s);
01460 
01469 AP_DECLARE(char *) ap_os_escape_path(apr_pool_t *p, const char *path, int partial);
01470 
01472 #define ap_escape_uri(ppool,path) ap_os_escape_path(ppool,path,1)
01473 
01480 AP_DECLARE(char *) ap_escape_html(apr_pool_t *p, const char *s);
01481 
01488 AP_DECLARE(char *) ap_escape_logitem(apr_pool_t *p, const char *str);
01489 
01497 AP_DECLARE(apr_size_t) ap_escape_errorlog_item(char *dest, const char *source,
01498                                                apr_size_t buflen);
01499 
01508 AP_DECLARE(char *) ap_construct_server(apr_pool_t *p, const char *hostname,
01509                                     apr_port_t port, const request_rec *r);
01510 
01517 AP_DECLARE(char *) ap_escape_shell_cmd(apr_pool_t *p, const char *s);
01518 
01524 AP_DECLARE(int) ap_count_dirs(const char *path);
01525 
01537 AP_DECLARE(char *) ap_make_dirstr_prefix(char *d, const char *s, int n);
01538 
01546 AP_DECLARE(char *) ap_make_dirstr_parent(apr_pool_t *p, const char *s);
01547 
01560 AP_DECLARE(char *) ap_make_full_path(apr_pool_t *a, const char *dir, const char *f);
01561 
01570 AP_DECLARE(int) ap_os_is_path_absolute(apr_pool_t *p, const char *dir);
01571 
01579 AP_DECLARE(int) ap_is_matchexp(const char *str);
01580 
01587 AP_DECLARE(int) ap_strcmp_match(const char *str, const char *expected);
01588 
01596 AP_DECLARE(int) ap_strcasecmp_match(const char *str, const char *expected);
01597 
01605 AP_DECLARE(char *) ap_strcasestr(const char *s1, const char *s2);
01606 
01613 AP_DECLARE(const char *) ap_stripprefix(const char *bigstring,
01614                                         const char *prefix);
01615 
01622 AP_DECLARE(char *) ap_pbase64decode(apr_pool_t *p, const char *bufcoded);
01623 
01630 AP_DECLARE(char *) ap_pbase64encode(apr_pool_t *p, char *string); 
01631 
01644 AP_DECLARE(ap_regex_t *) ap_pregcomp(apr_pool_t *p, const char *pattern,
01645                                      int cflags);
01646 
01652 AP_DECLARE(void) ap_pregfree(apr_pool_t *p, ap_regex_t *reg);
01653 
01665 AP_DECLARE(char *) ap_pregsub(apr_pool_t *p, const char *input, const char *source,
01666                               size_t nmatch, ap_regmatch_t pmatch[]);
01667 
01673 AP_DECLARE(void) ap_content_type_tolower(char *s);
01674 
01679 AP_DECLARE(void) ap_str_tolower(char *s);
01680 
01688 AP_DECLARE(int) ap_ind(const char *str, char c);        /* Sigh... */
01689 
01697 AP_DECLARE(int) ap_rind(const char *str, char c);
01698 
01705 AP_DECLARE(char *) ap_escape_quotes(apr_pool_t *p, const char *instring);
01706 
01717 AP_DECLARE(char *) ap_append_pid(apr_pool_t *p, const char *string,
01718                                  const char *delim);
01719 
01720 /* Misc system hackery */
01727 AP_DECLARE(int) ap_is_rdirectory(apr_pool_t *p, const char *name);
01728 
01735 AP_DECLARE(int) ap_is_directory(apr_pool_t *p, const char *name);
01736 
01737 #ifdef _OSD_POSIX
01738 extern int os_init_job_environment(server_rec *s, const char *user_name, int one_process);
01739 #endif /* _OSD_POSIX */
01740 
01746 char *ap_get_local_host(apr_pool_t *p);
01747 
01754 AP_DECLARE(void) ap_log_assert(const char *szExp, const char *szFile, int nLine)
01755                             __attribute__((noreturn));
01756 
01760 #define ap_assert(exp) ((exp) ? (void)0 : ap_log_assert(#exp,__FILE__,__LINE__))
01761 
01769 #ifdef AP_DEBUG
01770 #define AP_DEBUG_ASSERT(exp) ap_assert(exp)
01771 #else
01772 #define AP_DEBUG_ASSERT(exp) ((void)0)
01773 #endif
01774 
01784 #define SIGSTOP_DETACH                  1
01785 
01786 #define SIGSTOP_MAKE_CHILD              2
01787 
01788 #define SIGSTOP_SPAWN_CHILD             4
01789 
01790 #define SIGSTOP_PIPED_LOG_SPAWN         8
01791 
01792 #define SIGSTOP_CGI_CHILD               16
01793 
01795 #ifdef DEBUG_SIGSTOP
01796 extern int raise_sigstop_flags;
01797 #define RAISE_SIGSTOP(x)        do { \
01798         if (raise_sigstop_flags & SIGSTOP_##x) raise(SIGSTOP);\
01799     } while (0)
01800 #else
01801 #define RAISE_SIGSTOP(x)
01802 #endif
01803 
01810 AP_DECLARE(const char *) ap_psignature(const char *prefix, request_rec *r);
01811 
01813 #ifdef strtoul
01814 #undef strtoul
01815 #endif
01816 #define strtoul strtoul_is_not_a_portable_function_use_strtol_instead
01817 
01818   /* The C library has functions that allow const to be silently dropped ...
01819      these macros detect the drop in maintainer mode, but use the native
01820      methods for normal builds
01821 
01822      Note that on some platforms (e.g., AIX with gcc, Solaris with gcc), string.h needs 
01823      to be included before the macros are defined or compilation will fail.
01824   */
01825 #include <string.h>
01826 
01827 AP_DECLARE(char *) ap_strchr(char *s, int c);
01828 AP_DECLARE(const char *) ap_strchr_c(const char *s, int c);
01829 AP_DECLARE(char *) ap_strrchr(char *s, int c);
01830 AP_DECLARE(const char *) ap_strrchr_c(const char *s, int c);
01831 AP_DECLARE(char *) ap_strstr(char *s, const char *c);
01832 AP_DECLARE(const char *) ap_strstr_c(const char *s, const char *c);
01833 
01834 #ifdef AP_DEBUG
01835 
01836 #undef strchr
01837 # define strchr(s, c)   ap_strchr(s,c)
01838 #undef strrchr
01839 # define strrchr(s, c)  ap_strrchr(s,c)
01840 #undef strstr
01841 # define strstr(s, c)  ap_strstr(s,c)
01842 
01843 #else
01844 
01846 # define ap_strchr(s, c)        strchr(s, c)
01847 
01848 # define ap_strchr_c(s, c)      strchr(s, c)
01849 
01850 # define ap_strrchr(s, c)       strrchr(s, c)
01851 
01852 # define ap_strrchr_c(s, c)     strrchr(s, c)
01853 
01854 # define ap_strstr(s, c)        strstr(s, c)
01855 
01856 # define ap_strstr_c(s, c)      strstr(s, c)
01857 
01858 #endif
01859 
01860 #define AP_NORESTART            APR_OS_START_USEERR + 1
01861 
01862 #ifdef __cplusplus
01863 }
01864 #endif
01865 
01866 #endif  /* !APACHE_HTTPD_H */
01867 

Generated on Sun Jul 1 10:07:05 2007 by Doxygen 1.5.2. This rendition of the open source Apache HTTP Server header documentation is not endorsed by or affiliated with the Apache Software Foundation.