00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00026 #ifndef APACHE_HTTP_CORE_H
00027 #define APACHE_HTTP_CORE_H
00028
00029 #include "apr.h"
00030 #include "apr_hash.h"
00031 #include "apr_optional.h"
00032 #include "util_filter.h"
00033
00034 #if APR_HAVE_STRUCT_RLIMIT
00035 #include <sys/time.h>
00036 #include <sys/resource.h>
00037 #endif
00038
00039
00040 #ifdef __cplusplus
00041 extern "C" {
00042 #endif
00043
00044
00045
00046
00047
00048
00049
00050
00051
00052
00053
00054
00055
00065 #define OPT_NONE 0
00066
00067 #define OPT_INDEXES 1
00068
00069 #define OPT_INCLUDES 2
00070
00071 #define OPT_SYM_LINKS 4
00072
00073 #define OPT_EXECCGI 8
00074
00075 #define OPT_UNSET 16
00076
00077 #define OPT_INCNOEXEC 32
00078
00079 #define OPT_SYM_OWNER 64
00080
00081 #define OPT_MULTI 128
00082
00083 #define OPT_ALL (OPT_INDEXES|OPT_INCLUDES|OPT_SYM_LINKS|OPT_EXECCGI)
00084
00095 #define REMOTE_HOST (0)
00096
00101 #define REMOTE_NAME (1)
00102
00106 #define REMOTE_NOLOOKUP (2)
00107
00113 #define REMOTE_DOUBLE_REV (3)
00114
00118 #define SATISFY_ALL 0
00119
00120 #define SATISFY_ANY 1
00121
00122 #define SATISFY_NOSPEC 2
00123
00126 #define AP_MIN_BYTES_TO_WRITE 8000
00127
00129 # define AP_DEFAULT_MAX_INTERNAL_REDIRECTS 10
00130
00132 # define AP_DEFAULT_MAX_SUBREQ_DEPTH 10
00133
00139 AP_DECLARE(int) ap_allow_options(request_rec *r);
00140
00146 AP_DECLARE(int) ap_allow_overrides(request_rec *r);
00147
00153 AP_DECLARE(const char *) ap_default_type(request_rec *r);
00154
00162 AP_DECLARE(const char *) ap_document_root(request_rec *r);
00163
00188 AP_DECLARE(const char *) ap_get_remote_host(conn_rec *conn, void *dir_config, int type, int *str_is_ip);
00189
00196 AP_DECLARE(const char *) ap_get_remote_logname(request_rec *r);
00197
00198
00199
00200
00208 AP_DECLARE(char *) ap_construct_url(apr_pool_t *p, const char *uri, request_rec *r);
00209
00215 AP_DECLARE(const char *) ap_get_server_name(request_rec *r);
00216
00222 AP_DECLARE(apr_port_t) ap_get_server_port(const request_rec *r);
00223
00229 AP_DECLARE(apr_off_t) ap_get_limit_req_body(const request_rec *r);
00230
00236 AP_DECLARE(size_t) ap_get_limit_xml_body(const request_rec *r);
00237
00245 AP_DECLARE(void) ap_custom_response(request_rec *r, int status, const char *string);
00246
00252 AP_DECLARE(int) ap_is_recursion_limit_exceeded(const request_rec *r);
00253
00259 AP_DECLARE(int) ap_exists_config_define(const char *name);
00260
00261 AP_DECLARE_NONSTD(int) ap_core_translate(request_rec *r);
00262
00263
00264
00265
00266
00267
00268
00269
00271 typedef struct require_line require_line;
00272
00276 struct require_line {
00278 apr_int64_t method_mask;
00280 char *requirement;
00281 };
00282
00288 AP_DECLARE(const char *) ap_auth_type(request_rec *r);
00289
00295 AP_DECLARE(const char *) ap_auth_name(request_rec *r);
00296
00307 AP_DECLARE(int) ap_satisfies(request_rec *r);
00308
00314 AP_DECLARE(const apr_array_header_t *) ap_requires(request_rec *r);
00315
00316 #ifdef CORE_PRIVATE
00317
00323 AP_DECLARE_DATA extern module core_module;
00324
00328 typedef struct {
00331 struct apr_bucket_brigade *bb;
00332
00338 void **notes;
00339
00348 int deliver_script;
00349
00353 char **response_code_strings;
00354
00355
00358 int suppress_charset;
00359 } core_request_config;
00360
00361
00362
00363
00364
00365 #define AP_NOTE_DIRECTORY_WALK 0
00366 #define AP_NOTE_LOCATION_WALK 1
00367 #define AP_NOTE_FILE_WALK 2
00368 #define AP_NUM_STD_NOTES 3
00369
00377 AP_DECLARE(apr_size_t) ap_register_request_note(void);
00378
00393 AP_DECLARE(void **) ap_get_request_note(request_rec *r, apr_size_t note_num);
00394
00395
00396 typedef unsigned char allow_options_t;
00397 typedef unsigned char overrides_t;
00398
00399
00400
00401
00402
00403
00404
00405 typedef unsigned long etag_components_t;
00406
00407 #define ETAG_UNSET 0
00408 #define ETAG_NONE (1 << 0)
00409 #define ETAG_MTIME (1 << 1)
00410 #define ETAG_INODE (1 << 2)
00411 #define ETAG_SIZE (1 << 3)
00412 #define ETAG_BACKWARD (ETAG_MTIME | ETAG_INODE | ETAG_SIZE)
00413 #define ETAG_ALL (ETAG_MTIME | ETAG_INODE | ETAG_SIZE)
00414
00418 typedef enum {
00419 srv_sig_unset,
00420 srv_sig_off,
00421 srv_sig_on,
00422 srv_sig_withmail
00423 } server_signature_e;
00424
00428 typedef struct {
00430 char *d;
00432 unsigned d_components;
00433
00441 allow_options_t opts;
00442 allow_options_t opts_add;
00443 allow_options_t opts_remove;
00444 overrides_t override;
00445 allow_options_t override_opts;
00446
00447
00448
00449
00450
00451
00452 char *ap_default_type;
00453
00454
00455
00456 int *satisfy;
00457 char *ap_auth_type;
00458 char *ap_auth_name;
00459 apr_array_header_t *ap_requires;
00460
00461
00462
00463
00464
00465
00466
00467 char **response_code_strings;
00468
00469
00470
00471 #define HOSTNAME_LOOKUP_OFF 0
00472 #define HOSTNAME_LOOKUP_ON 1
00473 #define HOSTNAME_LOOKUP_DOUBLE 2
00474 #define HOSTNAME_LOOKUP_UNSET 3
00475 unsigned int hostname_lookups : 4;
00476
00477 signed int content_md5 : 2;
00478
00479 #define USE_CANONICAL_NAME_OFF (0)
00480 #define USE_CANONICAL_NAME_ON (1)
00481 #define USE_CANONICAL_NAME_DNS (2)
00482 #define USE_CANONICAL_NAME_UNSET (3)
00483 unsigned use_canonical_name : 2;
00484
00485
00486
00487
00488
00489 unsigned d_is_fnmatch : 1;
00490
00491
00492
00493
00494 #define ADD_DEFAULT_CHARSET_OFF (0)
00495 #define ADD_DEFAULT_CHARSET_ON (1)
00496 #define ADD_DEFAULT_CHARSET_UNSET (2)
00497 unsigned add_default_charset : 2;
00498 const char *add_default_charset_name;
00499
00500
00501 #ifdef RLIMIT_CPU
00502 struct rlimit *limit_cpu;
00503 #endif
00504 #if defined (RLIMIT_DATA) || defined (RLIMIT_VMEM) || defined(RLIMIT_AS)
00505 struct rlimit *limit_mem;
00506 #endif
00507 #ifdef RLIMIT_NPROC
00508 struct rlimit *limit_nproc;
00509 #endif
00510 apr_off_t limit_req_body;
00511 long limit_xml_body;
00512
00513
00514
00515 server_signature_e server_signature;
00516
00517 int loglevel;
00518
00519
00520 apr_array_header_t *sec_file;
00521 ap_regex_t *r;
00522
00523 const char *mime_type;
00524 const char *handler;
00525 const char *output_filters;
00526 const char *input_filters;
00527 int accept_path_info;
00528
00529 apr_hash_t *ct_output_filters;
00530
00531
00532
00533
00534 etag_components_t etag_bits;
00535 etag_components_t etag_add;
00536 etag_components_t etag_remove;
00537
00538
00539
00540
00541 #define ENABLE_MMAP_OFF (0)
00542 #define ENABLE_MMAP_ON (1)
00543 #define ENABLE_MMAP_UNSET (2)
00544 unsigned int enable_mmap : 2;
00545
00546 #define ENABLE_SENDFILE_OFF (0)
00547 #define ENABLE_SENDFILE_ON (1)
00548 #define ENABLE_SENDFILE_UNSET (2)
00549 unsigned int enable_sendfile : 2;
00550 unsigned int allow_encoded_slashes : 1;
00551
00552
00553 #define USE_CANONICAL_PHYS_PORT_OFF (0)
00554 #define USE_CANONICAL_PHYS_PORT_ON (1)
00555 #define USE_CANONICAL_PHYS_PORT_UNSET (2)
00556 unsigned use_canonical_phys_port : 2;
00557
00558 } core_dir_config;
00559
00560
00561
00562 typedef struct {
00563
00564 #ifdef GPROF
00565 char *gprof_dir;
00566 #endif
00567
00568
00569
00570
00571
00572 const char *ap_document_root;
00573
00574
00575
00576 char *access_name;
00577 apr_array_header_t *sec_dir;
00578 apr_array_header_t *sec_url;
00579
00580
00581 int redirect_limit;
00582 int subreq_limit;
00583
00584 const char *protocol;
00585 apr_table_t *accf_map;
00586
00587
00588 #define AP_TRACE_UNSET -1
00589 #define AP_TRACE_DISABLE 0
00590 #define AP_TRACE_ENABLE 1
00591 #define AP_TRACE_EXTENDED 2
00592 int trace_enable;
00593
00594 } core_server_config;
00595
00596
00597 void ap_add_output_filters_by_type(request_rec *r);
00598
00599
00600 void ap_core_reorder_directories(apr_pool_t *, server_rec *);
00601
00602
00603 AP_CORE_DECLARE(void) ap_add_per_dir_conf(server_rec *s, void *dir_config);
00604 AP_CORE_DECLARE(void) ap_add_per_url_conf(server_rec *s, void *url_config);
00605 AP_CORE_DECLARE(void) ap_add_file_conf(core_dir_config *conf, void *url_config);
00606 AP_CORE_DECLARE_NONSTD(const char *) ap_limit_section(cmd_parms *cmd, void *dummy, const char *arg);
00607
00608
00609 int ap_core_input_filter(ap_filter_t *f, apr_bucket_brigade *b,
00610 ap_input_mode_t mode, apr_read_type_e block,
00611 apr_off_t readbytes);
00612 apr_status_t ap_core_output_filter(ap_filter_t *f, apr_bucket_brigade *b);
00613
00614 #endif
00615
00616 AP_DECLARE(const char*) ap_get_server_protocol(server_rec* s);
00617 AP_DECLARE(void) ap_set_server_protocol(server_rec* s, const char* proto);
00618
00619
00620
00621
00622
00623
00624 typedef enum {
00625 ap_mgmt_type_string,
00626 ap_mgmt_type_long,
00627 ap_mgmt_type_hash
00628 } ap_mgmt_type_e;
00629
00630 typedef union {
00631 const char *s_value;
00632 long i_value;
00633 apr_hash_t *h_value;
00634 } ap_mgmt_value;
00635
00636 typedef struct {
00637 const char *description;
00638 const char *name;
00639 ap_mgmt_type_e vtype;
00640 ap_mgmt_value v;
00641 } ap_mgmt_item_t;
00642
00643
00644 extern AP_DECLARE_DATA ap_filter_rec_t *ap_subreq_core_filter_handle;
00645 extern AP_DECLARE_DATA ap_filter_rec_t *ap_core_output_filter_handle;
00646 extern AP_DECLARE_DATA ap_filter_rec_t *ap_content_length_filter_handle;
00647 extern AP_DECLARE_DATA ap_filter_rec_t *ap_core_input_filter_handle;
00648
00662 AP_DECLARE_HOOK(int, get_mgmt_items,
00663 (apr_pool_t *p, const char * val, apr_hash_t *ht))
00664
00665
00666
00667
00668
00669
00670
00671
00672 APR_DECLARE_OPTIONAL_FN(void, ap_logio_add_bytes_out,
00673 (conn_rec *c, apr_off_t bytes));
00674
00675
00676
00677
00678
00679
00680 APR_DECLARE_OPTIONAL_FN(const char *, ap_ident_lookup,
00681 (request_rec *r));
00682
00683
00684
00685 #ifdef __cplusplus
00686 }
00687 #endif
00688
00689 #endif
00690