httpd.pas 3.8 KB

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