1 {
2 httpd.pas
3
4 Copyright (C) 2006 Felipe Monteiro de Carvalho
5
6 This unit is a pascal binding for the Apache 2.0.58 headers.
7 The headers were released under the following copyright:
8 }
9 { Licensed to the Apache Software Foundation (ASF) under one or more
10 * contributor license agreements. See the NOTICE file distributed with
11 * this work for additional information regarding copyright ownership.
12 * The ASF licenses this file to You under the Apache License, Version 2.0
13 * (the "License"); you may not use this file except in compliance with
14 * the License. You may obtain a copy of the License at
15 *
16 * http://www.apache.org/licenses/LICENSE-2.0
17 *
18 * Unless required by applicable law or agreed to in writing, software
19 * distributed under the License is distributed on an "AS IS" BASIS,
20 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
21 * See the License for the specific language governing permissions and
22 * limitations under the License.
23 }
24 unit httpd;
25
26 {$ifdef fpc}
27 {$mode delphi}{$H+}
28 {$endif}
29
30 {$IFNDEF FPC}
31 {$DEFINE WINDOWS}
32 {$ENDIF}
33
34 {$IFDEF WIN32}
35 {$DEFINE WINDOWS}
36 {$ENDIF}
37
38 {$ifdef Unix}
39 {$PACKRECORDS C}
40 {$endif}
41
42 {$define Apache2_2}
43
44 interface
45
46 uses
47 {$ifdef WINDOWS}
48 Windows,
49 {$ELSE}
50 UnixType,
51 {$ENDIF}
52 apr, aprutil, ctypes;
53
54 const
55 {$ifndef fpc}
56 LineEnding = #13#10;
57 {$endif}
58
59 {$IFDEF WINDOWS}
60 LibHTTPD = 'libhttpd.dll';
61 {$ELSE}
62 LibHTTPD = '';
63 {$ENDIF}
64
65 { Declarations moved here to be on top of all declarations }
66
67 { configuration vector structure }
68 type
69 ap_conf_vector_t = record end;
70 Pap_conf_vector_t = ^ap_conf_vector_t;
71 PPap_conf_vector_t = ^Pap_conf_vector_t;
72
73 {
74 Main httpd header files
75
76 Note: There are more include files other then these, because some include files
77 include more files.
78 }
79
80 {$include ap_provider.inc}
81 {$include util_cfgtree.inc}
82
83 {$include httpd.inc}
84 {$include http_config.inc}
85 {$include http_core.inc}
86 {$include http_log.inc}
87 {$include http_main.inc}
88 {$include http_protocol.inc}
89 {$include http_request.inc}
90 {$include http_connection.inc}
91 {$include http_vhost.inc}
92
93 {$include util_script.inc}
94 {$include util_time.inc}
95 {$include util_md5.inc}
96 {$include ap_mpm.inc}
97
98 implementation
99
100 {
101 Macros transformed into functions in the translation
102 }
103
104 { from httpd.inc }
105
106 { Internal representation for a HTTP protocol number, e.g., HTTP/1.1 }
HTTP_VERSIONnull107 function HTTP_VERSION(major, minor: Integer): Integer;
108 begin
109 Result := (1000*(major)+(minor));
110 end;
111
112 { Major part of HTTP protocol }
HTTP_VERSION_MAJORnull113 function HTTP_VERSION_MAJOR(number: Integer): Integer;
114 begin
115 Result := number div 1000;
116 end;
117
118 { Minor part of HTTP protocol }
HTTP_VERSION_MINORnull119 function HTTP_VERSION_MINOR(number: Integer): Integer;
120 begin
121 Result := number mod 1000;
122 end;
123
ap_escape_urinull124 function ap_escape_uri(p: Papr_pool_t; const path: PChar): PChar;
125 begin
126 Result := ap_os_escape_path(p, path, 1);
127 end;
128
129 { from http_config.inc }
130
131 { Use this in all standard modules }
132 procedure STANDARD20_MODULE_STUFF(var mod_: module);
133 begin
134 mod_.version := MODULE_MAGIC_NUMBER_MAJOR;
135 mod_.minor_version := MODULE_MAGIC_NUMBER_MINOR;
136 mod_.module_index := -1;
137 // mod_.name: PChar;
138 mod_.dynamic_load_handle := nil;
139 mod_.next := nil;
140 mod_.magic := MODULE_MAGIC_COOKIE;
141 mod_.rewrite_args := nil;
142 end;
143
144 { Use this only in MPMs }
145 procedure MPM20_MODULE_STUFF(var mod_: module);
146 begin
147 mod_.version := MODULE_MAGIC_NUMBER_MAJOR;
148 mod_.minor_version := MODULE_MAGIC_NUMBER_MINOR;
149 mod_.module_index := -1;
150 // mod_.name: PChar;
151 mod_.dynamic_load_handle := nil;
152 mod_.next := nil;
153 mod_.magic := MODULE_MAGIC_COOKIE;
154 end;
155
ap_get_module_confignull156 function ap_get_module_config(v: Pap_conf_vector_t; m: Pmodule): Pap_conf_vector_t;
157 begin
158 Result := Pointer(Integer(v) + m^.module_index);
159 end;
160
161 procedure ap_set_module_config(v: Pap_conf_vector_t; m: Pmodule; val: Pap_conf_vector_t);
162 var
163 P: PPointer;
164 begin
165 P := PPointer(Integer(v) + m^.module_index);
166 P^ := val;
167 end;
168
169 end.
170
171