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
00309 #ifdef CORE_PRIVATE
00310
00316 AP_DECLARE_DATA extern module core_module;
00317
00321 typedef struct {
00324 struct apr_bucket_brigade *bb;
00325
00331 void **notes;
00332
00341 int deliver_script;
00342
00346 char **response_code_strings;
00347
00348
00351 int suppress_charset;
00352 } core_request_config;
00353
00354
00355
00356
00357
00358 #define AP_NOTE_DIRECTORY_WALK 0
00359 #define AP_NOTE_LOCATION_WALK 1
00360 #define AP_NOTE_FILE_WALK 2
00361 #define AP_NUM_STD_NOTES 3
00362
00370 AP_DECLARE(apr_size_t) ap_register_request_note(void);
00371
00386 AP_DECLARE(void **) ap_get_request_note(request_rec *r, apr_size_t note_num);
00387
00388
00389 typedef unsigned char allow_options_t;
00390 typedef unsigned char overrides_t;
00391
00392
00393
00394
00395
00396
00397
00398 typedef unsigned long etag_components_t;
00399
00400 #define ETAG_UNSET 0
00401 #define ETAG_NONE (1 << 0)
00402 #define ETAG_MTIME (1 << 1)
00403 #define ETAG_INODE (1 << 2)
00404 #define ETAG_SIZE (1 << 3)
00405 #define ETAG_BACKWARD (ETAG_MTIME | ETAG_INODE | ETAG_SIZE)
00406 #define ETAG_ALL (ETAG_MTIME | ETAG_INODE | ETAG_SIZE)
00407
00411 typedef enum {
00412 srv_sig_unset,
00413 srv_sig_off,
00414 srv_sig_on,
00415 srv_sig_withmail
00416 } server_signature_e;
00417
00421 typedef struct {
00423 char *d;
00425 unsigned d_components;
00426
00434 allow_options_t opts;
00435 allow_options_t opts_add;
00436 allow_options_t opts_remove;
00437 overrides_t override;
00438 allow_options_t override_opts;
00439
00440
00441
00442
00443
00444
00445 char *ap_default_type;
00446
00447
00448
00449
00450
00451
00452
00453 char **response_code_strings;
00454
00455
00456
00457 #define HOSTNAME_LOOKUP_OFF 0
00458 #define HOSTNAME_LOOKUP_ON 1
00459 #define HOSTNAME_LOOKUP_DOUBLE 2
00460 #define HOSTNAME_LOOKUP_UNSET 3
00461 unsigned int hostname_lookups : 4;
00462
00463 signed int content_md5 : 2;
00464
00465 #define USE_CANONICAL_NAME_OFF (0)
00466 #define USE_CANONICAL_NAME_ON (1)
00467 #define USE_CANONICAL_NAME_DNS (2)
00468 #define USE_CANONICAL_NAME_UNSET (3)
00469 unsigned use_canonical_name : 2;
00470
00471
00472
00473
00474
00475 unsigned d_is_fnmatch : 1;
00476
00477
00478
00479
00480 #define ADD_DEFAULT_CHARSET_OFF (0)
00481 #define ADD_DEFAULT_CHARSET_ON (1)
00482 #define ADD_DEFAULT_CHARSET_UNSET (2)
00483 unsigned add_default_charset : 2;
00484 const char *add_default_charset_name;
00485
00486
00487 #ifdef RLIMIT_CPU
00488 struct rlimit *limit_cpu;
00489 #endif
00490 #if defined (RLIMIT_DATA) || defined (RLIMIT_VMEM) || defined(RLIMIT_AS)
00491 struct rlimit *limit_mem;
00492 #endif
00493 #ifdef RLIMIT_NPROC
00494 struct rlimit *limit_nproc;
00495 #endif
00496 apr_off_t limit_req_body;
00497 long limit_xml_body;
00498
00499
00500
00501 server_signature_e server_signature;
00502
00503 int loglevel;
00504
00505
00506 apr_array_header_t *sec_file;
00507 ap_regex_t *r;
00508
00509 const char *mime_type;
00510 const char *handler;
00511 const char *output_filters;
00512 const char *input_filters;
00513 int accept_path_info;
00514
00515 apr_hash_t *ct_output_filters;
00516
00517
00518
00519
00520 etag_components_t etag_bits;
00521 etag_components_t etag_add;
00522 etag_components_t etag_remove;
00523
00524
00525
00526
00527 #define ENABLE_MMAP_OFF (0)
00528 #define ENABLE_MMAP_ON (1)
00529 #define ENABLE_MMAP_UNSET (2)
00530 unsigned int enable_mmap : 2;
00531
00532 #define ENABLE_SENDFILE_OFF (0)
00533 #define ENABLE_SENDFILE_ON (1)
00534 #define ENABLE_SENDFILE_UNSET (2)
00535 unsigned int enable_sendfile : 2;
00536 unsigned int allow_encoded_slashes : 1;
00537
00538
00539 #define USE_CANONICAL_PHYS_PORT_OFF (0)
00540 #define USE_CANONICAL_PHYS_PORT_ON (1)
00541 #define USE_CANONICAL_PHYS_PORT_UNSET (2)
00542 unsigned use_canonical_phys_port : 2;
00543
00544 } core_dir_config;
00545
00546
00547
00548 typedef struct {
00549
00550 #ifdef GPROF
00551 char *gprof_dir;
00552 #endif
00553
00554
00555
00556
00557
00558 const char *ap_document_root;
00559
00560
00561
00562 char *access_name;
00563 apr_array_header_t *sec_dir;
00564 apr_array_header_t *sec_url;
00565
00566
00567 int redirect_limit;
00568 int subreq_limit;
00569
00570 const char *protocol;
00571 apr_table_t *accf_map;
00572
00573
00574 #define AP_TRACE_UNSET -1
00575 #define AP_TRACE_DISABLE 0
00576 #define AP_TRACE_ENABLE 1
00577 #define AP_TRACE_EXTENDED 2
00578 int trace_enable;
00579
00580 } core_server_config;
00581
00582
00583 void ap_add_output_filters_by_type(request_rec *r);
00584
00585
00586 void ap_core_reorder_directories(apr_pool_t *, server_rec *);
00587
00588
00589 AP_CORE_DECLARE(void) ap_add_per_dir_conf(server_rec *s, void *dir_config);
00590 AP_CORE_DECLARE(void) ap_add_per_url_conf(server_rec *s, void *url_config);
00591 AP_CORE_DECLARE(void) ap_add_file_conf(core_dir_config *conf, void *url_config);
00592 AP_CORE_DECLARE_NONSTD(const char *) ap_limit_section(cmd_parms *cmd, void *dummy, const char *arg);
00593
00594
00595 int ap_core_input_filter(ap_filter_t *f, apr_bucket_brigade *b,
00596 ap_input_mode_t mode, apr_read_type_e block,
00597 apr_off_t readbytes);
00598 apr_status_t ap_core_output_filter(ap_filter_t *f, apr_bucket_brigade *b);
00599
00600 #endif
00601
00602 AP_DECLARE(const char*) ap_get_server_protocol(server_rec* s);
00603 AP_DECLARE(void) ap_set_server_protocol(server_rec* s, const char* proto);
00604
00605
00606
00607
00608
00609
00610 typedef enum {
00611 ap_mgmt_type_string,
00612 ap_mgmt_type_long,
00613 ap_mgmt_type_hash
00614 } ap_mgmt_type_e;
00615
00616 typedef union {
00617 const char *s_value;
00618 long i_value;
00619 apr_hash_t *h_value;
00620 } ap_mgmt_value;
00621
00622 typedef struct {
00623 const char *description;
00624 const char *name;
00625 ap_mgmt_type_e vtype;
00626 ap_mgmt_value v;
00627 } ap_mgmt_item_t;
00628
00629
00630 extern AP_DECLARE_DATA ap_filter_rec_t *ap_subreq_core_filter_handle;
00631 extern AP_DECLARE_DATA ap_filter_rec_t *ap_core_output_filter_handle;
00632 extern AP_DECLARE_DATA ap_filter_rec_t *ap_content_length_filter_handle;
00633 extern AP_DECLARE_DATA ap_filter_rec_t *ap_core_input_filter_handle;
00634
00648 AP_DECLARE_HOOK(int, get_mgmt_items,
00649 (apr_pool_t *p, const char * val, apr_hash_t *ht))
00650
00651
00652
00653
00654
00655
00656
00657
00658 APR_DECLARE_OPTIONAL_FN(void, ap_logio_add_bytes_out,
00659 (conn_rec *c, apr_off_t bytes));
00660
00661
00662
00663
00664
00665
00666 APR_DECLARE_OPTIONAL_FN(const char *, ap_ident_lookup,
00667 (request_rec *r));
00668
00669
00670
00671
00672
00673
00674 APR_DECLARE_OPTIONAL_FN(int, authz_some_auth_required, (request_rec *r));
00675 APR_DECLARE_OPTIONAL_FN(const char *, authn_ap_auth_type, (request_rec *r));
00676 APR_DECLARE_OPTIONAL_FN(const char *, authn_ap_auth_name, (request_rec *r));
00677
00678
00679
00680
00681
00682
00683 APR_DECLARE_OPTIONAL_FN(int, access_compat_ap_satisfies, (request_rec *r));
00684
00685
00686
00687 #ifdef __cplusplus
00688 }
00689 #endif
00690
00691 #endif
00692