httpd.pas 3.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178
  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. unit httpd;
  23. {$ifdef fpc}
  24. {$mode delphi}{$H+}
  25. {$endif}
  26. {$IFNDEF FPC}
  27. {$DEFINE WINDOWS}
  28. {$ENDIF}
  29. {$IFDEF WIN32}
  30. {$DEFINE WINDOWS}
  31. {$ENDIF}
  32. {$IFDEF WIN64}
  33. {$DEFINE WINDOWS}
  34. {$ENDIF}
  35. {$ifdef Unix}
  36. {$PACKRECORDS C}
  37. {$endif}
  38. {$define Apache1_3}
  39. interface
  40. uses
  41. {$ifdef WINDOWS}
  42. Windows,
  43. {$ELSE}
  44. UnixType,
  45. {$ENDIF}
  46. ctypes;
  47. const
  48. {$ifndef fpc}
  49. LineEnding = #13#10;
  50. {$endif}
  51. {$IFDEF WINDOWS}
  52. LibHTTPD = 'ApacheCore.dll';
  53. {$ELSE}
  54. LibHTTPD = '';
  55. {$ENDIF}
  56. { Declarations moved here to be on top of all declarations }
  57. { Various types}
  58. type
  59. time_t = LongInt;
  60. size_t = Integer;
  61. { configuration vector structure }
  62. type
  63. ap_conf_vector_t = record end;
  64. Pap_conf_vector_t = ^ap_conf_vector_t;
  65. PPap_conf_vector_t = ^Pap_conf_vector_t;
  66. {
  67. Main httpd header files
  68. Note: There are more include files other then these, because some include files
  69. include more files.
  70. }
  71. {.$include ap_provider.inc}
  72. {.$include util_cfgtree.inc}
  73. {$include httpd.inc}
  74. {$include http_config.inc}
  75. {$include http_core.inc}
  76. {$include http_log.inc}
  77. {$include http_main.inc}
  78. {$include http_protocol.inc}
  79. {$include http_request.inc}
  80. {$include http_vhost.inc}
  81. {.$include util_script.inc}
  82. {.$include util_time.inc}
  83. {.$include util_md5.inc}
  84. {.$include ap_mpm.inc}
  85. implementation
  86. {
  87. Macros transformed into functions in the translation
  88. }
  89. { from httpd.inc }
  90. { Internal representation for a HTTP protocol number, e.g., HTTP/1.1 }
  91. function HTTP_VERSION(major, minor: Integer): Integer;
  92. begin
  93. Result := (1000*(major)+(minor));
  94. end;
  95. { Major part of HTTP protocol }
  96. function HTTP_VERSION_MAJOR(number: Integer): Integer;
  97. begin
  98. Result := number div 1000;
  99. end;
  100. { Minor part of HTTP protocol }
  101. function HTTP_VERSION_MINOR(number: Integer): Integer;
  102. begin
  103. Result := number mod 1000;
  104. end;
  105. {function ap_escape_uri(p: Papr_pool_t; const path: PChar): PChar;
  106. begin
  107. Result := ap_os_escape_path(p, path, 1);
  108. end;}
  109. { from http_config.inc }
  110. { Use this in all standard modules }
  111. procedure STANDARD_MODULE_STUFF(var mod_: module);
  112. begin
  113. mod_.version := MODULE_MAGIC_NUMBER_MAJOR;
  114. mod_.minor_version := MODULE_MAGIC_NUMBER_MINOR;
  115. mod_.module_index := -1;
  116. // mod_.name: PChar;
  117. mod_.dynamic_load_handle := nil;
  118. mod_.next := nil;
  119. mod_.magic := MODULE_MAGIC_COOKIE;
  120. end;
  121. { Use this only in MPMs }
  122. //procedure MPM20_MODULE_STUFF(var mod_: module);
  123. //begin
  124. // mod_.version := MODULE_MAGIC_NUMBER_MAJOR;
  125. // mod_.minor_version := MODULE_MAGIC_NUMBER_MINOR;
  126. // mod_.module_index := -1;
  127. // mod_.name: PChar;
  128. // mod_.dynamic_load_handle := nil;
  129. // mod_.next := nil;
  130. // mod_.magic := MODULE_MAGIC_COOKIE;
  131. //end;
  132. function ap_get_module_config(v: Pap_conf_vector_t; m: Pmodule): Pap_conf_vector_t;
  133. begin
  134. Result := Pointer(PtrInt(v) + m^.module_index);
  135. end;
  136. procedure ap_set_module_config(v: Pap_conf_vector_t; m: Pmodule; val: Pap_conf_vector_t);
  137. var
  138. P: PPointer;
  139. begin
  140. P := PPointer(PtrInt(v) + m^.module_index);
  141. P^ := val;
  142. end;
  143. end.