~ubuntu-branches/debian/lenny/fpc/lenny

« back to all changes in this revision

Viewing changes to fpcsrc/packages/base/httpd/httpd-1.3/http_core.inc

  • Committer: Bazaar Package Importer
  • Author(s): Mazen Neifer, Torsten Werner, Mazen Neifer
  • Date: 2008-05-17 17:12:11 UTC
  • mfrom: (3.1.9 intrepid)
  • Revision ID: james.westby@ubuntu.com-20080517171211-9qi33xhd9evfa0kg
Tags: 2.2.0-dfsg1-9
[ Torsten Werner ]
* Add Mazen Neifer to Uploaders field.

[ Mazen Neifer ]
* Moved FPC sources into a version dependent directory from /usr/share/fpcsrc
  to /usr/share/fpcsrc/${FPCVERSION}. This allow installing more than on FPC
  release.
* Fixed far call issue in compiler preventing building huge binearies.
  (closes: #477743)
* Updated building dependencies, recomennded and suggested packages.
* Moved fppkg to fp-utils as it is just a helper tool and is not required by
  compiler.

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
{****************************************************************
 
18
 *
 
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.
 
22
 *
 
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).
 
27
 }
 
28
 
 
29
const
 
30
  OPT_NONE = 0;
 
31
  OPT_INDEXES = 1;
 
32
  OPT_INCLUDES = 2;
 
33
  OPT_SYM_LINKS = 4;
 
34
  OPT_EXECCGI = 8;
 
35
  OPT_UNSET = 16;
 
36
  OPT_INCNOEXEC = 32;
 
37
  OPT_SYM_OWNER = 64;
 
38
  OPT_MULTI = 128;
 
39
  OPT_ALL = (OPT_INDEXES or OPT_INCLUDES or OPT_SYM_LINKS or OPT_EXECCGI);
 
40
 
 
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.
 
45
 }
 
46
  REMOTE_HOST = (0);
 
47
 
 
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.
 
51
 }
 
52
  REMOTE_NAME = (1);
 
53
 
 
54
{ REMOTE_NOLOOKUP is like REMOTE_NAME except that a DNS lookup is
 
55
 * never forced.
 
56
 }
 
57
  REMOTE_NOLOOKUP = (2);
 
58
 
 
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.
 
63
 }
 
64
  REMOTE_DOUBLE_REV = (3);
 
65
 
 
66
  SATISFY_ALL = 0;
 
67
  SATISFY_ANY = 1;
 
68
  SATISFY_NOSPEC = 2;
 
69
 
 
70
{ default maximum of internal redirects }
 
71
  AP_DEFAULT_MAX_INTERNAL_REDIRECTS = 20;
 
72
 
 
73
{ default maximum subrequest nesting level }
 
74
  AP_DEFAULT_MAX_SUBREQ_DEPTH = 20;
 
75
 
 
76
function ap_allow_options(r: Prequest_rec): cint;
 
77
 {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF} external LibHTTPD;
 
78
 
 
79
function ap_allow_overrides(r: Prequest_rec): cint;
 
80
 {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF} external LibHTTPD;
 
81
 
 
82
function ap_default_type(r: Prequest_rec): PChar;
 
83
 {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF} external LibHTTPD;
 
84
 
 
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
 
90
                                      * back-compatible...
 
91
                                      }
 
92
                                      
 
93
function ap_get_remote_host(conn: Pconn_rec; dir_config: Pointer; type_: cint): PChar;
 
94
 {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF} external LibHTTPD;
 
95
 
 
96
function ap_get_remote_logname(r: Prequest_rec): PChar;
 
97
 {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF} external LibHTTPD;
 
98
 
 
99
{ Used for constructing self-referencing URLs, and things like SERVER_PORT,
 
100
 * and SERVER_NAME.
 
101
 }
 
102
function ap_construct_url(p: Ppool; const uri: PChar; r: Prequest_rec): PChar;
 
103
 {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF} external LibHTTPD;
 
104
 
 
105
function ap_get_server_name(r: Prequest_rec): PChar;
 
106
 {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF} external LibHTTPD;
 
107
 
 
108
function ap_get_server_port(const r: Prequest_rec): cuint;
 
109
 {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF} external LibHTTPD;
 
110
 
 
111
function ap_get_limit_req_body(const r: Prequest_rec): culong;
 
112
 {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF} external LibHTTPD;
 
113
 
 
114
procedure ap_custom_response(r: Prequest_rec; status: cint; string_: PChar);
 
115
 {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF} external LibHTTPD;
 
116
 
 
117
function ap_exists_config_define(name: PChar): cint;
 
118
 {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF} external LibHTTPD;
 
119
 
 
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
 
123
 }
 
124
function ap_is_recursion_limit_exceeded(const r: Prequest_rec): cint;
 
125
 {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF} external LibHTTPD;
 
126
 
 
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.
 
132
 }
 
133
    
 
134
type
 
135
  require_line = record
 
136
    method_mask: cint;
 
137
    requirement: PChar;
 
138
  end;
 
139
     
 
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 *);    }
 
145
 
 
146
{$ifdef WINDOWS}
 
147
{
 
148
 * CGI Script stuff for Win32...
 
149
 }
 
150
type
 
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 );
 
155
 
 
156
function ap_get_win32_interpreter(const param1: Prequest_rec; param2: PPChar): file_type_e;
 
157
 {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF} external LibHTTPD;
 
158
{$endif}
 
159
 
 
160
{.$ifdef CORE_PRIVATE}
 
161
 
 
162
{
 
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.
 
166
 }
 
167
 
 
168
//API_EXPORT(char *) ap_response_code_string (request_rec *r, int error_index);
 
169
 
 
170
//extern API_VAR_EXPORT module core_module;
 
171
 
 
172
{ Per-directory configuration }
 
173
 
 
174
type
 
175
  allow_options_t = Char;
 
176
  overrides_t = Char
 
177
  ;
 
178
{
 
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.
 
183
 }
 
184
  etag_components_t = culong;
 
185
 
 
186
const
 
187
  ETAG_UNSET = 0;
 
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);
 
194
  
 
195
  { Things moved up }
 
196
  
 
197
  HOSTNAME_LOOKUP_OFF   = 0;
 
198
  HOSTNAME_LOOKUP_ON    = 1;
 
199
  HOSTNAME_LOOKUP_DOUBLE= 2;
 
200
  HOSTNAME_LOOKUP_UNSET = 3;
 
201
 
 
202
  USE_CANONICAL_NAME_OFF  = (0);
 
203
  USE_CANONICAL_NAME_ON   = (1);
 
204
  USE_CANONICAL_NAME_DNS  = (2);
 
205
  USE_CANONICAL_NAME_UNSET= (3);
 
206
 
 
207
  ADD_DEFAULT_CHARSET_OFF   = (0);
 
208
  ADD_DEFAULT_CHARSET_ON    = (1);
 
209
  ADD_DEFAULT_CHARSET_UNSET = (2);
 
210
 
 
211
{$ifdef CHARSET_EBCDIC}
 
212
 
 
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) }
 
217
 
 
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) }
 
222
 
 
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 }
 
225
 
 
226
{$endif}
 
227
 
 
228
type
 
229
  ap_flag_e = (
 
230
    AP_FLAG_UNSET = 0,
 
231
    AP_FLAG_ON = 1,
 
232
    AP_FLAG_OFF = 2
 
233
  );
 
234
  
 
235
  server_signature_t = ( srv_sig_unset, srv_sig_off, srv_sig_on,
 
236
   srv_sig_withmail);
 
237
 
 
238
 
 
239
  core_dir_config = record
 
240
    { path of the directory/regex/etc.  see also d_is_fnmatch below }
 
241
    d: PChar;
 
242
    { the number of slashes in d }
 
243
    d_components: cuint;
 
244
 
 
245
    { If (opts & OPT_UNSET) then no absolute assignment to options has
 
246
     * been made.
 
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
 
250
     * or opts_remove.
 
251
     }
 
252
    opts: allow_options_t;
 
253
    opts_add: allow_options_t;
 
254
    opts_remove: allow_options_t;
 
255
    override_: overrides_t;
 
256
    
 
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...
 
260
     }
 
261
    
 
262
    ap_default_type: PChar;
 
263
  
 
264
    { Authentication stuff.  Groan... }
 
265
    
 
266
    satisfy: cint;
 
267
    ap_auth_type: PChar;
 
268
    ap_auth_name: PChar;
 
269
    ap_requires: Parray_header;
 
270
 
 
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().
 
275
     }
 
276
  
 
277
    response_code_strings: PPChar; { from ErrorDocument, not from
 
278
                                   * ap_custom_response()
 
279
                                   }
 
280
 
 
281
    { Hostname resolution etc }
 
282
    
 
283
    { Moved Up }
 
284
 
 
285
//    unsigned int hostname_lookups : 4;
 
286
 
 
287
//    signed int do_rfc1413 : 2;   { See if client is advertising a username? }
 
288
 
 
289
//    signed int content_md5 : 2;  { calculate Content-MD5? }
 
290
 
 
291
    { Moved Up }
 
292
 
 
293
//    unsigned use_canonical_name : 2;
 
294
 
 
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.
 
298
     }
 
299
//    unsigned d_is_fnmatch : 1;
 
300
 
 
301
    { should we force a charset on any outgoing parameterless content-type?
 
302
     * if so, which charset?
 
303
     }
 
304
     
 
305
    { Moved up }
 
306
 
 
307
//    unsigned add_default_charset : 2;
 
308
    add_default_charset_name: PChar;
 
309
 
 
310
    { System Resource Control }
 
311
{$ifdef RLIMIT_CPU}
 
312
    limit_cpu: Prlimit;
 
313
{$endif}
 
314
{$if defined(RLIMIT_DATA) or defined(RLIMIT_VMEM) or defined(RLIMIT_AS)}
 
315
    limit_mem: Prlimit;
 
316
{$endif}
 
317
{$ifdef RLIMIT_NPROC}
 
318
    limit_nproc: Prlimit;
 
319
{$endif}
 
320
    limit_req_body: culong;  { limit on bytes in request msg body }
 
321
 
 
322
    { logging options }
 
323
    server_signature: server_signature_t;
 
324
    loglevel: cint;
 
325
    
 
326
    { Access control }
 
327
    sec: Parray_header;
 
328
    r: Pregex_t;
 
329
 
 
330
{$ifdef WINDOWS}
 
331
    { Where to find interpreter to run scripts }
 
332
    script_interpreter_source: interpreter_source_e;
 
333
{$endif}
 
334
    
 
335
{$ifdef CHARSET_EBCDIC}
 
336
 
 
337
    { Moved up }
 
338
 
 
339
    { The configuration args {On|Off}[={In|Out|InOut}] are currently stored
 
340
     * as character strings ("0" = conv_Off, "1" = conv_On)
 
341
     }
 
342
    ebcdicconversion_by_ext_in: Ptable;
 
343
    ebcdicconversion_by_ext_out: Ptable;
 
344
    ebcdicconversion_by_type_in: Ptable;
 
345
    ebcdicconversion_by_type_out: Ptable;
 
346
 
 
347
    { Moved up }
 
348
    
 
349
    x_ascii_magic_kludge: cint;   { whether to handle the text/x-ascii- kludge }
 
350
 
 
351
{$ifdef ADD_EBCDICCONVERT_DEBUG_HEADER}
 
352
    ebcdicconversion_debug_header: cint; { whether to add an X-EBCDIC-Debug-{In,Out} header to the response }
 
353
{$endif}
 
354
{$endif} { CHARSET_EBCDIC }
 
355
 
 
356
    {
 
357
     * What attributes/data should be included in ETag generation?
 
358
     }
 
359
    etag_bits: etag_components_t;
 
360
    etag_add: etag_components_t;
 
361
    etag_remove: etag_components_t;
 
362
 
 
363
    {
 
364
     * Do we allow ISINDEX CGI scripts to pass their query argument as
 
365
     * direct command line parameters or argv elements?
 
366
     }
 
367
    cgi_command_args: ap_flag_e;
 
368
 
 
369
    { Digest auth. }
 
370
    ap_auth_nonce: PChar;
 
371
 
 
372
  end;
 
373
 
 
374
{ Per-server core configuration }
 
375
 
 
376
type
 
377
  core_server_config = record
 
378
  
 
379
{$ifdef GPROF}
 
380
    gprof_dir: PChar;
 
381
{$endif}
 
382
 
 
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:
 
386
     }
 
387
    ap_document_root: PChar;
 
388
  
 
389
    { Access control }
 
390
 
 
391
    access_name: PChar;
 
392
    sec: Parray_header;
 
393
    sec_url: Parray_header;
 
394
 
 
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 }
 
399
 
 
400
    { TRACE control }
 
401
    trace_enable: cint;        { see AP_TRACE_ below }
 
402
 
 
403
  end;
 
404
 
 
405
{ trace_enable options }
 
406
const
 
407
  AP_TRACE_UNSET    =-1;
 
408
  AP_TRACE_DISABLE  = 0;
 
409
  AP_TRACE_ENABLE   = 1;
 
410
  AP_TRACE_EXTENDED = 2;
 
411
 
 
412
{ for http_config.c }
 
413
//CORE_EXPORT(void) ap_core_reorder_directories(pool *, server_rec *);
 
414
 
 
415
{ for mod_perl }
 
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);
 
420
 
 
421
{.$endif}
 
422