~ubuntu-branches/ubuntu/lucid/fpc/lucid-proposed

« back to all changes in this revision

Viewing changes to fpcsrc/packages/httpd22/src/http_core.inc

  • Committer: Bazaar Package Importer
  • Author(s): Mazen Neifer, Torsten Werner, Mazen Neifer
  • Date: 2008-10-09 23:29:00 UTC
  • mfrom: (4.1.1 sid)
  • Revision ID: james.westby@ubuntu.com-20081009232900-553f61m37jkp6upv
Tags: 2.2.2-4
[ Torsten Werner ]
* Update ABI version in fpc-depends automatically.
* Remove empty directories from binary package fpc-source.

[ Mazen Neifer ]
* Removed leading path when calling update-alternatives to remove a Linitian
  error.
* Fixed clean target.
* Improved description of packages. (Closes: #498882)

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
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
 
7
 *
 
8
 *     http://www.apache.org/licenses/LICENSE-2.0
 
9
 *
 
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.
 
15
 }
 
16
 
 
17
//#include "apr.h"
 
18
{$include apr/apr_hash.inc}
 
19
{#include "apr_optional.h"}
 
20
{$include util_filter.inc}
 
21
 
 
22
{#if APR_HAVE_STRUCT_RLIMIT
 
23
#include <sys/time.h>
 
24
#include <sys/resource.h>
 
25
#endif}
 
26
 
 
27
{
 
28
 * @package CORE HTTP Daemon
 
29
 }
 
30
 
 
31
{ ****************************************************************
 
32
 *
 
33
 * The most basic server code is encapsulated in a single module
 
34
 * known as the core, which is just *barely* functional enough to
 
35
 * serve documents, though not terribly well.
 
36
 *
 
37
 * Largely for NCSA back-compatibility reasons, the core needs to
 
38
 * make pieces of its config structures available to other modules.
 
39
 * The accessors are declared here, along with the interpretation
 
40
 * of one of them (allow_options).
 
41
 }
 
42
 
 
43
const
 
44
{ No directives }
 
45
  OPT_NONE = 0;
 
46
{ Indexes directive }
 
47
  OPT_INDEXES = 1;
 
48
{  Includes directive }
 
49
  OPT_INCLUDES = 2;
 
50
{  FollowSymLinks directive }
 
51
  OPT_SYM_LINKS = 4;
 
52
{  ExecCGI directive }
 
53
  OPT_EXECCGI = 8;
 
54
{  directive unset }
 
55
  OPT_UNSET = 16;
 
56
{  IncludesNOEXEC directive }
 
57
  OPT_INCNOEXEC = 32;
 
58
{ SymLinksIfOwnerMatch directive }
 
59
  OPT_SYM_OWNER = 64;
 
60
{ MultiViews directive }
 
61
  OPT_MULTI = 128;
 
62
{  All directives }
 
63
  OPT_ALL = (OPT_INDEXES or OPT_INCLUDES or OPT_SYM_LINKS or OPT_EXECCGI);
 
64
 
 
65
{
 
66
 * @defgroup get_remote_host Remote Host Resolution
 
67
 * @ingroup APACHE_CORE_HTTPD
 
68
 }
 
69
{ REMOTE_HOST returns the hostname, or NULL if the hostname
 
70
 * lookup fails.  It will force a DNS lookup according to the
 
71
 * HostnameLookups setting.
 
72
 }
 
73
  REMOTE_HOST = (0);
 
74
 
 
75
{ REMOTE_NAME returns the hostname, or the dotted quad if the
 
76
 * hostname lookup fails.  It will force a DNS lookup according
 
77
 * to the HostnameLookups setting.
 
78
 }
 
79
  REMOTE_NAME = (1);
 
80
 
 
81
{ REMOTE_NOLOOKUP is like REMOTE_NAME except that a DNS lookup is
 
82
 * never forced.
 
83
 }
 
84
  REMOTE_NOLOOKUP = (2);
 
85
 
 
86
{ REMOTE_DOUBLE_REV will always force a DNS lookup, and also force
 
87
 * a double reverse lookup, regardless of the HostnameLookups
 
88
 * setting.  The result is the (double reverse checked) hostname,
 
89
 * or NULL if any of the lookups fail.
 
90
 }
 
91
  REMOTE_DOUBLE_REV = (3);
 
92
 
 
93
{ all of the requirements must be met }
 
94
  SATISFY_ALL = 0;
 
95
{  any of the requirements must be met }
 
96
  SATISFY_ANY = 1;
 
97
{ There are no applicable satisfy lines }
 
98
  SATISFY_NOSPEC = 2;
 
99
 
 
100
{ Make sure we don't write less than 8000 bytes at any one time.
 
101
 }
 
102
  AP_MIN_BYTES_TO_WRITE  = 8000;
 
103
 
 
104
{ default maximum of internal redirects }
 
105
  AP_DEFAULT_MAX_INTERNAL_REDIRECTS = 10;
 
106
 
 
107
{ default maximum subrequest nesting level }
 
108
  AP_DEFAULT_MAX_SUBREQ_DEPTH = 10;
 
109
 
 
110
{
 
111
 * Retrieve the value of Options for this request
 
112
 * @param r The current request
 
113
 * @return the Options bitmask
 
114
 * @deffunc int ap_allow_options(request_rec *r)
 
115
 }
 
116
function ap_allow_options(r: Prequest_rec): Integer;
 
117
 {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
 
118
 external LibHTTPD name LibNamePrefix + 'ap_allow_options' + LibSuff4;
 
119
 
 
120
{
 
121
 * Retrieve the value of the AllowOverride for this request
 
122
 * @param r The current request
 
123
 * @return the overrides bitmask
 
124
 * @deffunc int ap_allow_overrides(request_rec *r)
 
125
 }
 
126
function ap_allow_overrides(r: Prequest_rec): Integer;
 
127
 {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
 
128
 external LibHTTPD name LibNamePrefix + 'ap_allow_overrides' + LibSuff4;
 
129
 
 
130
{
 
131
 * Retrieve the value of the DefaultType directive, or text/plain if not set
 
132
 * @param r The current request
 
133
 * @return The default type
 
134
 * @deffunc const char *ap_default_type(request_rec *r)
 
135
 }
 
136
function ap_default_type(r: Prequest_rec): PChar;
 
137
 {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
 
138
 external LibHTTPD name LibNamePrefix + 'ap_default_type' + LibSuff4;
 
139
 
 
140
{
 
141
 * Retrieve the document root for this server
 
142
 * @param r The current request
 
143
 * @warning Don't use this!  If your request went through a Userdir, or 
 
144
 * something like that, it'll screw you.  But it's back-compatible...
 
145
 * @return The document root
 
146
 * @deffunc const char *ap_document_root(request_rec *r)
 
147
 }
 
148
function ap_document_root(r: Prequest_rec): PChar;
 
149
 {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
 
150
 external LibHTTPD name LibNamePrefix + 'ap_document_root' + LibSuff4;
 
151
 
 
152
{
 
153
 * Lookup the remote client's DNS name or IP address
 
154
 * @param conn The current connection
 
155
 * @param dir_config The directory config vector from the request
 
156
 * @param type The type of lookup to perform.  One of:
 
157
 * <pre>
 
158
 *     REMOTE_HOST returns the hostname, or NULL if the hostname
 
159
 *                 lookup fails.  It will force a DNS lookup according to the
 
160
 *                 HostnameLookups setting.
 
161
 *     REMOTE_NAME returns the hostname, or the dotted quad if the
 
162
 *                 hostname lookup fails.  It will force a DNS lookup according
 
163
 *                 to the HostnameLookups setting.
 
164
 *     REMOTE_NOLOOKUP is like REMOTE_NAME except that a DNS lookup is
 
165
 *                     never forced.
 
166
 *     REMOTE_DOUBLE_REV will always force a DNS lookup, and also force
 
167
 *                   a double reverse lookup, regardless of the HostnameLookups
 
168
 *                   setting.  The result is the (double reverse checked) 
 
169
 *                   hostname, or NULL if any of the lookups fail.
 
170
 * </pre>
 
171
 * @param str_is_ip unless NULL is passed, this will be set to non-zero on output when an IP address 
 
172
 *        string is returned
 
173
 * @return The remote hostname
 
174
 * @deffunc const char *ap_get_remote_host(conn_rec *conn, void *dir_config, int type, int *str_is_ip)
 
175
 }
 
176
function ap_get_remote_host(conn: Pconn_rec; dir_config: Pointer;
 
177
  _type: Integer; str_is_ip: PInteger): PChar;
 
178
 {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
 
179
 external LibHTTPD name LibNamePrefix + 'ap_get_remote_host' + LibSuff16;
 
180
 
 
181
{
 
182
 * Retrieve the login name of the remote user.  Undef if it could not be
 
183
 * determined
 
184
 * @param r The current request
 
185
 * @return The user logged in to the client machine
 
186
 * @deffunc const char *ap_get_remote_logname(request_rec *r)
 
187
 }
 
188
function ap_get_remote_logname(r: Prequest_rec): PChar;
 
189
 {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
 
190
 external LibHTTPD name LibNamePrefix + 'ap_get_remote_logname' + LibSuff4;
 
191
 
 
192
{ Used for constructing self-referencing URLs, and things like SERVER_PORT,
 
193
 * and SERVER_NAME.
 
194
 }
 
195
{
 
196
 * build a fully qualified URL from the uri and information in the request rec
 
197
 * @param p The pool to allocate the URL from
 
198
 * @param uri The path to the requested file
 
199
 * @param r The current request
 
200
 * @return A fully qualified URL
 
201
 * @deffunc char *ap_construct_url(apr_pool_t *p, const char *uri, request_rec *r)
 
202
 }
 
203
function ap_construct_url(p: Papr_pool_t; const uri: PChar; r: Prequest_rec): PChar;
 
204
 {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
 
205
 external LibHTTPD name LibNamePrefix + 'ap_construct_url' + LibSuff12;
 
206
 
 
207
{
 
208
 * Get the current server name from the request
 
209
 * @param r The current request
 
210
 * @return the server name
 
211
 * @deffunc const char *ap_get_server_name(request_rec *r)
 
212
 }
 
213
function ap_get_server_name(r: Prequest_rec): PChar;
 
214
 {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
 
215
 external LibHTTPD name LibNamePrefix + 'ap_get_server_name' + LibSuff4;
 
216
 
 
217
{
 
218
 * Get the current server port
 
219
 * @param The current request
 
220
 * @return The server's port
 
221
 * @deffunc apr_port_t ap_get_server_port(const request_rec *r)
 
222
 }
 
223
function ap_get_server_port(r: Prequest_rec): apr_port_t;
 
224
 {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
 
225
 external LibHTTPD name LibNamePrefix + 'ap_get_server_port' + LibSuff4;
 
226
 
 
227
{
 
228
 * Return the limit on bytes in request msg body 
 
229
 * @param r The current request
 
230
 * @return the maximum number of bytes in the request msg body
 
231
 * @deffunc apr_off_t ap_get_limit_req_body(const request_rec *r)
 
232
 }
 
233
function ap_get_limit_req_body(r: Prequest_rec): apr_off_t;
 
234
 {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
 
235
 external LibHTTPD name LibNamePrefix + 'ap_get_limit_req_body' + LibSuff4;
 
236
 
 
237
{
 
238
 * Return the limit on bytes in XML request msg body
 
239
 * @param r The current request
 
240
 * @return the maximum number of bytes in XML request msg body
 
241
 * @deffunc size_t ap_get_limit_xml_body(const request_rec *r)
 
242
 }
 
243
function ap_get_limit_xml_body(r: Prequest_rec): size_t;
 
244
 {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
 
245
 external LibHTTPD name LibNamePrefix + 'ap_get_limit_xml_body' + LibSuff4;
 
246
 
 
247
{
 
248
 * Install a custom response handler for a given status
 
249
 * @param r The current request
 
250
 * @param status The status for which the custom response should be used
 
251
 * @param string The custom response.  This can be a static string, a file
 
252
 *               or a URL
 
253
 }
 
254
procedure ap_custom_response(r: Prequest_rec; status: Integer; const str: PChar);
 
255
 {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
 
256
 external LibHTTPD name LibNamePrefix + 'ap_custom_response' + LibSuff12;
 
257
 
 
258
{
 
259
 * Check if the current request is beyond the configured max. number of redirects or subrequests
 
260
 * @param r The current request
 
261
 * @return true (is exceeded) or false
 
262
 * @deffunc int ap_is_recursion_limit_exceeded(const request_rec *r)
 
263
 }
 
264
function ap_is_recursion_limit_exceeded(r: Prequest_rec): Integer;
 
265
 {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
 
266
 external LibHTTPD name LibNamePrefix + 'ap_is_recursion_limit_exceeded' + LibSuff4;
 
267
 
 
268
{
 
269
 * Check for a definition from the server command line
 
270
 * @param name The define to check for
 
271
 * @return 1 if defined, 0 otherwise
 
272
 * @deffunc int ap_exists_config_define(const char *name)
 
273
 }
 
274
function ap_exists_config_define(name: PChar): Integer;
 
275
 {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
 
276
 external LibHTTPD name LibNamePrefix + 'ap_exists_config_define' + LibSuff4;
 
277
 
 
278
{ FIXME! See STATUS about how }
 
279
function ap_core_translate(r: Prequest_rec): Integer;
 
280
 cdecl; external LibHTTPD name 'ap_core_translate';
 
281
 
 
282
{ Authentication stuff.  This is one of the places where compatibility
 
283
 * with the old config files *really* hurts; they don't discriminate at
 
284
 * all between different authentication schemes, meaning that we need
 
285
 * to maintain common state for all of them in the core, and make it
 
286
 * available to the other modules through interfaces.
 
287
 }
 
288
 
 
289
{ A structure to keep track of authorization requirements }
 
290
type
 
291
  require_line = record
 
292
    { Where the require line is in the config file. }
 
293
    method_mask: apr_int64_t;
 
294
    { The complete string from the command line }
 
295
    requirement: PChar;
 
296
  end;
 
297
     
 
298
{
 
299
 * Return the type of authorization required for this request
 
300
 * @param r The current request
 
301
 * @return The authorization required
 
302
 * @deffunc const char *ap_auth_type(request_rec *r)
 
303
 }
 
304
function ap_auth_type(r: Prequest_rec): PChar;
 
305
 {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
 
306
 external LibHTTPD name LibNamePrefix + 'ap_auth_type' + LibSuff4;
 
307
 
 
308
{
 
309
 * Return the current Authorization realm
 
310
 * @param r The current request
 
311
 * @return The current authorization realm
 
312
 * @deffunc const char *ap_auth_name(request_rec *r)
 
313
 }
 
314
function ap_auth_name(r: Prequest_rec): PChar;
 
315
 {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
 
316
 external LibHTTPD name LibNamePrefix + 'ap_auth_name' + LibSuff4;
 
317
 
 
318
{
 
319
 * How the requires lines must be met.
 
320
 * @param r The current request
 
321
 * @return How the requirements must be met.  One of:
 
322
 * <pre>
 
323
 *      SATISFY_ANY    -- any of the requirements must be met.
 
324
 *      SATISFY_ALL    -- all of the requirements must be met.
 
325
 *      SATISFY_NOSPEC -- There are no applicable satisfy lines
 
326
 * </pre>
 
327
 * @deffunc int ap_satisfies(request_rec *r)
 
328
 }
 
329
function ap_satisfies(r: Prequest_rec): Integer;
 
330
 {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
 
331
 external LibHTTPD name LibNamePrefix + 'ap_satisfies' + LibSuff4;
 
332
 
 
333
{
 
334
 * Retrieve information about all of the requires directives for this request
 
335
 * @param r The current request
 
336
 * @return An array of all requires directives for this request
 
337
 * @deffunc const apr_array_header_t *ap_requires(request_rec *r)
 
338
 }
 
339
function ap_requires(p: Papr_array_header_t): Integer;
 
340
 {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
 
341
 external LibHTTPD name LibNamePrefix + 'ap_requires' + LibSuff4;
 
342
 
 
343
//#ifdef CORE_PRIVATE
 
344
 
 
345
{
 
346
 * Core is also unlike other modules in being implemented in more than
 
347
 * one file... so, data structures are declared here, even though most of
 
348
 * the code that cares really is in http_core.c.  Also, another accessor.
 
349
 }
 
350
 
 
351
//AP_DECLARE_DATA extern module core_module;
 
352
 
 
353
{ Per-request configuration }
 
354
 
 
355
type
 
356
  core_request_config = record
 
357
    { bucket brigade used by getline for look-ahead and
 
358
     * ap_get_client_block for holding left-over request body }
 
359
    bb: Papr_bucket_brigade;
 
360
 
 
361
    { an array of per-request working data elements, accessed
 
362
     * by ID using ap_get_request_note()
 
363
     * (Use ap_register_request_note() during initialization
 
364
     * to add elements)
 
365
     }
 
366
    notes: PPointer;
 
367
 
 
368
    { There is a script processor installed on the output filter chain,
 
369
     * so it needs the default_handler to deliver a (script) file into
 
370
     * the chain so it can process it. Normally, default_handler only
 
371
     * serves files on a GET request (assuming the file is actual content),
 
372
     * since other methods are not content-retrieval. This flag overrides
 
373
     * that behavior, stating that the "content" is actually a script and
 
374
     * won't actually be delivered as the response for the non-GET method.
 
375
     }
 
376
    deliver_script: Integer;
 
377
 
 
378
    { Custom response strings registered via ap_custom_response(),
 
379
     * or NULL; check per-dir config if nothing found here
 
380
     }
 
381
    response_code_strings: PPChar; { from ap_custom_response(), not from
 
382
                                   * ErrorDocument
 
383
                                   }
 
384
    { Should addition of charset= be suppressed for this request?
 
385
     }
 
386
    suppress_charset: Integer;
 
387
  end;
 
388
 
 
389
{ Standard entries that are guaranteed to be accessible via
 
390
 * ap_get_request_note() for each request (additional entries
 
391
 * can be added with ap_register_request_note())
 
392
 }
 
393
const
 
394
  AP_NOTE_DIRECTORY_WALK = 0;
 
395
  AP_NOTE_LOCATION_WALK =  1;
 
396
  AP_NOTE_FILE_WALK =      2;
 
397
  AP_NUM_STD_NOTES =       3;
 
398
 
 
399
{
 
400
 * Reserve an element in the core_request_config->notes array
 
401
 * for some application-specific data
 
402
 * @return An integer key that can be passed to ap_get_request_note()
 
403
 *         during request processing to access this element for the
 
404
 *         current request.
 
405
 }
 
406
function ap_register_request_note: apr_size_t;
 
407
 {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
 
408
 external LibHTTPD name LibNamePrefix + 'ap_register_request_note' + LibSuff0;
 
409
 
 
410
{
 
411
 * Retrieve a pointer to an element in the core_request_config->notes array
 
412
 * @param r The request
 
413
 * @param note_num  A key for the element: either a value obtained from
 
414
 *        ap_register_request_note() or one of the predefined AP_NOTE_*
 
415
 *        values.
 
416
 * @return NULL if the note_num is invalid, otherwise a pointer to the
 
417
 *         requested note element.
 
418
 * @remark At the start of a request, each note element is NULL.  The
 
419
 *         handle provided by ap_get_request_note() is a pointer-to-pointer
 
420
 *         so that the caller can point the element to some app-specific
 
421
 *         data structure.  The caller should guarantee that any such
 
422
 *         structure will last as long as the request itself.
 
423
 }
 
424
function ap_get_request_note(r: Prequest_rec; note_num: apr_size_t): PPointer;
 
425
 {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
 
426
 external LibHTTPD name LibNamePrefix + 'ap_get_request_note' + LibSuff8;
 
427
 
 
428
{ Per-directory configuration }
 
429
 
 
430
type
 
431
  allow_options_t = cuchar;
 
432
  overrides_t = cuchar;
 
433
 
 
434
{
 
435
 * Bits of info that go into making an ETag for a file
 
436
 * document.  Why a long?  Because char historically
 
437
 * proved too short for Options, and int can be different
 
438
 * sizes on different platforms.
 
439
 }
 
440
  etag_components_t = culong;
 
441
 
 
442
const
 
443
  ETAG_UNSET = 0;
 
444
  ETAG_NONE  = (1 shl 0);
 
445
  ETAG_MTIME = (1 shl 1);
 
446
  ETAG_INODE = (1 shl 2);
 
447
  ETAG_SIZE  = (1 shl 3);
 
448
  ETAG_BACKWARD = (ETAG_MTIME or ETAG_INODE or ETAG_SIZE);
 
449
  ETAG_ALL   = (ETAG_MTIME or ETAG_INODE or ETAG_SIZE);
 
450
 
 
451
  { Hostname resolution etc }
 
452
  
 
453
  HOSTNAME_LOOKUP_OFF = 0;
 
454
  HOSTNAME_LOOKUP_ON = 1;
 
455
  HOSTNAME_LOOKUP_DOUBLE = 2;
 
456
  OSTNAME_LOOKUP_UNSET = 3;
 
457
 
 
458
  { Hostname resolution etc }
 
459
 
 
460
  USE_CANONICAL_NAME_OFF   = (0);
 
461
  USE_CANONICAL_NAME_ON    = (1);
 
462
  USE_CANONICAL_NAME_DNS   = (2);
 
463
  USE_CANONICAL_NAME_UNSET = (3);
 
464
 
 
465
  { should we force a charset on any outgoing parameterless content-type?
 
466
   * if so, which charset?
 
467
   }
 
468
  ADD_DEFAULT_CHARSET_OFF   = (0);
 
469
  ADD_DEFAULT_CHARSET_ON    = (1);
 
470
  ADD_DEFAULT_CHARSET_UNSET = (2);
 
471
 
 
472
  {
 
473
   * Run-time performance tuning
 
474
   }
 
475
  ENABLE_MMAP_OFF   = (0);
 
476
  ENABLE_MMAP_ON    = (1);
 
477
  ENABLE_MMAP_UNSET = (2);
 
478
 
 
479
  ENABLE_SENDFILE_OFF   = (0);
 
480
  ENABLE_SENDFILE_ON    = (1);
 
481
  ENABLE_SENDFILE_UNSET = (2);
 
482
 
 
483
  USE_CANONICAL_PHYS_PORT_OFF   = (0);
 
484
  USE_CANONICAL_PHYS_PORT_ON    = (1);
 
485
  USE_CANONICAL_PHYS_PORT_UNSET = (2);
 
486
 
 
487
type
 
488
  server_signature_e = (
 
489
    srv_sig_unset,
 
490
    srv_sig_off,
 
491
    srv_sig_on,
 
492
    srv_sig_withmail
 
493
  );
 
494
 
 
495
  core_dir_config = record
 
496
 
 
497
    { path of the directory/regex/etc. see also d_is_fnmatch/absolute below }
 
498
    d: PChar;
 
499
    { the number of slashes in d }
 
500
    d_components: Cardinal;
 
501
 
 
502
    { If (opts & OPT_UNSET) then no absolute assignment to options has
 
503
     * been made.
 
504
     * invariant: (opts_add & opts_remove) == 0
 
505
     * Which said another way means that the last relative (options + or -)
 
506
     * assignment made to each bit is recorded in exactly one of opts_add
 
507
     * or opts_remove.
 
508
     }
 
509
    opts: allow_options_t;
 
510
    opts_add: allow_options_t;
 
511
    opts_remove: allow_options_t;
 
512
    override_: overrides_t;
 
513
    override_opts: allow_options_t;
 
514
    
 
515
    { MIME typing --- the core doesn't do anything at all with this,
 
516
     * but it does know what to slap on a request for a document which
 
517
     * goes untyped by other mechanisms before it slips out the door...
 
518
     }
 
519
    
 
520
    ap_default_type: PChar;
 
521
  
 
522
    { Authentication stuff.  Groan... }
 
523
    
 
524
    satisfy: PInteger; { for every method one }
 
525
    ap_auth_type: PChar;
 
526
    ap_auth_name: PChar;
 
527
    ap_requires: Papr_array_header_t;
 
528
 
 
529
    { Custom response config. These can contain text or a URL to redirect to.
 
530
     * if response_code_strings is NULL then there are none in the config,
 
531
     * if it's not null then it's allocated to sizeof(char*)*RESPONSE_CODES.
 
532
     * This lets us do quick merges in merge_core_dir_configs().
 
533
     }
 
534
  
 
535
    response_code_strings: PPChar; { from ErrorDocument, not from
 
536
                                   * ap_custom_response() }
 
537
 
 
538
    { Hostname resolution etc }
 
539
{    unsigned int hostname_lookups : 4; }
 
540
 
 
541
{    signed int content_md5 : 2;  }{ calculate Content-MD5? }
 
542
 
 
543
{    unsigned use_canonical_name : 2; }
 
544
 
 
545
    { since is_fnmatch(conf->d) was being called so frequently in
 
546
     * directory_walk() and its relatives, this field was created and
 
547
     * is set to the result of that call.
 
548
     }
 
549
{    unsigned d_is_fnmatch : 1; }
 
550
 
 
551
    { should we force a charset on any outgoing parameterless content-type?
 
552
     * if so, which charset?
 
553
     }
 
554
{    unsigned add_default_charset : 2; }
 
555
    add_default_charset_name: PChar;
 
556
 
 
557
    { System Resource Control }
 
558
{$ifdef RLIMIT_CPU}
 
559
    limit_cpu: Prlimit;
 
560
{$endif}
 
561
{$if defined(RLIMIT_DATA) or defined (RLIMIT_VMEM) or defined(RLIMIT_AS)}
 
562
    limit_mem: Prlimit;
 
563
{$endif}
 
564
{$ifdef RLIMIT_NPROC}
 
565
    limit_nproc: Prlimit;
 
566
{$endif}
 
567
    limit_req_body: apr_off_t;      { limit on bytes in request msg body }
 
568
    limit_xml_body: cLong;           { limit on bytes in XML request msg body }
 
569
 
 
570
    { logging options }
 
571
 
 
572
    server_signature: server_signature_e;
 
573
 
 
574
    loglevel: Integer;
 
575
    
 
576
    { Access control }
 
577
    sec_file: Papr_array_header_t;
 
578
    r: Pap_regex_t;
 
579
 
 
580
    mime_type: PChar;       { forced with ForceType  }
 
581
    handler: PChar;         { forced with SetHandler }
 
582
    output_filters: PChar;  { forced with SetOutputFilters }
 
583
    input_filters: PChar;   { forced with SetInputFilters }
 
584
    accept_path_info: Integer;        { forced with AcceptPathInfo }
 
585
 
 
586
    ct_output_filters: Papr_hash_t; { added with AddOutputFilterByType }
 
587
 
 
588
    {
 
589
     * What attributes/data should be included in ETag generation?
 
590
     }
 
591
    etag_bits: etag_components_t;
 
592
    etag_add: etag_components_t;
 
593
    etag_remove: etag_components_t;
 
594
 
 
595
    {
 
596
     * Run-time performance tuning
 
597
     }
 
598
{    unsigned int enable_mmap : 2;  }{ whether files in this dir can be mmap'ed }
 
599
 
 
600
{    unsigned int enable_sendfile : 2;  }{ files in this dir can be mmap'ed }
 
601
{    unsigned int allow_encoded_slashes : 1; }{ URLs may contain %2f w/o being
 
602
                                             * pitched indiscriminately }
 
603
{    unsigned use_canonical_phys_port : 2;}
 
604
  end;
 
605
 
 
606
{ Per-server core configuration }
 
607
 
 
608
const
 
609
  { TRACE control }
 
610
 
 
611
  AP_TRACE_UNSET    = -1;
 
612
  AP_TRACE_DISABLE  =  0;
 
613
  AP_TRACE_ENABLE   =  1;
 
614
  AP_TRACE_EXTENDED =  2;
 
615
 
 
616
type
 
617
   core_server_config = record
 
618
  
 
619
{$ifdef GPROF}
 
620
    gprof_dir: PChar;
 
621
{$endif}
 
622
 
 
623
    { Name translations --- we want the core to be able to do *something*
 
624
     * so it's at least a minimally functional web server on its own (and
 
625
     * can be tested that way).  But let's keep it to the bare minimum:
 
626
     }
 
627
    ap_document_root: PChar;
 
628
  
 
629
    { Access control }
 
630
 
 
631
    access_name: PChar;
 
632
    sec_dir: Papr_array_header_t;
 
633
    sec_url: Papr_array_header_t;
 
634
 
 
635
    { recursion backstopper }
 
636
    redirect_limit: Integer; { maximum number of internal redirects }
 
637
    subreq_limit: Integer;   { maximum nesting level of subrequests }
 
638
 
 
639
    protocol: PChar;
 
640
    accf_map: Papr_table_t;
 
641
 
 
642
    { TRACE control }
 
643
    trace_enable: Integer;
 
644
  end;
 
645
 
 
646
{ for AddOutputFiltersByType in core.c }
 
647
//void ap_add_output_filters_by_type(request_rec *r);
 
648
 
 
649
{ for http_config.c }
 
650
//void ap_core_reorder_directories(apr_pool_t *, server_rec *);
 
651
 
 
652
{ for mod_perl }
 
653
{AP_CORE_DECLARE(void) ap_add_per_dir_conf(server_rec *s, void *dir_config);
 
654
AP_CORE_DECLARE(void) ap_add_per_url_conf(server_rec *s, void *url_config);
 
655
AP_CORE_DECLARE(void) ap_add_file_conf(core_dir_config *conf, void *url_config);
 
656
AP_CORE_DECLARE_NONSTD(const char *) ap_limit_section(cmd_parms *cmd, void *dummy, const char *arg);}
 
657
 
 
658
{ Core filters; not exported. }
 
659
{int ap_core_input_filter(ap_filter_t *f, apr_bucket_brigade *b,
 
660
                         ap_input_mode_t mode, apr_read_type_e block,
 
661
                         apr_off_t readbytes);
 
662
apr_status_t ap_core_output_filter(ap_filter_t *f, apr_bucket_brigade *b);
 
663
 
 
664
#endif} { CORE_PRIVATE }
 
665
 
 
666
//AP_DECLARE(const char*) ap_get_server_protocol(server_rec* s);
 
667
//AP_DECLARE(void) ap_set_server_protocol(server_rec* s, const char* proto);
 
668
 
 
669
 
 
670
{ ----------------------------------------------------------------------
 
671
 *
 
672
 * Runtime status/management
 
673
 }
 
674
 
 
675
type
 
676
  ap_mgmt_type_e = (
 
677
    ap_mgmt_type_string,
 
678
    ap_mgmt_type_long,
 
679
    ap_mgmt_type_hash
 
680
  );
 
681
 
 
682
  ap_mgmt_value = record
 
683
    case Integer of
 
684
     0: (s_value: PChar);
 
685
     1: (i_value: cLong);
 
686
     2: (h_value: Papr_hash_t);
 
687
  end;
 
688
 
 
689
  ap_mgmt_item_t = record
 
690
    description: PChar;
 
691
    name: PChar;
 
692
    vtype: ap_mgmt_type_e;
 
693
    v: ap_mgmt_value;
 
694
  end;
 
695
 
 
696
{ Handles for core filters }
 
697
{extern AP_DECLARE_DATA ap_filter_rec_t *ap_subreq_core_filter_handle;
 
698
extern AP_DECLARE_DATA ap_filter_rec_t *ap_core_output_filter_handle;
 
699
extern AP_DECLARE_DATA ap_filter_rec_t *ap_content_length_filter_handle;
 
700
extern AP_DECLARE_DATA ap_filter_rec_t *ap_core_input_filter_handle;}
 
701
 
 
702
{
 
703
 * This hook provdes a way for modules to provide metrics/statistics about
 
704
 * their operational status.
 
705
 *
 
706
 * @param p A pool to use to create entries in the hash table
 
707
 * @param val The name of the parameter(s) that is wanted. This is
 
708
 *            tree-structured would be in the form ('*' is all the tree,
 
709
 *            'module.*' all of the module , 'module.foo.*', or
 
710
 *            'module.foo.bar' )
 
711
 * @param ht The hash table to store the results. Keys are item names, and
 
712
 *           the values point to ap_mgmt_item_t structures.
 
713
 * @ingroup hooks
 
714
 }
 
715
type
 
716
  ap_HOOK_get_mgmt_items_t = function(p: Papr_pool_t; const val: PChar;
 
717
    ht: Papr_hash_t): Integer; cdecl;
 
718
 
 
719
procedure ap_hook_get_mgmt_items(pf: ap_HOOK_get_mgmt_items_t;
 
720
 const aszPre: PPChar; const aszSucc: PPChar; nOrder: Integer);
 
721
 {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
 
722
 external LibHTTPD name LibNamePrefix + 'ap_hook_get_mgmt_items' + LibSuff16;
 
723
 
 
724
{ ---------------------------------------------------------------------- }
 
725
 
 
726
{ ----------------------------------------------------------------------
 
727
 *
 
728
 * I/O logging with mod_logio
 
729
 }
 
730
 
 
731
{APR_DECLARE_OPTIONAL_FN(void, ap_logio_add_bytes_out,
 
732
                        (conn_rec *c, apr_off_t bytes));}
 
733
 
 
734
{ ----------------------------------------------------------------------
 
735
 *
 
736
 * ident lookups with mod_ident
 
737
 }
 
738
 
 
739
{APR_DECLARE_OPTIONAL_FN(const char *, ap_ident_lookup,
 
740
                        (request_rec *r));}
 
741