httpd.pas 4.1 KB

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