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
8
* http://www.apache.org/licenses/LICENSE-2.0
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.
17
{****************************************************************
19
* The most basic server code is encapsulated in a single module
20
* known as the core, which is just *barely* functional enough to
21
* serve documents, though not terribly well.
23
* Largely for NCSA back-compatibility reasons, the core needs to
24
* make pieces of its config structures available to other modules.
25
* The accessors are declared here, along with the interpretation
26
* of one of them (allow_options).
39
OPT_ALL = (OPT_INDEXES or OPT_INCLUDES or OPT_SYM_LINKS or OPT_EXECCGI);
41
{ options for get_remote_host() }
42
{ REMOTE_HOST returns the hostname, or NULL if the hostname
43
* lookup fails. It will force a DNS lookup according to the
44
* HostnameLookups setting.
48
{ REMOTE_NAME returns the hostname, or the dotted quad if the
49
* hostname lookup fails. It will force a DNS lookup according
50
* to the HostnameLookups setting.
54
{ REMOTE_NOLOOKUP is like REMOTE_NAME except that a DNS lookup is
57
REMOTE_NOLOOKUP = (2);
59
{ REMOTE_DOUBLE_REV will always force a DNS lookup, and also force
60
* a double reverse lookup, regardless of the HostnameLookups
61
* setting. The result is the (double reverse checked) hostname,
62
* or NULL if any of the lookups fail.
64
REMOTE_DOUBLE_REV = (3);
70
{ default maximum of internal redirects }
71
AP_DEFAULT_MAX_INTERNAL_REDIRECTS = 20;
73
{ default maximum subrequest nesting level }
74
AP_DEFAULT_MAX_SUBREQ_DEPTH = 20;
76
function ap_allow_options(r: Prequest_rec): cint;
77
{$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF} external LibHTTPD;
79
function ap_allow_overrides(r: Prequest_rec): cint;
80
{$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF} external LibHTTPD;
82
function ap_default_type(r: Prequest_rec): PChar;
83
{$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF} external LibHTTPD;
85
function ap_document_root(r: Prequest_rec): PChar;
86
{$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF} external LibHTTPD;
87
{ Don't use this! If your request went
88
* through a Userdir, or something like
89
* that, it'll screw you. But it's
93
function ap_get_remote_host(conn: Pconn_rec; dir_config: Pointer; type_: cint): PChar;
94
{$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF} external LibHTTPD;
96
function ap_get_remote_logname(r: Prequest_rec): PChar;
97
{$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF} external LibHTTPD;
99
{ Used for constructing self-referencing URLs, and things like SERVER_PORT,
102
function ap_construct_url(p: Ppool; const uri: PChar; r: Prequest_rec): PChar;
103
{$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF} external LibHTTPD;
105
function ap_get_server_name(r: Prequest_rec): PChar;
106
{$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF} external LibHTTPD;
108
function ap_get_server_port(const r: Prequest_rec): cuint;
109
{$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF} external LibHTTPD;
111
function ap_get_limit_req_body(const r: Prequest_rec): culong;
112
{$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF} external LibHTTPD;
114
procedure ap_custom_response(r: Prequest_rec; status: cint; string_: PChar);
115
{$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF} external LibHTTPD;
117
function ap_exists_config_define(name: PChar): cint;
118
{$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF} external LibHTTPD;
120
{ Check if the current request is beyond the configured max. number of redirects or subrequests
121
* @param r The current request
122
* @return true (is exceeded) or false
124
function ap_is_recursion_limit_exceeded(const r: Prequest_rec): cint;
125
{$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF} external LibHTTPD;
127
{ Authentication stuff. This is one of the places where compatibility
128
* with the old config files *really* hurts; they don't discriminate at
129
* all between different authentication schemes, meaning that we need
130
* to maintain common state for all of them in the core, and make it
131
* available to the other modules through interfaces.
135
require_line = record
140
{API_EXPORT(const char *) ap_auth_type (request_rec *);
141
API_EXPORT(const char *) ap_auth_name (request_rec *);
142
API_EXPORT(const char *) ap_auth_nonce (request_rec *);
143
API_EXPORT(int) ap_satisfies (request_rec *r);
144
API_EXPORT(const array_header *) ap_requires (request_rec *); }
148
* CGI Script stuff for Win32...
151
file_type_e = ( eFileTypeUNKNOWN, eFileTypeBIN, eFileTypeEXE16, eFileTypeEXE32,
152
eFileTypeSCRIPT, eCommandShell16, eCommandShell32 );
153
interpreter_source_e = ( INTERPRETER_SOURCE_UNSET, INTERPRETER_SOURCE_REGISTRY,
154
INTERPRETER_SOURCE_SHEBANG );
156
function ap_get_win32_interpreter(const param1: Prequest_rec; param2: PPChar): file_type_e;
157
{$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF} external LibHTTPD;
160
{.$ifdef CORE_PRIVATE}
163
* Core is also unlike other modules in being implemented in more than
164
* one file... so, data structures are declared here, even though most of
165
* the code that cares really is in http_core.c. Also, another accessor.
168
//API_EXPORT(char *) ap_response_code_string (request_rec *r, int error_index);
170
//extern API_VAR_EXPORT module core_module;
172
{ Per-directory configuration }
175
allow_options_t = Char;
179
* Bits of info that go into making an ETag for a file
180
* document. Why a long? Because char historically
181
* proved too short for Options, and int can be different
182
* sizes on different platforms.
184
etag_components_t = culong;
188
ETAG_NONE = (1 shl 0);
189
ETAG_MTIME = (1 shl 1);
190
ETAG_INODE = (1 shl 2);
191
ETAG_SIZE = (1 shl 3);
192
ETAG_BACKWARD = (ETAG_MTIME or ETAG_INODE or ETAG_SIZE);
193
ETAG_ALL = (ETAG_MTIME or ETAG_INODE or ETAG_SIZE);
197
HOSTNAME_LOOKUP_OFF = 0;
198
HOSTNAME_LOOKUP_ON = 1;
199
HOSTNAME_LOOKUP_DOUBLE= 2;
200
HOSTNAME_LOOKUP_UNSET = 3;
202
USE_CANONICAL_NAME_OFF = (0);
203
USE_CANONICAL_NAME_ON = (1);
204
USE_CANONICAL_NAME_DNS = (2);
205
USE_CANONICAL_NAME_UNSET= (3);
207
ADD_DEFAULT_CHARSET_OFF = (0);
208
ADD_DEFAULT_CHARSET_ON = (1);
209
ADD_DEFAULT_CHARSET_UNSET = (2);
211
{$ifdef CHARSET_EBCDIC}
213
{ Configurable EBCDIC Conversion stuff }
214
{ Direction specific conversion: }
215
dir_Out = 0; { 0utput (returned contents in a GET or POST) }
216
dir_In = 1; { 1nput (uploaded contents in a PUT / POST) }
218
{ Conversion Enabled/Disabled: }
219
conv_Unset = '?'; { Conversion unconfigured }
220
conv_Off = '0'; { BINARY or ASCII file (no conversion) }
221
conv_On = '1'; { TEXT file (EBCDIC->ASCII for dir_Out; ASCII->EBCDIC for dir_In) }
223
LEGACY_KLUDGE = 1; { After a couple of versions this legacy kludge should be set to 0 }
224
ASCIITEXT_MAGIC_TYPE_PREFIX = 'text/x-ascii-'; { Text files whose content-type starts with this are passed thru unconverted }
235
server_signature_t = ( srv_sig_unset, srv_sig_off, srv_sig_on,
239
core_dir_config = record
240
{ path of the directory/regex/etc. see also d_is_fnmatch below }
242
{ the number of slashes in d }
245
{ If (opts & OPT_UNSET) then no absolute assignment to options has
247
* invariant: (opts_add & opts_remove) == 0
248
* Which said another way means that the last relative (options + or -)
249
* assignment made to each bit is recorded in exactly one of opts_add
252
opts: allow_options_t;
253
opts_add: allow_options_t;
254
opts_remove: allow_options_t;
255
override_: overrides_t;
257
{ MIME typing --- the core doesn't do anything at all with this,
258
* but it does know what to slap on a request for a document which
259
* goes untyped by other mechanisms before it slips out the door...
262
ap_default_type: PChar;
264
{ Authentication stuff. Groan... }
269
ap_requires: Parray_header;
271
{ Custom response config. These can contain text or a URL to redirect to.
272
* if response_code_strings is NULL then there are none in the config,
273
* if it's not null then it's allocated to sizeof(char*)*RESPONSE_CODES.
274
* This lets us do quick merges in merge_core_dir_configs().
277
response_code_strings: PPChar; { from ErrorDocument, not from
278
* ap_custom_response()
281
{ Hostname resolution etc }
285
// unsigned int hostname_lookups : 4;
287
// signed int do_rfc1413 : 2; { See if client is advertising a username? }
289
// signed int content_md5 : 2; { calculate Content-MD5? }
293
// unsigned use_canonical_name : 2;
295
{ since is_fnmatch(conf->d) was being called so frequently in
296
* directory_walk() and its relatives, this field was created and
297
* is set to the result of that call.
299
// unsigned d_is_fnmatch : 1;
301
{ should we force a charset on any outgoing parameterless content-type?
302
* if so, which charset?
307
// unsigned add_default_charset : 2;
308
add_default_charset_name: PChar;
310
{ System Resource Control }
314
{$if defined(RLIMIT_DATA) or defined(RLIMIT_VMEM) or defined(RLIMIT_AS)}
317
{$ifdef RLIMIT_NPROC}
318
limit_nproc: Prlimit;
320
limit_req_body: culong; { limit on bytes in request msg body }
323
server_signature: server_signature_t;
331
{ Where to find interpreter to run scripts }
332
script_interpreter_source: interpreter_source_e;
335
{$ifdef CHARSET_EBCDIC}
339
{ The configuration args {On|Off}[={In|Out|InOut}] are currently stored
340
* as character strings ("0" = conv_Off, "1" = conv_On)
342
ebcdicconversion_by_ext_in: Ptable;
343
ebcdicconversion_by_ext_out: Ptable;
344
ebcdicconversion_by_type_in: Ptable;
345
ebcdicconversion_by_type_out: Ptable;
349
x_ascii_magic_kludge: cint; { whether to handle the text/x-ascii- kludge }
351
{$ifdef ADD_EBCDICCONVERT_DEBUG_HEADER}
352
ebcdicconversion_debug_header: cint; { whether to add an X-EBCDIC-Debug-{In,Out} header to the response }
354
{$endif} { CHARSET_EBCDIC }
357
* What attributes/data should be included in ETag generation?
359
etag_bits: etag_components_t;
360
etag_add: etag_components_t;
361
etag_remove: etag_components_t;
364
* Do we allow ISINDEX CGI scripts to pass their query argument as
365
* direct command line parameters or argv elements?
367
cgi_command_args: ap_flag_e;
370
ap_auth_nonce: PChar;
374
{ Per-server core configuration }
377
core_server_config = record
383
{ Name translations --- we want the core to be able to do *something*
384
* so it's at least a minimally functional web server on its own (and
385
* can be tested that way). But let's keep it to the bare minimum:
387
ap_document_root: PChar;
393
sec_url: Parray_header;
395
{ recursion backstopper }
396
recursion_limit_set: cint; { boolean }
397
redirect_limit: cint; { maximum number of internal redirects }
398
subreq_limit: cint; { maximum nesting level of subrequests }
401
trace_enable: cint; { see AP_TRACE_ below }
405
{ trace_enable options }
408
AP_TRACE_DISABLE = 0;
410
AP_TRACE_EXTENDED = 2;
412
{ for http_config.c }
413
//CORE_EXPORT(void) ap_core_reorder_directories(pool *, server_rec *);
416
//CORE_EXPORT(void) ap_add_per_dir_conf (server_rec *s, void *dir_config);
417
//CORE_EXPORT(void) ap_add_per_url_conf (server_rec *s, void *url_config);
418
//CORE_EXPORT(void) ap_add_file_conf(core_dir_config *conf, void *url_config);
419
//CORE_EXPORT_NONSTD(const char *) ap_limit_section (cmd_parms *cmd, void *dummy, const char *arg);