httpd.inc 84 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094209520962097209820992100210121022103210421052106210721082109211021112112211321142115211621172118211921202121212221232124212521262127212821292130213121322133213421352136213721382139214021412142214321442145214621472148214921502151215221532154215521562157215821592160216121622163216421652166216721682169217021712172217321742175217621772178217921802181218221832184218521862187218821892190219121922193219421952196219721982199220022012202220322042205220622072208220922102211221222132214221522162217221822192220222122222223222422252226222722282229223022312232223322342235223622372238223922402241224222432244
  1. {
  2. Converted using the Apache 2.4.3 httpd-2.4.3 source files
  3. to be used with FreePascal (fpc)
  4. }
  5. {* XXX - We need to push more stuff to other .h files, or even .c files, to
  6. * make this file smaller}
  7. { Headers in which EVERYONE has an interest... }
  8. {$include ap_config.inc}
  9. {$include ap_mmn.inc}
  10. {$include ap_release.inc}
  11. {all translated apr are included in the parent httpd.pas unit with using the apr.pas unit}
  12. ////{$include "apr_general.inc"}
  13. //{$include "apr_tables.inc"}
  14. //{$include "apr_pools.inc"}
  15. ////{$include "apr_time.inc"}
  16. ////{$include "apr_network_io.inc"}
  17. {$include aprutil/apr_buckets.inc}
  18. {$include aprutil/apr_uri.inc}
  19. //{$include "apr_poll.inc"}
  20. //{$include "apr_thread_proc.inc"}
  21. ////{$include "os.inc"}
  22. {$include ap_regex.inc}
  23. { Note: apr_uri.h is also included, see below }
  24. { ----------------------------- config dir ------------------------------ }
  25. {* Define this to be the default server home dir. Most things later in this
  26. * file with a relative pathname will have this added.
  27. }
  28. const
  29. {$ifdef OS2}
  30. {* Set default for OS/2 file system }
  31. HTTPD_ROOT = '/os2httpd';
  32. {$else}
  33. {$ifdef WIN32}
  34. {* Set default for Windows file system }
  35. HTTPD_ROOT = '/apache';
  36. {$else}
  37. {$ifdef NETWARE}
  38. {* Set the default for NetWare }
  39. HTTPD_ROOT = '/apache';
  40. {$else}
  41. {* Set for all other OSs }
  42. HTTPD_ROOT = '/usr/local/apache';
  43. {$endif}
  44. {$endif}
  45. {$endif}
  46. { HTTPD_ROOT }
  47. {* --------- You shouldn't have to edit anything below this line ----------
  48. *
  49. * Any modifications to any defaults not defined above should be done in the
  50. * respective configuration file.
  51. *}
  52. {*
  53. * Default location of documents. Can be overridden by the DocumentRoot
  54. * directive.}
  55. {$ifdef OS2}
  56. { Set default for OS/2 file system }
  57. DOCUMENT_LOCATION = HTTPD_ROOT + '/docs';
  58. {$else}
  59. { Set default for non OS/2 file system }
  60. DOCUMENT_LOCATION = HTTPD_ROOT + '/htdocs';
  61. {$endif}
  62. {* Maximum number of dynamically loaded modules }
  63. DYNAMIC_MODULE_LIMIT = 256;
  64. {* Default administrator's address }
  65. DEFAULT_ADMIN = '[no address given]';
  66. {* The name of the log files }
  67. DEFAULT_ERRORLOG = 'logs/error_log';
  68. {* Define this to be what your per-directory security files are called }
  69. {$ifdef OS2}
  70. { Set default for OS/2 file system }
  71. DEFAULT_ACCESS_FNAME = 'htaccess';
  72. {$else}
  73. DEFAULT_ACCESS_FNAME = '.htaccess';
  74. {$endif}
  75. {* The name of the server config file }
  76. SERVER_CONFIG_FILE = 'conf/httpd.conf';
  77. {* The default path for CGI scripts if none is currently set }
  78. DEFAULT_PATH = '/bin:/usr/bin:/usr/ucb:/usr/bsd:/usr/local/bin';
  79. {* The path to the suExec wrapper, can be overridden in Configuration }
  80. SUEXEC_BIN = HTTPD_ROOT + '/bin/suexec';
  81. {* The timeout for waiting for messages }
  82. DEFAULT_TIMEOUT = 60;
  83. {* The timeout for waiting for keepalive timeout until next request }
  84. DEFAULT_KEEPALIVE_TIMEOUT = 5;
  85. {* The number of requests to entertain per connection }
  86. DEFAULT_KEEPALIVE = 100;
  87. {
  88. * Limits on the size of various request items. These limits primarily
  89. * exist to prevent simple denial-of-service attacks on a server based
  90. * on misuse of the protocol. The recommended values will depend on the
  91. * nature of the server resources -- CGI scripts and database backends
  92. * might require large values, but most servers could get by with much
  93. * smaller limits than we use below. The request message body size can
  94. * be limited by the per-dir config directive LimitRequestBody.
  95. *
  96. * Internal buffer sizes are two bytes more than the DEFAULT_LIMIT_REQUEST_LINE
  97. * and DEFAULT_LIMIT_REQUEST_FIELDSIZE below, which explains the 8190.
  98. * These two limits can be lowered or raised by the server config
  99. * directives LimitRequestLine and LimitRequestFieldsize, respectively.
  100. *
  101. * DEFAULT_LIMIT_REQUEST_FIELDS can be modified or disabled (set = 0) by
  102. * the server config directive LimitRequestFields.
  103. }
  104. {* default limit on bytes in Request-Line (Method+URI+HTTP-version) }
  105. DEFAULT_LIMIT_REQUEST_LINE = 8190;
  106. {* default limit on bytes in any one header field }
  107. DEFAULT_LIMIT_REQUEST_FIELDSIZE = 8190;
  108. {* default limit on number of request header fields }
  109. DEFAULT_LIMIT_REQUEST_FIELDS = 100;
  110. {*
  111. * The default default character set name to add if AddDefaultCharset is
  112. * enabled. Overridden with AddDefaultCharsetName.
  113. }
  114. DEFAULT_ADD_DEFAULT_CHARSET_NAME = 'iso-8859-1';
  115. {* default HTTP Server protocol }
  116. AP_SERVER_PROTOCOL = 'HTTP/1.1';
  117. { ------------------ stuff that modules are allowed to look at ----------- }
  118. {* Define this to be what your HTML directory content files are called }
  119. AP_DEFAULT_INDEX = 'index.html';
  120. {* The name of the MIME types file }
  121. AP_TYPES_CONFIG_FILE = 'conf/mime.types';
  122. {
  123. * Define the HTML doctype strings centrally.
  124. }
  125. {* HTML 2.0 Doctype }
  126. DOCTYPE_HTML_2_0 = '<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN">' + LineEnding;
  127. {* HTML 3.2 Doctype }
  128. DOCTYPE_HTML_3_2 = '<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">' + LineEnding;
  129. {* HTML 4.0 Strict Doctype }
  130. DOCTYPE_HTML_4_0S = '<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN"' + LineEnding +
  131. 'http://www.w3.org/TR/REC-html40/strict.dtd">' + LineEnding;
  132. {* HTML 4.0 Transitional Doctype }
  133. DOCTYPE_HTML_4_0T = '<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"' + LineEnding +
  134. '"http://www.w3.org/TR/REC-html40/loose.dtd">' + LineEnding;
  135. {* HTML 4.0 Frameset Doctype }
  136. DOCTYPE_HTML_4_0F = '<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Frameset//EN"' + LineEnding +
  137. '"http://www.w3.org/TR/REC-html40/frameset.dtd">' + LineEnding;
  138. {* XHTML 1.0 Strict Doctype }
  139. DOCTYPE_XHTML_1_0S = '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"' + LineEnding +
  140. '"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">' + LineEnding;
  141. {* XHTML 1.0 Transitional Doctype }
  142. DOCTYPE_XHTML_1_0T = '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"' + LineEnding +
  143. '"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">' + LineEnding;
  144. {* XHTML 1.0 Frameset Doctype }
  145. DOCTYPE_XHTML_1_0F = '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Frameset//EN"' + LineEnding +
  146. '"http://www.w3.org/TR/xhtml1/DTD/xhtml1-frameset.dtd">' + LineEnding;
  147. {* Internal representation for a HTTP protocol number, e.g., HTTP/1.1 }
  148. { was #define dname(params) para_def_expr }
  149. { argument types are unknown }
  150. { return type might be wrong }
  151. function HTTP_VERSION(major,minor : Integer) : Integer;
  152. {* Major part of HTTP protocol }
  153. function HTTP_VERSION_MAJOR(number : Integer) : Integer;
  154. {* Minor part of HTTP protocol }
  155. function HTTP_VERSION_MINOR(number : Integer) : Integer;
  156. { -------------- Port number for server running standalone --------------- }
  157. const
  158. {* default HTTP Port }
  159. DEFAULT_HTTP_PORT = 80;
  160. {* default HTTPS Port }
  161. DEFAULT_HTTPS_PORT = 443;
  162. {*
  163. * Check whether @a port is the default port for the request @a r.
  164. * @param port The port number
  165. * @param r The request
  166. * @see #ap_default_port
  167. }
  168. { was #define dname(params) para_def_expr }
  169. { argument types are unknown }
  170. { return type might be wrong }
  171. // function ap_is_default_port(port,r : longint) : longint;
  172. {*
  173. * Get the default port for a request (which depends on the scheme).
  174. * @param r The request
  175. }
  176. { was #define dname(params) para_def_expr }
  177. { argument types are unknown }
  178. { return type might be wrong }
  179. // function ap_default_port(r : longint) : longint;
  180. {*
  181. * Get the scheme for a request.
  182. * @param r The request
  183. }
  184. { was #define dname(params) para_def_expr }
  185. { argument types are unknown }
  186. { return type might be wrong }
  187. // function ap_http_scheme(r : longint) : longint;
  188. const
  189. {* The length of a Huge string }
  190. HUGE_STRING_LEN = 8192;
  191. {* The default string length }
  192. MAX_STRING_LEN = HUGE_STRING_LEN;
  193. {* The size of the server's internal read-write buffers }
  194. AP_IOBUFSIZE = 8192;
  195. {* The max number of regex captures that can be expanded by ap_pregsub }
  196. AP_MAX_REG_MATCH = 10;
  197. {*
  198. * APR_HAS_LARGE_FILES introduces the problem of spliting sendfile into
  199. * mutiple buckets, no greater than MAX(apr_size_t), and more granular
  200. * than that in case the brigade code/filters attempt to read it directly.
  201. * ### 16mb is an invention, no idea if it is reasonable.
  202. }
  203. { 2^24 }
  204. AP_MAX_SENDFILE = 16777216;
  205. {*
  206. * MPM child process exit status values
  207. * The MPM parent process may check the status to see if special
  208. * error handling is required.
  209. }
  210. {* a normal exit }
  211. APEXIT_OK = $0;
  212. {* A fatal error arising during the server's init sequence }
  213. APEXIT_INIT = $2;
  214. {* The child died during its init sequence }
  215. APEXIT_CHILDINIT = $3;
  216. {*
  217. * The child exited due to a resource shortage.
  218. * The parent should limit the rate of forking until
  219. * the situation is resolved.
  220. }
  221. APEXIT_CHILDSICK = $7;
  222. {*
  223. * A fatal error, resulting in the whole server aborting.
  224. * If a child exits with this error, the parent process
  225. * considers this a server-wide fatal error and aborts.
  226. }
  227. APEXIT_CHILDFATAL = $f;
  228. {*
  229. * Stuff marked #AP_DECLARE is part of the API, and intended for use
  230. * by modules. Its purpose is to allow us to add attributes that
  231. * particular platforms or compilers require to every exported function.
  232. }
  233. { was #define dname(params) para_def_expr }
  234. { argument types are unknown }
  235. { return type might be wrong }
  236. // function AP_DECLARE(_type : longint) : longint;
  237. {*
  238. * Stuff marked #AP_DECLARE_NONSTD is part of the API, and intended for
  239. * use by modules. The difference between #AP_DECLARE and
  240. * #AP_DECLARE_NONSTD is that the latter is required for any functions
  241. * which use varargs or are used via indirect function call. This
  242. * is to accomodate the two calling conventions in windows dlls.
  243. }
  244. { was #define dname(params) para_def_expr }
  245. { argument types are unknown }
  246. { return type might be wrong }
  247. // function AP_DECLARE_NONSTD(_type : longint) : longint;
  248. {$define AP_DECLARE_DATA}
  249. { was #define dname(params) para_def_expr }
  250. { argument types are unknown }
  251. { return type might be wrong }
  252. // function AP_MODULE_DECLARE(_type : longint) : longint;
  253. { was #define dname(params) para_def_expr }
  254. { argument types are unknown }
  255. { return type might be wrong }
  256. // function AP_MODULE_DECLARE_NONSTD(_type : longint) : longint;
  257. {$define AP_MODULE_DECLARE_DATA}
  258. {*
  259. * @internal
  260. * modules should not use functions marked AP_CORE_DECLARE
  261. }
  262. // const
  263. // AP_CORE_DECLARE = AP_DECLARE;
  264. {*
  265. * @internal
  266. * modules should not use functions marked AP_CORE_DECLARE_NONSTD
  267. }
  268. // const
  269. // AP_CORE_DECLARE_NONSTD = AP_DECLARE_NONSTD;
  270. {*
  271. * @defgroup APACHE_APR_STATUS_T HTTPD specific values of apr_status_t
  272. * @
  273. }
  274. // const
  275. // AP_START_USERERR = APR_OS_START_USERERR+2000;
  276. // AP_USERERR_LEN = 1000;
  277. {* The function declines to handle the request }
  278. // AP_DECLINED = AP_START_USERERR+0;
  279. {* @ }
  280. {*
  281. * @brief The numeric version information is broken out into fields within this
  282. * structure.
  283. }
  284. {*< major number }
  285. {*< minor number }
  286. {*< patch number }
  287. (* Const before type ignored *)
  288. {*< additional string like "-dev" }
  289. type
  290. Pap_version_t = ^ap_version_t;
  291. ap_version_t = record
  292. major : Integer;
  293. minor : Integer;
  294. patch : Integer;
  295. add_string : PChar;
  296. end;
  297. {*
  298. * Return httpd's version information in a numeric form.
  299. *
  300. * @param version Pointer to a version structure for returning the version
  301. * information.
  302. }
  303. procedure ap_get_server_revision(version: Pap_version_t);
  304. {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
  305. external LibHTTPD name LibNamePrefix + 'ap_get_server_revision' + LibSuff4;
  306. {*
  307. * Get the server banner in a form suitable for sending over the
  308. * network, with the level of information controlled by the
  309. * ServerTokens directive.
  310. * @return The server banner
  311. }
  312. function ap_get_server_banner: PChar;
  313. {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
  314. external LibHTTPD name LibNamePrefix + 'ap_get_server_revision' + LibSuff0;
  315. {*
  316. * Get the server description in a form suitable for local displays,
  317. * status reports, or logging. This includes the detailed server
  318. * version and information about some modules. It is not affected
  319. * by the ServerTokens directive.
  320. * @return The server description
  321. }
  322. function ap_get_server_description: PChar;
  323. {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
  324. external LibHTTPD name LibNamePrefix + 'ap_get_server_revision' + LibSuff0;
  325. {*
  326. * Add a component to the server description and banner strings
  327. * @param pconf The pool to allocate the component from
  328. * @param component The string to add
  329. }
  330. procedure ap_add_version_component(pconf: Papr_pool_t; const component: PChar);
  331. {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
  332. external LibHTTPD name LibNamePrefix + 'ap_add_version_component' + LibSuff8;
  333. {*
  334. * Get the date a time that the server was built
  335. * @return The server build time string
  336. }
  337. function ap_get_server_built: PChar;
  338. {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
  339. external LibHTTPD name LibNamePrefix + 'ap_get_server_built' + LibSuff0;
  340. { non-HTTP status codes returned by hooks }
  341. const
  342. OK = 0; {*< Module has handled this stage. }
  343. DECLINED = -1; {*< Module declines to handle }
  344. DONE = -2; {*< Module has served the response completely
  345. * - it's safe to die() with no more output
  346. }
  347. SUSPENDED = -(3); {*< Module will handle the remainder of the request.
  348. * The core will never invoke the request again, }
  349. {* Returned by the bottom-most filter if no data was written.
  350. * @see ap_pass_brigade(). }
  351. AP_NOBODY_WROTE = -100;
  352. {* Returned by the bottom-most filter if no data was read.
  353. * @see ap_get_brigade(). }
  354. AP_NOBODY_READ = -101;
  355. {* Returned by any filter if the filter chain encounters an error
  356. * and has already dealt with the error response. }
  357. AP_FILTER_ERROR = -102;
  358. {*
  359. * @defgroup HTTP_Status HTTP Status Codes
  360. * @
  361. }
  362. {*
  363. * The size of the static status_lines array in http_protocol.c for
  364. * storing all of the potential response status-lines (a sparse table).
  365. * When adding a new code here add it to status_lines as well.
  366. * A future version should dynamically generate the apr_table_t at startup.
  367. }
  368. RESPONSE_CODES = 83;
  369. HTTP_CONTINUE = 100;
  370. HTTP_SWITCHING_PROTOCOLS = 101;
  371. HTTP_PROCESSING = 102;
  372. HTTP_OK = 200;
  373. HTTP_CREATED = 201;
  374. HTTP_ACCEPTED = 202;
  375. HTTP_NON_AUTHORITATIVE = 203;
  376. HTTP_NO_CONTENT = 204;
  377. HTTP_RESET_CONTENT = 205;
  378. HTTP_PARTIAL_CONTENT = 206;
  379. HTTP_MULTI_STATUS = 207;
  380. HTTP_ALREADY_REPORTED = 208;
  381. HTTP_IM_USED = 226;
  382. HTTP_MULTIPLE_CHOICES = 300;
  383. HTTP_MOVED_PERMANENTLY = 301;
  384. HTTP_MOVED_TEMPORARILY = 302;
  385. HTTP_SEE_OTHER = 303;
  386. HTTP_NOT_MODIFIED = 304;
  387. HTTP_USE_PROXY = 305;
  388. HTTP_TEMPORARY_REDIRECT = 307;
  389. HTTP_PERMANENT_REDIRECT = 308;
  390. HTTP_BAD_REQUEST = 400;
  391. HTTP_UNAUTHORIZED = 401;
  392. HTTP_PAYMENT_REQUIRED = 402;
  393. HTTP_FORBIDDEN = 403;
  394. HTTP_NOT_FOUND = 404;
  395. HTTP_METHOD_NOT_ALLOWED = 405;
  396. HTTP_NOT_ACCEPTABLE = 406;
  397. HTTP_PROXY_AUTHENTICATION_REQUIRED = 407;
  398. HTTP_REQUEST_TIME_OUT = 408;
  399. HTTP_CONFLICT = 409;
  400. HTTP_GONE = 410;
  401. HTTP_LENGTH_REQUIRED = 411;
  402. HTTP_PRECONDITION_FAILED = 412;
  403. HTTP_REQUEST_ENTITY_TOO_LARGE = 413;
  404. HTTP_REQUEST_URI_TOO_LARGE = 414;
  405. HTTP_UNSUPPORTED_MEDIA_TYPE = 415;
  406. HTTP_RANGE_NOT_SATISFIABLE = 416;
  407. HTTP_EXPECTATION_FAILED = 417;
  408. HTTP_UNPROCESSABLE_ENTITY = 422;
  409. HTTP_LOCKED = 423;
  410. HTTP_FAILED_DEPENDENCY = 424;
  411. HTTP_UPGRADE_REQUIRED = 426;
  412. HTTP_PRECONDITION_REQUIRED = 428;
  413. HTTP_TOO_MANY_REQUESTS = 429;
  414. HTTP_REQUEST_HEADER_FIELDS_TOO_LARGE = 431;
  415. HTTP_INTERNAL_SERVER_ERROR = 500;
  416. HTTP_NOT_IMPLEMENTED = 501;
  417. HTTP_BAD_GATEWAY = 502;
  418. HTTP_SERVICE_UNAVAILABLE = 503;
  419. HTTP_GATEWAY_TIME_OUT = 504;
  420. HTTP_VERSION_NOT_SUPPORTED = 505;
  421. HTTP_VARIANT_ALSO_VARIES = 506;
  422. HTTP_INSUFFICIENT_STORAGE = 507;
  423. HTTP_LOOP_DETECTED = 508;
  424. HTTP_NOT_EXTENDED = 510;
  425. HTTP_NETWORK_AUTHENTICATION_REQUIRED = 511;
  426. {* is the status code informational }
  427. function ap_is_HTTP_INFO(x : Integer): Boolean;
  428. {* is the status code OK ? }
  429. { was #define dname(params) para_def_expr }
  430. { argument types are unknown }
  431. { return type might be wrong }
  432. function ap_is_HTTP_SUCCESS(x : Integer): Boolean;
  433. {* is the status code a redirect }
  434. { was #define dname(params) para_def_expr }
  435. { argument types are unknown }
  436. { return type might be wrong }
  437. function ap_is_HTTP_REDIRECT(x : Integer): Boolean;
  438. {* is the status code a error (client or server) }
  439. { was #define dname(params) para_def_expr }
  440. { argument types are unknown }
  441. { return type might be wrong }
  442. function ap_is_HTTP_ERROR(x : Integer): Boolean;
  443. {* is the status code a client error }
  444. { was #define dname(params) para_def_expr }
  445. { argument types are unknown }
  446. { return type might be wrong }
  447. function ap_is_HTTP_CLIENT_ERROR(x : Integer): Boolean;
  448. {* is the status code a server error }
  449. { was #define dname(params) para_def_expr }
  450. { argument types are unknown }
  451. { return type might be wrong }
  452. function ap_is_HTTP_SERVER_ERROR(x : Integer): Boolean;
  453. {* is the status code a (potentially) valid response code? }
  454. { was #define dname(params) para_def_expr }
  455. { argument types are unknown }
  456. { return type might be wrong }
  457. function ap_is_HTTP_VALID_RESPONSE(x : Integer): Boolean;
  458. {* should the status code drop the connection }
  459. function ap_status_drops_connection(x : Integer): Boolean;
  460. {* @ }
  461. {*
  462. * @defgroup Methods List of Methods recognized by the server
  463. * @ingroup APACHE_CORE_DAEMON
  464. * @
  465. *
  466. * @brief Methods recognized (but not necessarily handled) by the server.
  467. *
  468. * These constants are used in bit shifting masks of size int, so it is
  469. * unsafe to have more methods than bits in an int. HEAD == M_GET.
  470. * This list must be tracked by the list in http_protocol.c in routine
  471. * ap_method_name_of().
  472. *
  473. }
  474. const
  475. M_GET = 0; {* RFC 2616: HTTP }
  476. M_PUT = 1; { : }
  477. M_POST = 2;
  478. M_DELETE = 3;
  479. M_CONNECT = 4;
  480. M_OPTIONS = 5;
  481. M_TRACE = 6; {* RFC 2616: HTTP }
  482. M_PATCH = 7; {* no rfc(!) ### remove this one? }
  483. M_PROPFIND = 8; {* RFC 2518: WebDAV }
  484. M_PROPPATCH = 9; { : }
  485. M_MKCOL = 10;
  486. M_COPY = 11;
  487. M_MOVE = 12;
  488. M_LOCK = 13;
  489. M_UNLOCK = 14; {* RFC 2518: WebDAV }
  490. M_VERSION_CONTROL = 15; {* RFC 3253: WebDAV Versioning }
  491. M_CHECKOUT = 16; { : }
  492. M_UNCHECKOUT = 17;
  493. M_CHECKIN = 18;
  494. M_UPDATE = 19;
  495. M_LABEL = 20;
  496. M_REPORT = 21;
  497. M_MKWORKSPACE = 22;
  498. M_MKACTIVITY = 23;
  499. M_BASELINE_CONTROL = 24;
  500. M_MERGE = 25;
  501. M_INVALID = 26; {* no valid method }
  502. {*
  503. * METHODS needs to be equal to the number of bits
  504. * we are using for limit masks.
  505. }
  506. METHODS = 64;
  507. {*
  508. * The method mask bit to shift for anding with a bitmask.
  509. }
  510. { was #define dname def_expr }
  511. AP_METHOD_BIT = apr_int64_t(1);
  512. {* @see ap_method_list_t }
  513. type
  514. {*
  515. * @struct ap_method_list_t
  516. * @brief Structure for handling HTTP methods.
  517. *
  518. * Methods known to the server are accessed via a bitmask shortcut;
  519. * extension methods are handled by an array.
  520. }
  521. Pap_method_list_t = ^ap_method_list_t;
  522. ap_method_list_t = record
  523. {* The bitmask used for known methods }
  524. method_mask : apr_int64_t;
  525. {* the array used for extension methods }
  526. method_list : Papr_array_header_t;
  527. end;
  528. {*
  529. * @defgroup module_magic Module Magic mime types
  530. * @
  531. }
  532. const
  533. {* Magic for mod_cgi[d] }
  534. CGI_MAGIC_TYPE = 'application/x-httpd-cgi';
  535. {* Magic for mod_include }
  536. INCLUDES_MAGIC_TYPE = 'text/x-server-parsed-html';
  537. {* Magic for mod_include }
  538. INCLUDES_MAGIC_TYPE3 = 'text/x-server-parsed-html3';
  539. {* Magic for mod_dir }
  540. DIR_MAGIC_TYPE = 'httpd/unix-directory';
  541. {* @ }
  542. { Just in case your linefeed isn't the one the other end is expecting. }
  543. const
  544. {* linefeed }
  545. LF = 10;
  546. {* carrige return }
  547. CR = 13;
  548. {* carrige return /Line Feed Combo }
  549. CRLF = #015#012;
  550. {*
  551. * @defgroup values_request_rec_body Possible values for request_rec.read_body
  552. * @
  553. * Possible values for request_rec.read_body (set by handling module):
  554. }
  555. {* Send 413 error if message has any body }
  556. REQUEST_NO_BODY = 0;
  557. {* Send 411 error if body without Content-Length }
  558. REQUEST_CHUNKED_ERROR = 1;
  559. {* If chunked, remove the chunks for me. }
  560. REQUEST_CHUNKED_DECHUNK = 2;
  561. {* @ // values_request_rec_body }
  562. {*
  563. * @defgroup values_request_rec_used_path_info Possible values for request_rec.used_path_info
  564. * @ingroup APACHE_CORE_DAEMON
  565. * @
  566. * Possible values for request_rec.used_path_info:
  567. }
  568. {* Accept the path_info from the request }
  569. AP_REQ_ACCEPT_PATH_INFO = 0;
  570. {* Return a 404 error if path_info was given }
  571. AP_REQ_REJECT_PATH_INFO = 1;
  572. {* Module may chose to use the given path_info }
  573. AP_REQ_DEFAULT_PATH_INFO = 2;
  574. {* @ // values_request_rec_used_path_info }
  575. {
  576. * Things which may vary per file-lookup WITHIN a request ---
  577. * e.g., state of MIME config. Basically, the name of an object, info
  578. * about the object, and any other info we may ahve which may need to
  579. * change as we go poking around looking for it (e.g., overridden by
  580. * .htaccess files).
  581. *
  582. * Note how the default state of almost all these things is properly
  583. * zero, so that allocating it with pcalloc does the right thing without
  584. * a whole lot of hairy initialization... so long as we are willing to
  585. * make the (fairly) portable assumption that the bit pattern of a NULL
  586. * pointer is, in fact, zero.
  587. }
  588. {*
  589. * @brief This represents the result of calling htaccess; these are cached for
  590. * each request.
  591. }
  592. type
  593. Phtaccess_result = ^htaccess_result;
  594. htaccess_result = record
  595. {* the directory to which this applies }
  596. dir : Pchar;
  597. {* the overrides allowed for the .htaccess file }
  598. override : Integer;
  599. {* the override options allowed for the .htaccess file }
  600. override_opts : Integer;
  601. {* Table of allowed directives for override }
  602. override_list : Papr_table_t;
  603. {* the configuration directives }
  604. htaccess : Pap_conf_vector_t;
  605. {* the next one, or NULL if no more; N.B. never change this }
  606. next : Phtaccess_result;
  607. end;
  608. { The following four types define a hierarchy of activities, so that
  609. * given a request_rec r you can write r->connection->server->process
  610. * to get to the process_rec. While this reduces substantially the
  611. * number of arguments that various hooks require beware that in
  612. * threaded versions of the server you must consider multiplexing
  613. * issues. }
  614. //{$include "apr_uri.inc"}
  615. type
  616. {*
  617. * @brief A structure that represents one process
  618. }
  619. Pprocess_rec = ^process_rec;
  620. process_rec = record
  621. {* Global pool. Cleared upon normal exit }
  622. pool : Papr_pool_t;
  623. {* Configuration pool. Cleared upon restart }
  624. pconf : Papr_pool_t;
  625. {* The program name used to execute the program }
  626. short_name : PChar;
  627. {* The command line arguments }
  628. argv : PChar;
  629. {* Number of command line arguments passed to the program }
  630. argc : Integer;
  631. end;
  632. {*
  633. * @struct server_addr_rec
  634. * @brief A structure to be used for Per-vhost config
  635. }
  636. type
  637. Pserver_addr_rec = ^server_addr_rec;
  638. server_addr_rec = record
  639. {* The next server in the list }
  640. next : Pserver_addr_rec;
  641. {* The name given in "<VirtualHost>" }
  642. virthost : Pchar;
  643. {* The bound address, for this server }
  644. host_addr : Papr_sockaddr_t;
  645. {* The bound port, for this server }
  646. host_port : apr_port_t;
  647. end;
  648. Pap_logconf = ^ap_logconf;
  649. ap_logconf = record
  650. {* The per-module log levels }
  651. module_levels : ^char;
  652. {* The log level for this server }
  653. level : longint;
  654. end;
  655. {*
  656. * @brief A structure to store information for each virtual server
  657. }
  658. PPserver_rec = ^Pserver_rec;
  659. Pserver_rec = ^server_rec;
  660. server_rec = record
  661. {* The process this server is running in }
  662. process : Pprocess_rec;
  663. {* The next server in the list }
  664. next : Pserver_rec;
  665. { Log files --- note that transfer log is now in the modules... }
  666. {* The name of the error log }
  667. error_fname : Pchar;
  668. {* A file descriptor that references the error log }
  669. error_log : Papr_file_t;
  670. {* The log level configuration }
  671. log : ap_logconf;
  672. { Module-specific configuration for server, and defaults... }
  673. {* Config vector containing pointers to modules' per-server config
  674. * structures. }
  675. module_config : Pap_conf_vector_t;
  676. {* MIME type info, etc., before we start checking per-directory info }
  677. lookup_defaults : Pap_conf_vector_t;
  678. {* The name of the server }
  679. defn_name : Pchar;
  680. {* The line of the config file that the server was defined on }
  681. defn_line_number : dword;
  682. {* true if this is the virtual server }
  683. is_virtual : char;
  684. { Information for redirects }
  685. {* for redirects, etc. }
  686. port : apr_port_t;
  687. {* The server request scheme for redirect responses }
  688. server_scheme : Pchar;
  689. { Contact information }
  690. {* The admin's contact information }
  691. server_admin : Pchar;
  692. {* The server hostname }
  693. server_hostname : Pchar;
  694. { Transaction handling }
  695. {* I haven't got a clue }
  696. addrs : Pserver_addr_rec;
  697. {* Timeout, as an apr interval, before we give up }
  698. timeout : apr_interval_time_t;
  699. {* The apr interval we will wait for another request }
  700. keep_alive_timeout : apr_interval_time_t;
  701. {* Maximum requests per connection }
  702. keep_alive_max : Integer;
  703. {* Use persistent connections? }
  704. keep_alive : Integer;
  705. {* Normal names for ServerAlias servers }
  706. names : Papr_array_header_t;
  707. {* Wildcarded names for ServerAlias servers }
  708. wild_names : Papr_array_header_t;
  709. {* Pathname for ServerPath }
  710. path : Pchar;
  711. {* Length of path }
  712. pathlen : Integer;
  713. {* limit on size of the HTTP request line }
  714. limit_req_line : Integer;
  715. {* limit on size of any request header field }
  716. limit_req_fieldsize : Integer;
  717. {* limit on number of request header fields }
  718. limit_req_fields : Integer;
  719. {* Opaque storage location }
  720. context : pointer;
  721. end;
  722. {*
  723. * @brief Structure to store things which are per connection
  724. }
  725. type
  726. ap_conn_keepalive_e = (AP_CONN_UNKNOWN,AP_CONN_CLOSE,AP_CONN_KEEPALIVE);
  727. {*
  728. * Enumeration of connection states
  729. * The two states CONN_STATE_LINGER_NORMAL and CONN_STATE_LINGER_SHORT may
  730. * only be set by the MPM. Use CONN_STATE_LINGER outside of the MPM.}
  731. conn_state_e = (
  732. CONN_STATE_CHECK_REQUEST_LINE_READABLE,
  733. CONN_STATE_READ_REQUEST_LINE,
  734. CONN_STATE_HANDLER,
  735. CONN_STATE_WRITE_COMPLETION,
  736. CONN_STATE_SUSPENDED,
  737. CONN_STATE_LINGER, { connection may be closed with lingering }
  738. CONN_STATE_LINGER_NORMAL, { MPM has started lingering close with normal timeout }
  739. CONN_STATE_LINGER_SHORT); { MPM has started lingering close with short timeout }
  740. {*
  741. * @brief A structure to contain connection state information}
  742. Pconn_state_t = ^conn_state_t;
  743. conn_state_t = record
  744. {* Current state of the connection }
  745. state : conn_state_e;
  746. end;
  747. Pconn_rec = ^conn_rec;
  748. conn_rec = record
  749. {* Pool associated with this connection }
  750. pool : Papr_pool_t;
  751. {* Physical vhost this conn came in on }
  752. base_server : Pserver_rec;
  753. {* used by http_vhost.c }
  754. vhost_lookup_data : pointer;
  755. { Information about the connection itself }
  756. {* local address }
  757. local_addr : Papr_sockaddr_t;
  758. {* remote address; this is the end-point of the next hop, for the address
  759. * of the request creator, see useragent_addr in request_rec
  760. }
  761. remote_addr {client_addr} : Papr_sockaddr_t; //fpc -> renamed to stay compatible with older apache versions and older fcl-web
  762. {* Client's IP address; this is the end-point of the next hop, for the
  763. * IP of the request creator, see useragent_ip in request_rec
  764. }
  765. remote_ip {client_ip} : Pchar; //fpc -> renamed to stay compatible with older apache versions and older fcl-web
  766. {* Client's DNS name, if known. NULL if DNS hasn't been checked,
  767. * "" if it has and no address was found. N.B. Only access this though
  768. * get_remote_host() }
  769. remote_host : Pchar;
  770. {* Only ever set if doing rfc1413 lookups. N.B. Only access this through
  771. * get_remote_logname() }
  772. remote_logname : Pchar;
  773. {* server IP address }
  774. local_ip : Pchar;
  775. {* used for ap_get_server_name when UseCanonicalName is set to DNS
  776. * (ignores setting of HostnameLookups) }
  777. local_host : Pchar;
  778. {* ID of this connection; unique at any point in time }
  779. id : clong;
  780. {* Config vector containing pointers to connections per-server
  781. * config structures. }
  782. conn_config : Pap_conf_vector_t;
  783. {* Notes on *this* connection: send note from one module to
  784. * another. must remain valid for all requests on this conn }
  785. notes : Papr_table_t;
  786. {* A list of input filters to be used for this connection }
  787. input_filters : Pap_filter_t;
  788. {* A list of output filters to be used for this connection }
  789. output_filters : Pap_filter_t;
  790. {* handle to scoreboard information for this connection }
  791. sbh : pointer;
  792. {* The bucket allocator to use for all bucket/brigade creations }
  793. bucket_alloc : Papr_bucket_alloc_t;
  794. {* The current state of this connection; may be NULL if not used by MPM }
  795. cs : Pconn_state_t;
  796. {* Is there data pending in the input filters? }
  797. data_in_input_filters : cint;
  798. {* Is there data pending in the output filters? }
  799. data_in_output_filters : cint;
  800. {* Are there any filters that clogg/buffer the input stream, breaking
  801. * the event mpm.
  802. }
  803. clogging_input_filters: cint;
  804. {* have we done double-reverse DNS? -1 yes/failure, 0 not yet,
  805. * 1 yes/success }
  806. double_reverse: Cardinal;
  807. {* Are we still talking? }
  808. aborted : Cardinal;
  809. {* Are we going to keep the connection alive for another request?
  810. * @see ap_conn_keepalive_e }
  811. keepalive : ap_conn_keepalive_e;
  812. {* How many times have we used it? }
  813. keepalives : Integer;
  814. {* Optional connection log level configuration. May point to a server or
  815. * per_dir config, i.e. must be copied before modifying }
  816. log : Pap_logconf;
  817. {* Id to identify this connection in error log. Set when the first
  818. * error log entry for this connection is generated.
  819. }
  820. log_id : Pchar;
  821. {* This points to the current thread being used to process this request,
  822. * over the lifetime of a request, the value may change. Users of the connection
  823. * record should not rely upon it staying the same between calls that invole
  824. * the MPM.
  825. }
  826. //{$if APR_HAS_THREADS}
  827. // current_thread : Papr_thread_t;
  828. //{$endif}
  829. end;
  830. {*
  831. * @brief A structure that represents the current request
  832. }
  833. Prequest_rec = ^request_rec;
  834. request_rec = record
  835. {* The pool associated with the request }
  836. pool : Papr_pool_t;
  837. {* The connection to the client }
  838. connection : Pconn_rec;
  839. {* The virtual host for this request }
  840. server : Pserver_rec;
  841. {* Pointer to the redirected request if this is an external redirect }
  842. next : Prequest_rec;
  843. {* Pointer to the previous request if this is an internal redirect }
  844. prev : Prequest_rec;
  845. {* Pointer to the main request if this is a sub-request (see http_request.h) }
  846. main : Prequest_rec;
  847. { Info about the request itself... we begin with stuff that only protocol.c should ever touch... }
  848. {* First line of request }
  849. the_request : Pchar;
  850. {* HTTP/0.9, "simple" request (e.g. GET /foo\n w/no headers) }
  851. assbackwards : Integer;
  852. {* A proxy request (calculated during post_read_request/translate_name)
  853. * possible values PROXYREQ_NONE, PROXYREQ_PROXY, PROXYREQ_REVERSE,
  854. * PROXYREQ_RESPONSE
  855. }
  856. proxyreq : Integer;
  857. {* HEAD request, as opposed to GET }
  858. header_only : Integer;
  859. {* Protocol version number of protocol; 1.1 = 1001 }
  860. proto_num : Integer;
  861. {* Protocol string, as given to us, or HTTP/0.9 }
  862. protocol : Pchar;
  863. {* Host, as set by full URI or Host: }
  864. hostname : Pchar;
  865. {* Time when the request started }
  866. request_time : apr_time_t;
  867. {* Status line, if set by script }
  868. status_line : Pchar;
  869. {* Status line }
  870. status : Integer;
  871. { Request method, two ways; also, protocol, etc.. Outside of protocol.c,
  872. * look, but don't touch.
  873. }
  874. {* M_GET, M_POST, etc. }
  875. method_number : Integer;
  876. {* Request method (eg. GET, HEAD, POST, etc.) }
  877. method : Pchar;
  878. {*
  879. * 'allowed' is a bitvector of the allowed methods.
  880. *
  881. * A handler must ensure that the request method is one that
  882. * it is capable of handling. Generally modules should DECLINE
  883. * any request methods they do not handle. Prior to aborting the
  884. * handler like this the handler should set r->allowed to the list
  885. * of methods that it is willing to handle. This bitvector is used
  886. * to construct the "Allow:" header required for OPTIONS requests,
  887. * and HTTP_METHOD_NOT_ALLOWED and HTTP_NOT_IMPLEMENTED status codes.
  888. *
  889. * Since the default_handler deals with OPTIONS, all modules can
  890. * usually decline to deal with OPTIONS. TRACE is always allowed,
  891. * modules don't need to set it explicitly.
  892. *
  893. * Since the default_handler will always handle a GET, a
  894. * module which does *not* implement GET should probably return
  895. * HTTP_METHOD_NOT_ALLOWED. Unfortunately this means that a Script GET
  896. * handler can't be installed by mod_actions.
  897. }
  898. allowed : apr_int64_t;
  899. {* Array of extension methods }
  900. allowed_xmethods : Papr_array_header_t;
  901. {* List of allowed methods }
  902. allowed_methods : Pap_method_list_t;
  903. {* byte count in stream is for body }
  904. sent_bodyct : apr_off_t;
  905. {* body byte count, for easy access }
  906. bytes_sent : apr_off_t;
  907. {* Last modified time of the requested resource }
  908. mtime : apr_time_t;
  909. { HTTP/1.1 connection-level features }
  910. {* The Range: header }
  911. range : Pchar;
  912. {* The "real" content length }
  913. clength : apr_off_t;
  914. {* sending chunked transfer-coding }
  915. chunked : Integer;
  916. {* Method for reading the request body
  917. * (eg. REQUEST_CHUNKED_ERROR, REQUEST_NO_BODY,
  918. * REQUEST_CHUNKED_DECHUNK, etc...) }
  919. read_body : Integer;
  920. {* reading chunked transfer-coding }
  921. read_chunked : Integer;
  922. {* is client waiting for a 100 response? }
  923. expecting_100 : Cardinal;
  924. {* The optional kept body of the request. }
  925. kept_body : Papr_bucket_brigade;
  926. {* For ap_body_to_table(): parsed body }
  927. { XXX: ap_body_to_table has been removed. Remove body_table too or
  928. * XXX: keep it to reintroduce ap_body_to_table without major bump? }
  929. body_table : Papr_table_t;
  930. {* Remaining bytes left to read from the request body }
  931. remaining : apr_off_t;
  932. {* Number of bytes that have been read from the request body }
  933. read_length : apr_off_t;
  934. { MIME header environments, in and out. Also, an array containing
  935. * environment variables to be passed to subprocesses, so people can
  936. * write modules to add to that environment.
  937. *
  938. * The difference between headers_out and err_headers_out is that the
  939. * latter are printed even on error, and persist across internal redirects
  940. * (so the headers printed for ErrorDocument handlers will have them).
  941. *
  942. * The 'notes' apr_table_t is for notes from one module to another, with no
  943. * other set purpose in mind...
  944. }
  945. {* MIME header environment from the request }
  946. headers_in : Papr_table_t;
  947. {* MIME header environment for the response }
  948. headers_out : Papr_table_t;
  949. {* MIME header environment for the response, printed even on errors and
  950. * persist across internal redirects }
  951. err_headers_out : Papr_table_t;
  952. {* Array of environment variables to be used for sub processes }
  953. subprocess_env : Papr_table_t;
  954. {* Notes from one module to another }
  955. notes : Papr_table_t;
  956. { content_type, handler, content_encoding, and all content_languages
  957. * MUST be lowercased strings. They may be pointers to static strings;
  958. * they should not be modified in place.
  959. }
  960. {* The content-type for the current request }
  961. content_type : Pchar; { Break these out --- we dispatch on 'em }
  962. {* The handler string that we use to call a handler function }
  963. handler : Pchar; { What we *really* dispatch on }
  964. {* How to encode the data }
  965. content_encoding : Pchar;
  966. {* Array of strings representing the content languages }
  967. content_languages : Papr_array_header_t;
  968. {* variant list validator (if negotiated) }
  969. vlist_validator : Pchar;
  970. {* If an authentication check was made, this gets set to the user name. }
  971. user : Pchar;
  972. {* If an authentication check was made, this gets set to the auth type. }
  973. ap_auth_type : Pchar;
  974. { What object is being requested (either directly, or via include
  975. * or content-negotiation mapping).
  976. }
  977. {* The URI without any parsing performed }
  978. unparsed_uri : Pchar;
  979. {* The path portion of the URI, or "/" if no path provided }
  980. uri : Pchar;
  981. {* The filename on disk corresponding to this response }
  982. filename : Pchar;
  983. { XXX: What does this mean? Please define "canonicalize" -aaron }
  984. {* The true filename, we canonicalize r->filename if these don't match }
  985. canonical_filename : Pchar;
  986. {* The PATH_INFO extracted from this request }
  987. path_info : Pchar;
  988. {* The QUERY_ARGS extracted from this request }
  989. args : Pchar;
  990. {*
  991. * Flag for the handler to accept or reject path_info on
  992. * the current request. All modules should respect the
  993. * AP_REQ_ACCEPT_PATH_INFO and AP_REQ_REJECT_PATH_INFO
  994. * values, while AP_REQ_DEFAULT_PATH_INFO indicates they
  995. * may follow existing conventions. This is set to the
  996. * user's preference upon HOOK_VERY_FIRST of the fixups.
  997. }
  998. used_path_info : Integer;
  999. {* A flag to determine if the eos bucket has been sent yet }
  1000. eos_sent : Integer;
  1001. { Various other config info which may change with .htaccess files
  1002. * These are config vectors, with one void* pointer for each module
  1003. * (the thing pointed to being the module's business).
  1004. }
  1005. {* Options set in config files, etc. }
  1006. per_dir_config : Pap_conf_vector_t;
  1007. {* Notes on *this* request }
  1008. request_config : Pap_conf_vector_t;
  1009. {* Optional request log level configuration. Will usually point
  1010. * to a server or per_dir config, i.e. must be copied before
  1011. * modifying }
  1012. log : Pap_logconf;
  1013. {* Id to identify request in access and error log. Set when the first
  1014. * error log entry for this request is generated.
  1015. }
  1016. log_id : Pchar;
  1017. {*
  1018. * A linked list of the .htaccess configuration directives
  1019. * accessed by this request.
  1020. * N.B. always add to the head of the list, _never_ to the end.
  1021. * that way, a sub request's list can (temporarily) point to a parent's list
  1022. }
  1023. htaccess : Phtaccess_result;
  1024. {* A list of output filters to be used for this request }
  1025. output_filters : Pap_filter_t;
  1026. {* A list of input filters to be used for this request }
  1027. input_filters : Pap_filter_t;
  1028. {* A list of protocol level output filters to be used for this
  1029. * request }
  1030. proto_output_filters : Pap_filter_t;
  1031. {* A list of protocol level input filters to be used for this
  1032. * request }
  1033. proto_input_filters : Pap_filter_t;
  1034. {* This response can not be cached }
  1035. no_cache : Integer;
  1036. {* There is no local copy of this response }
  1037. no_local_copy : Integer;
  1038. {* Mutex protect callbacks registered with ap_mpm_register_timed_callback
  1039. * from being run before the original handler finishes running
  1040. }
  1041. invoke_mtx : Papr_thread_mutex_t;
  1042. {* A struct containing the components of URI }
  1043. parsed_uri : apr_uri_t;
  1044. {* finfo.protection (st_mode) set to zero if no such file }
  1045. finfo : apr_finfo_t;
  1046. {* remote address information from conn_rec, can be overridden if
  1047. * necessary by a module.
  1048. * This is the address that originated the request.
  1049. }
  1050. useragent_addr : Papr_sockaddr_t;
  1051. useragent_ip : Pchar;
  1052. end;
  1053. {*
  1054. * @defgroup ProxyReq Proxy request types
  1055. *
  1056. * Possible values of request_rec->proxyreq. A request could be normal,
  1057. * proxied or reverse proxied. Normally proxied and reverse proxied are
  1058. * grouped together as just "proxied", but sometimes it's necessary to
  1059. * tell the difference between the two, such as for authentication.
  1060. * @
  1061. }
  1062. const
  1063. PROXYREQ_NONE = 0;{*< No proxy }
  1064. PROXYREQ_PROXY = 1;{*< Standard proxy }
  1065. PROXYREQ_REVERSE = 2;{*< Reverse proxy }
  1066. PROXYREQ_RESPONSE = 3;{*< Origin response }
  1067. { @ }
  1068. {*
  1069. * @brief Enumeration of connection keepalive options
  1070. }
  1071. // type {moved up}
  1072. // ap_conn_keepalive_e = (AP_CONN_UNKNOWN,AP_CONN_CLOSE,AP_CONN_KEEPALIVE);
  1073. { Per-vhost config... }
  1074. {*
  1075. * The address 255.255.255.255, when used as a virtualhost address,
  1076. * will become the "default" server when the ip doesn't match other vhosts.
  1077. }
  1078. const
  1079. DEFAULT_VHOST_ADDR = $ffffffff;
  1080. {*
  1081. * Get the context_document_root for a request. This is a generalization of
  1082. * the document root, which is too limited in the presence of mappers like
  1083. * mod_userdir and mod_alias. The context_document_root is the directory
  1084. * on disk that maps to the context_prefix URI prefix.
  1085. * @param r The request
  1086. * @note For resources that do not map to the file system or for very complex
  1087. * mappings, this information may still be wrong.
  1088. }
  1089. function ap_context_document_root(r: Prequest_rec): PChar;
  1090. {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
  1091. external LibHTTPD name LibNamePrefix + 'ap_context_document_root' + LibSuff4;
  1092. {*
  1093. * Get the context_prefix for a request. The context_prefix URI prefix
  1094. * maps to the context_document_root on disk.
  1095. * @param r The request
  1096. }
  1097. function ap_context_prefix(r: Prequest_rec): PChar;
  1098. {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
  1099. external LibHTTPD name LibNamePrefix + 'ap_context_prefix' + LibSuff4;
  1100. {* Set context_prefix and context_document_root for a request.
  1101. * @param r The request
  1102. * @param prefix the URI prefix, without trailing slash
  1103. * @param document_root the corresponding directory on disk, without trailing
  1104. * slash
  1105. * @note If one of prefix of document_root is NULL, the corrsponding
  1106. * property will not be changed.
  1107. }
  1108. procedure ap_set_context_info(r: Prequest_rec; const prefix, document_root: PChar);
  1109. {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
  1110. external LibHTTPD name LibNamePrefix + 'ap_set_context_info' + LibSuff12;
  1111. {* Set per-request document root. This is for mass virtual hosting modules
  1112. * that want to provide the correct DOCUMENT_ROOT value to scripts.
  1113. * @param r The request
  1114. * @param document_root the document root for the request.
  1115. }
  1116. procedure ap_set_document_root(r: Prequest_rec; const document_root: PChar);
  1117. {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
  1118. external LibHTTPD name LibNamePrefix + 'ap_set_document_root' + LibSuff8;
  1119. {*
  1120. * Examine a field value (such as a media-/content-type) string and return
  1121. * it sans any parameters; e.g., strip off any ';charset=foo' and the like.
  1122. * @param p Pool to allocate memory from
  1123. * @param intype The field to examine
  1124. * @return A copy of the field minus any parameters
  1125. }
  1126. function ap_field_noparam(p: Papr_pool_t; const intype: PChar): PChar;
  1127. {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
  1128. external LibHTTPD name LibNamePrefix + 'ap_field_noparam' + LibSuff8;
  1129. {*
  1130. * Convert a time from an integer into a string in a specified format
  1131. * @param p The pool to allocate memory from
  1132. * @param t The time to convert
  1133. * @param fmt The format to use for the conversion
  1134. * @param gmt Convert the time for GMT?
  1135. * @return The string that represents the specified time
  1136. }
  1137. function ap_ht_time(p: Papr_pool_t; t: apr_time_t; const fmt: PChar; gmt: Integer): PChar;
  1138. {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
  1139. external LibHTTPD name LibNamePrefix + 'ap_ht_time' + LibSuff20;
  1140. { String handling. The *_nc variants allow you to use non-const char **s as
  1141. arguments (unfortunately C won't automatically convert a char ** to a const
  1142. char **) }
  1143. {*
  1144. * Get the characters until the first occurance of a specified character
  1145. * @param p The pool to allocate memory from
  1146. * @param line The string to get the characters from
  1147. * @param stop The character to stop at
  1148. * @return A copy of the characters up to the first stop character
  1149. }
  1150. function ap_getword(p: Papr_pool_t; const line: PPChar; stop: Char): PChar;
  1151. {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
  1152. external LibHTTPD name LibNamePrefix + 'ap_getword' + LibSuff12;
  1153. {*
  1154. * Get the characters until the first occurance of a specified character
  1155. * @param p The pool to allocate memory from
  1156. * @param line The string to get the characters from
  1157. * @param stop The character to stop at
  1158. * @return A copy of the characters up to the first stop character
  1159. * @note This is the same as ap_getword(), except it doesn't use const char **.
  1160. }
  1161. function ap_getword_nc(p: Papr_pool_t; line: PPChar; stop: Char): PChar;
  1162. {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
  1163. external LibHTTPD name LibNamePrefix + 'ap_getword_nc' + LibSuff12;
  1164. {*
  1165. * Get the first word from a given string. A word is defined as all characters
  1166. * up to the first whitespace.
  1167. * @param p The pool to allocate memory from
  1168. * @param line The string to traverse
  1169. * @return The first word in the line
  1170. }
  1171. function ap_getword_white(p: Papr_pool_t; const line: PPChar): PChar;
  1172. {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
  1173. external LibHTTPD name LibNamePrefix + 'ap_getword_white' + LibSuff8;
  1174. {*
  1175. * Get the first word from a given string. A word is defined as all characters
  1176. * up to the first whitespace.
  1177. * @param p The pool to allocate memory from
  1178. * @param line The string to traverse
  1179. * @return The first word in the line
  1180. * @note The same as ap_getword_white(), except it doesn't use const char**
  1181. }
  1182. function ap_getword_white_nc(p: Papr_pool_t; line: PPChar): PChar;
  1183. {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
  1184. external LibHTTPD name LibNamePrefix + 'ap_getword_white_nc' + LibSuff8;
  1185. {*
  1186. * Get all characters from the first occurance of @a stop to the first "\0"
  1187. * @param p The pool to allocate memory from
  1188. * @param line The line to traverse
  1189. * @param stop The character to start at
  1190. * @return A copy of all caracters after the first occurance of the specified
  1191. * character
  1192. }
  1193. function ap_getword_nulls(p: Papr_pool_t; const line: PPChar; stop: Char): PChar;
  1194. {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
  1195. external LibHTTPD name LibNamePrefix + 'ap_getword_nulls' + LibSuff12;
  1196. {*
  1197. * Get all characters from the first occurance of @a stop to the first "\0"
  1198. * @param p The pool to allocate memory from
  1199. * @param line The line to traverse
  1200. * @param stop The character to start at
  1201. * @return A copy of all caracters after the first occurance of the specified
  1202. * character
  1203. * @note The same as ap_getword_nulls(), except it doesn't use const char **.
  1204. }
  1205. function ap_getword_nulls_nc(p: Papr_pool_t; line: PPChar; stop: Char): PChar;
  1206. {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
  1207. external LibHTTPD name LibNamePrefix + 'ap_getword_nulls_nc' + LibSuff12;
  1208. {*
  1209. * Get the second word in the string paying attention to quoting
  1210. * @param p The pool to allocate from
  1211. * @param line The line to traverse
  1212. * @return A copy of the string
  1213. }
  1214. function ap_getword_conf(p: Papr_pool_t; const line: PPChar): PChar;
  1215. {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
  1216. external LibHTTPD name LibNamePrefix + 'ap_getword_conf' + LibSuff8;
  1217. {*
  1218. * Get the second word in the string paying attention to quoting
  1219. * @param p The pool to allocate from
  1220. * @param line The line to traverse
  1221. * @return A copy of the string
  1222. * @note The same as ap_getword_conf(), except it doesn't use const char **.
  1223. }
  1224. function ap_getword_conf_nc(p: Papr_pool_t; line: PPChar): PChar;
  1225. {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
  1226. external LibHTTPD name LibNamePrefix + 'ap_getword_conf_nc' + LibSuff8;
  1227. {*
  1228. * Check a string for any config define or environment variable construct
  1229. * and replace each of them by the value of that variable, if it exists.
  1230. * The default syntax of the constructs is $ENV but can be changed by
  1231. * setting the define::* config defines. If the variable does not exist,
  1232. * leave the $ENV construct alone but print a warning.
  1233. * @param p The pool to allocate from
  1234. * @param word The string to check
  1235. * @return The string with the replaced environment variables
  1236. }
  1237. //AP_DECLARE(const char *) ap_resolve_env(apr_pool_t *p, const char * word);
  1238. function ap_resolve_env(p: Papr_pool_t; const word_: PChar): PChar;
  1239. {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
  1240. external LibHTTPD name LibNamePrefix + 'ap_resolve_env' + LibSuff8;
  1241. {*
  1242. * Size an HTTP header field list item, as separated by a comma.
  1243. * @param field The field to size
  1244. * @param len The length of the field
  1245. * @return The return value is a pointer to the beginning of the non-empty
  1246. * list item within the original string (or NULL if there is none) and the
  1247. * address of field is shifted to the next non-comma, non-whitespace
  1248. * character. len is the length of the item excluding any beginning whitespace.
  1249. }
  1250. //AP_DECLARE(const char *) ap_size_list_item(const char **field, int *len);
  1251. function ap_size_list_item(const field: PPChar; len: PInteger): PChar;
  1252. {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
  1253. external LibHTTPD name LibNamePrefix + 'ap_size_list_item' + LibSuff8;
  1254. {*
  1255. * Retrieve an HTTP header field list item, as separated by a comma,
  1256. * while stripping insignificant whitespace and lowercasing anything not in
  1257. * a quoted string or comment.
  1258. * @param p The pool to allocate from
  1259. * @param field The field to retrieve
  1260. * @return The return value is a new string containing the converted list
  1261. * item (or NULL if none) and the address pointed to by field is
  1262. * shifted to the next non-comma, non-whitespace.
  1263. }
  1264. function ap_get_list_item(p: Papr_pool_t; const field: PPChar): PChar;
  1265. {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
  1266. external LibHTTPD name LibNamePrefix + 'ap_get_list_item' + LibSuff8;
  1267. {*
  1268. * Find an item in canonical form (lowercase, no extra spaces) within
  1269. * an HTTP field value list.
  1270. * @param p The pool to allocate from
  1271. * @param line The field value list to search
  1272. * @param tok The token to search for
  1273. * @return 1 if found, 0 if not found.
  1274. }
  1275. function ap_find_list_item(p: Papr_pool_t; const line, tok: PChar): Integer;
  1276. {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
  1277. external LibHTTPD name LibNamePrefix + 'ap_find_list_item' + LibSuff12;
  1278. {*
  1279. * Retrieve a token, spacing over it and adjusting the pointer to
  1280. * the first non-white byte afterwards. Note that these tokens
  1281. * are delimited by semis and commas and can also be delimited
  1282. * by whitespace at the caller's option.
  1283. * @param p The pool to allocate from
  1284. * @param accept_line The line to retrieve the token from (adjusted afterwards)
  1285. * @param accept_white Is it delimited by whitespace
  1286. * @return the token
  1287. }
  1288. function ap_get_token(p: Papr_pool_t; const accept_line: PPChar; accept_white: Integer): PChar;
  1289. {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
  1290. external LibHTTPD name LibNamePrefix + 'ap_get_token' + LibSuff12;
  1291. {*
  1292. * Find http tokens, see the definition of token from RFC2068
  1293. * @param p The pool to allocate from
  1294. * @param line The line to find the token
  1295. * @param tok The token to find
  1296. * @return 1 if the token is found, 0 otherwise
  1297. }
  1298. function ap_find_token(p: Papr_pool_t; const line, tok: PChar): Integer;
  1299. {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
  1300. external LibHTTPD name LibNamePrefix + 'ap_find_token' + LibSuff12;
  1301. {*
  1302. * find http tokens from the end of the line
  1303. * @param p The pool to allocate from
  1304. * @param line The line to find the token
  1305. * @param tok The token to find
  1306. * @return 1 if the token is found, 0 otherwise
  1307. }
  1308. function ap_find_last_token(p: Papr_pool_t; const line, tok: PChar): Integer;
  1309. {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
  1310. external LibHTTPD name LibNamePrefix + 'ap_find_last_token' + LibSuff12;
  1311. {*
  1312. * Check for an Absolute URI syntax
  1313. * @param u The string to check
  1314. * @return 1 if URI, 0 otherwise
  1315. }
  1316. function ap_is_url(const u: PChar): Integer;
  1317. {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
  1318. external LibHTTPD name LibNamePrefix + 'ap_is_url' + LibSuff4;
  1319. {*
  1320. * Unescape a string
  1321. * @param url The string to unescape
  1322. * @return 0 on success, non-zero otherwise
  1323. }
  1324. function ap_unescape_all(url: PChar): Integer;
  1325. {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
  1326. external LibHTTPD name LibNamePrefix + 'ap_unescape_all' + LibSuff4;
  1327. {*
  1328. * Unescape a URL
  1329. * @param url The url to unescape
  1330. * @return 0 on success, non-zero otherwise
  1331. }
  1332. function ap_unescape_url(url: PChar): Integer;
  1333. {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
  1334. external LibHTTPD name LibNamePrefix + 'ap_unescape_url' + LibSuff4;
  1335. {*
  1336. * Unescape a URL, but leaving %2f (slashes) escaped
  1337. * @param url The url to unescape
  1338. * @param decode_slashes Whether or not slashes should be decoded
  1339. * @return 0 on success, non-zero otherwise
  1340. }
  1341. function ap_unescape_url_keep2f(url: PChar; decode_slashes: Integer): Integer;
  1342. {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
  1343. external LibHTTPD name LibNamePrefix + 'ap_unescape_url_keep2f' + LibSuff8;
  1344. {*
  1345. * Unescape an application/x-www-form-urlencoded string
  1346. * @param query The query to unescape
  1347. * @return 0 on success, non-zero otherwise
  1348. }
  1349. function ap_unescape_urlencoded(query: PChar): Integer;
  1350. {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
  1351. external LibHTTPD name LibNamePrefix + 'ap_unescape_urlencoded' + LibSuff4;
  1352. {*
  1353. * Convert all double slashes to single slashes
  1354. * @param name The string to convert
  1355. }
  1356. procedure ap_no2slash(name: PChar);
  1357. {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
  1358. external LibHTTPD name LibNamePrefix + 'ap_no2slash' + LibSuff4;
  1359. {*
  1360. * Remove all ./ and xx/../ substrings from a file name. Also remove
  1361. * any leading ../ or /../ substrings.
  1362. * @param name the file name to parse
  1363. }
  1364. procedure ap_getparents(name: PChar);
  1365. {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
  1366. external LibHTTPD name LibNamePrefix + 'ap_getparents' + LibSuff4;
  1367. {*
  1368. * Escape a path segment, as defined in RFC 1808
  1369. * @param p The pool to allocate from
  1370. * @param s The path to convert
  1371. * @return The converted URL
  1372. }
  1373. function ap_escape_path_segment(p: Papr_pool_t; const s: PChar): PChar;
  1374. {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
  1375. external LibHTTPD name LibNamePrefix + 'ap_escape_path_segment' + LibSuff8;
  1376. {*
  1377. * Escape a path segment, as defined in RFC 1808, to a preallocated buffer.
  1378. * @param c The preallocated buffer to write to
  1379. * @param s The path to convert
  1380. * @return The converted URL (c)
  1381. }
  1382. function ap_escape_path_segment_buffer(c: PChar; const s: PChar): PChar;
  1383. {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
  1384. external LibHTTPD name LibNamePrefix + 'ap_escape_path_segment_buffer' + LibSuff8;
  1385. {*
  1386. * convert an OS path to a URL in an OS dependant way.
  1387. * @param p The pool to allocate from
  1388. * @param path The path to convert
  1389. * @param partial if set, assume that the path will be appended to something
  1390. * with a '/' in it (and thus does not prefix "./")
  1391. * @return The converted URL
  1392. }
  1393. function ap_os_escape_path(p: Papr_pool_t; const path: PChar; partial: Integer): PChar;
  1394. {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
  1395. external LibHTTPD name LibNamePrefix + 'ap_os_escape_path' + LibSuff12;
  1396. {* @see ap_os_escape_path }
  1397. { was #define dname(params) para_def_expr }
  1398. { argument types are unknown }
  1399. { return type might be wrong }
  1400. //#define ap_escape_uri(ppool,path) ap_os_escape_path(ppool,path,1)
  1401. function ap_escape_uri(ppool: Papr_pool_t; const path: PChar) : PChar;
  1402. {*
  1403. * Escape a string as application/x-www-form-urlencoded
  1404. * @param p The pool to allocate from
  1405. * @param s The path to convert
  1406. * @return The converted URL
  1407. }
  1408. function ap_escape_urlencoded(p: Papr_pool_t; const s: PChar): PChar;
  1409. {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
  1410. external LibHTTPD name LibNamePrefix + 'ap_escape_urlencoded' + LibSuff8;
  1411. {*
  1412. * Escape a string as application/x-www-form-urlencoded, to a preallocated buffer
  1413. * @param c The preallocated buffer to write to
  1414. * @param s The path to convert
  1415. * @return The converted URL (c)
  1416. }
  1417. function ap_escape_urlencoded_buffer(c: PChar; const s: PChar): PChar;
  1418. {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
  1419. external LibHTTPD name LibNamePrefix + 'ap_escape_urlencoded_buffer' + LibSuff8;
  1420. {*
  1421. * Escape an html string
  1422. * @param p The pool to allocate from
  1423. * @param s The html to escape
  1424. * @return The escaped string
  1425. }
  1426. //#define ap_escape_html(p,s) ap_escape_html2(p,s,0)
  1427. function ap_escape_html(p: Papr_pool_t; const s: PChar) : PChar;
  1428. {*
  1429. * Escape an html string
  1430. * @param p The pool to allocate from
  1431. * @param s The html to escape
  1432. * @param toasc Whether to escape all non-ASCII chars to \&\#nnn;
  1433. * @return The escaped string
  1434. }
  1435. function ap_escape_html2(p: Papr_pool_t; const s: PChar; toasc: Integer): PChar;
  1436. {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
  1437. external LibHTTPD name LibNamePrefix + 'ap_escape_html2' + LibSuff12;
  1438. {*
  1439. * Escape a string for logging
  1440. * @param p The pool to allocate from
  1441. * @param str The string to escape
  1442. * @return The escaped string
  1443. }
  1444. function ap_escape_logitem(p: Papr_pool_t; const str: PChar): PChar;
  1445. {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
  1446. external LibHTTPD name LibNamePrefix + 'ap_escape_logitem' + LibSuff8;
  1447. {*
  1448. * Escape a string for logging into the error log (without a pool)
  1449. * @param dest The buffer to write to
  1450. * @param source The string to escape
  1451. * @param buflen The buffer size for the escaped string (including "\0")
  1452. * @return The len of the escaped string (always < maxlen)
  1453. }
  1454. function ap_escape_errorlog_item(dest: PChar; const source: PChar;
  1455. buflen: apr_size_t): apr_size_t;
  1456. {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
  1457. external LibHTTPD name LibNamePrefix + 'ap_escape_errorlog_item' + LibSuff12;
  1458. {*
  1459. * Construct a full hostname
  1460. * @param p The pool to allocate from
  1461. * @param hostname The hostname of the server
  1462. * @param port The port the server is running on
  1463. * @param r The current request
  1464. * @return The server's hostname
  1465. }
  1466. function ap_construct_server(p: Papr_pool_t; const hostname: PChar;
  1467. port: apr_port_t; const r: Prequest_rec): PChar;
  1468. {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
  1469. external LibHTTPD name LibNamePrefix + 'ap_construct_server' + LibSuff16;
  1470. {*
  1471. * Escape a shell command
  1472. * @param p The pool to allocate from
  1473. * @param s The command to escape
  1474. * @return The escaped shell command
  1475. }
  1476. function ap_escape_shell_cmd(p: Papr_pool_t; const s: PChar): PChar;
  1477. {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
  1478. external LibHTTPD name LibNamePrefix + 'ap_escape_shell_cmd' + LibSuff8;
  1479. {*
  1480. * Count the number of directories in a path
  1481. * @param path The path to count
  1482. * @return The number of directories
  1483. }
  1484. function ap_count_dirs(const path: PChar): Integer;
  1485. {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
  1486. external LibHTTPD name LibNamePrefix + 'ap_count_dirs' + LibSuff4;
  1487. {*
  1488. * Copy at most @a n leading directories of @a s into @a d. @a d
  1489. * should be at least as large as @a s plus 1 extra byte
  1490. *
  1491. * @param d The location to copy to
  1492. * @param s The location to copy from
  1493. * @param n The number of directories to copy
  1494. * @return value is the ever useful pointer to the trailing "\0" of d
  1495. * @note on platforms with drive letters, n = 0 returns the "/" root,
  1496. * whereas n = 1 returns the "d:/" root. On all other platforms, n = 0
  1497. * returns the empty string. }
  1498. function ap_make_dirstr_prefix(d: PChar; const s: PChar; n: Integer): PChar;
  1499. {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
  1500. external LibHTTPD name LibNamePrefix + 'ap_make_dirstr_prefix' + LibSuff12;
  1501. {*
  1502. * Return the parent directory name (including trailing /) of the file
  1503. * @a s
  1504. * @param p The pool to allocate from
  1505. * @param s The file to get the parent of
  1506. * @return A copy of the file's parent directory
  1507. }
  1508. function ap_make_dirstr_parent(p: Papr_pool_t; const s: PChar): PChar;
  1509. {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
  1510. external LibHTTPD name LibNamePrefix + 'ap_make_dirstr_parent' + LibSuff8;
  1511. {*
  1512. * Given a directory and filename, create a single path from them. This
  1513. * function is smart enough to ensure that there is a single '/' between the
  1514. * directory and file names
  1515. * @param a The pool to allocate from
  1516. * @param dir The directory name
  1517. * @param f The filename
  1518. * @return A copy of the full path
  1519. * @note Never consider using this function if you are dealing with filesystem
  1520. * names that need to remain canonical, unless you are merging an apr_dir_read
  1521. * path and returned filename. Otherwise, the result is not canonical.
  1522. }
  1523. function ap_make_full_path(a: Papr_pool_t; const dir, f: PChar): PChar;
  1524. {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
  1525. external LibHTTPD name LibNamePrefix + 'ap_make_full_path' + LibSuff12;
  1526. {*
  1527. * Test if the given path has an an absolute path.
  1528. * @param p The pool to allocate from
  1529. * @param dir The directory name
  1530. * @note The converse is not necessarily true, some OS's (Win32/OS2/Netware) have
  1531. * multiple forms of absolute paths. This only reports if the path is absolute
  1532. * in a canonical sense.
  1533. }
  1534. function ap_os_is_path_absolute(p: Papr_pool_t; const dir: PChar): Integer;
  1535. {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
  1536. external LibHTTPD name LibNamePrefix + 'ap_os_is_path_absolute' + LibSuff8;
  1537. {*
  1538. * Does the provided string contain wildcard characters? This is useful
  1539. * for determining if the string should be passed to strcmp_match or to strcmp.
  1540. * The only wildcard characters recognized are '?' and '*'
  1541. * @param str The string to check
  1542. * @return 1 if the string has wildcards, 0 otherwise
  1543. }
  1544. function ap_is_matchexp(const str: PChar): Integer;
  1545. {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
  1546. external LibHTTPD name LibNamePrefix + 'ap_is_matchexp' + LibSuff4;
  1547. {*
  1548. * Determine if a string matches a patterm containing the wildcards '?' or '*'
  1549. * @param str The string to check
  1550. * @param expected The pattern to match against
  1551. * @return 0 if the two strings match, 1 otherwise
  1552. }
  1553. function ap_strcmp_match(const str, expected: PChar): Integer;
  1554. {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
  1555. external LibHTTPD name LibNamePrefix + 'ap_strcmp_match' + LibSuff8;
  1556. {*
  1557. * Determine if a string matches a patterm containing the wildcards '?' or '*',
  1558. * ignoring case
  1559. * @param str The string to check
  1560. * @param expected The pattern to match against
  1561. * @return 0 if the two strings match, 1 otherwise
  1562. }
  1563. function ap_strcasecmp_match(const str, expected: PChar): Integer;
  1564. {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
  1565. external LibHTTPD name LibNamePrefix + 'ap_strcasecmp_match' + LibSuff8;
  1566. {*
  1567. * Find the first occurrence of the substring s2 in s1, regardless of case
  1568. * @param s1 The string to search
  1569. * @param s2 The substring to search for
  1570. * @return A pointer to the beginning of the substring
  1571. * @remark See apr_strmatch() for a faster alternative
  1572. }
  1573. function ap_strcasestr(const s1, s2: PChar): PChar;
  1574. {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
  1575. external LibHTTPD name LibNamePrefix + 'ap_strcasestr' + LibSuff8;
  1576. {*
  1577. * Return a pointer to the location inside of bigstring immediately after prefix
  1578. * @param bigstring The input string
  1579. * @param prefix The prefix to strip away
  1580. * @return A pointer relative to bigstring after prefix
  1581. }
  1582. function ap_stripprefix(const bigstring, prefix: PChar): PChar;
  1583. {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
  1584. external LibHTTPD name LibNamePrefix + 'ap_stripprefix' + LibSuff8;
  1585. {*
  1586. * Decode a base64 encoded string into memory allocated from a pool
  1587. * @param p The pool to allocate from
  1588. * @param bufcoded The encoded string
  1589. * @return The decoded string
  1590. }
  1591. function ap_pbase64decode(p: Papr_pool_t; const bufcoded: PChar): PChar;
  1592. {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
  1593. external LibHTTPD name LibNamePrefix + 'ap_pbase64decode' + LibSuff8;
  1594. {*
  1595. * Encode a string into memory allocated from a pool in base 64 format
  1596. * @param p The pool to allocate from
  1597. * @param string The plaintext string
  1598. * @return The encoded string
  1599. }
  1600. //AP_DECLARE(char *) ap_pbase64encode(apr_pool_t *p, char *string);
  1601. function ap_pbase64encode(p: Papr_pool_t; string_: PChar): PChar;
  1602. {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
  1603. external LibHTTPD name LibNamePrefix + 'ap_pbase64encode' + LibSuff8;
  1604. {*
  1605. * Compile a regular expression to be used later. The regex is freed when
  1606. * the pool is destroyed.
  1607. * @param p The pool to allocate from
  1608. * @param pattern the regular expression to compile
  1609. * @param cflags The bitwise or of one or more of the following:
  1610. * @li REG_EXTENDED - Use POSIX extended Regular Expressions
  1611. * @li REG_ICASE - Ignore case
  1612. * @li REG_NOSUB - Support for substring addressing of matches
  1613. * not required
  1614. * @li REG_NEWLINE - Match-any-character operators don't match new-line
  1615. * @return The compiled regular expression
  1616. }
  1617. function ap_pregcomp(p: Papr_pool_t; const pattern: PChar; cflags: Integer): Pap_regex_t;
  1618. {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
  1619. external LibHTTPD name LibNamePrefix + 'ap_pregcomp' + LibSuff12;
  1620. {*
  1621. * Free the memory associated with a compiled regular expression
  1622. * @param p The pool the regex was allocated from
  1623. * @param reg The regular expression to free
  1624. * @note This function is only necessary if the regex should be cleaned
  1625. * up before the pool
  1626. }
  1627. procedure ap_pregfree(p: Papr_pool_t; reg: Pap_regex_t);
  1628. {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
  1629. external LibHTTPD name LibNamePrefix + 'ap_pregfree' + LibSuff8;
  1630. {*
  1631. * After performing a successful regex match, you may use this function to
  1632. * perform a series of string substitutions based on subexpressions that were
  1633. * matched during the call to ap_regexec. This function is limited to
  1634. * result strings of 64K. Consider using ap_pregsub_ex() instead.
  1635. * @param p The pool to allocate from
  1636. * @param input An arbitrary string containing $1 through $9. These are
  1637. * replaced with the corresponding matched sub-expressions
  1638. * @param source The string that was originally matched to the regex
  1639. * @param nmatch the nmatch returned from ap_pregex
  1640. * @param pmatch the pmatch array returned from ap_pregex
  1641. * @return The substituted string, or NULL on error
  1642. }
  1643. //AP_DECLARE(char *) ap_pregsub(apr_pool_t *p, const char *input,
  1644. // const char *source, apr_size_t nmatch,
  1645. // ap_regmatch_t pmatch[]);
  1646. function ap_pregsub(p: Papr_pool_t; const input, source: PChar;
  1647. nmatch: apr_size_t; pmatch: array of ap_regmatch_t): PChar;
  1648. {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
  1649. external LibHTTPD name LibNamePrefix + 'ap_pregsub' + LibSuff20;
  1650. {*
  1651. * After performing a successful regex match, you may use this function to
  1652. * perform a series of string substitutions based on subexpressions that were
  1653. * matched during the call to ap_regexec
  1654. * @param p The pool to allocate from
  1655. * @param result where to store the result, will be set to NULL on error
  1656. * @param input An arbitrary string containing $1 through $9. These are
  1657. * replaced with the corresponding matched sub-expressions
  1658. * @param source The string that was originally matched to the regex
  1659. * @param nmatch the nmatch returned from ap_pregex
  1660. * @param pmatch the pmatch array returned from ap_pregex
  1661. * @param maxlen the maximum string length to return, 0 for unlimited
  1662. * @return The substituted string, or NULL on error
  1663. }
  1664. //AP_DECLARE(apr_status_t) ap_pregsub_ex(apr_pool_t *p, char **result,
  1665. // const char *input, const char *source,
  1666. // apr_size_t nmatch,
  1667. // ap_regmatch_t pmatch[],
  1668. // apr_size_t maxlen);
  1669. function ap_pregsub_ex(p: Papr_pool_t; result_: PPChar; const input, source: PChar;
  1670. nmatch: apr_size_t;
  1671. pmatch: array of ap_regmatch_t;
  1672. maxlen: apr_size_t): apr_status_t;
  1673. {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
  1674. external LibHTTPD name LibNamePrefix + 'ap_pregsub_ex' + LibSuff28;
  1675. {*
  1676. * We want to downcase the type/subtype for comparison purposes
  1677. * but nothing else because ;parameter=foo values are case sensitive.
  1678. * @param s The content-type to convert to lowercase
  1679. }
  1680. procedure ap_content_type_tolower(s: PChar);
  1681. {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
  1682. external LibHTTPD name LibNamePrefix + 'ap_content_type_tolower' + LibSuff4;
  1683. {*
  1684. * convert a string to all lowercase
  1685. * @param s The string to convert to lowercase
  1686. }
  1687. procedure ap_str_tolower(s: PChar);
  1688. {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
  1689. external LibHTTPD name LibNamePrefix + 'ap_str_tolower' + LibSuff4;
  1690. {*
  1691. * convert a string to all uppercase
  1692. * @param s The string to convert to uppercase
  1693. }
  1694. procedure ap_str_toupper(s: PChar);
  1695. {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
  1696. external LibHTTPD name LibNamePrefix + 'ap_str_toupper' + LibSuff4;
  1697. {*
  1698. * Search a string from left to right for the first occurrence of a
  1699. * specific character
  1700. * @param str The string to search
  1701. * @param c The character to search for
  1702. * @return The index of the first occurrence of c in str
  1703. }
  1704. //AP_DECLARE(int) ap_ind(const char *str, char c); /* Sigh... */
  1705. function ap_ind(const str: PChar; c: Char): Integer;
  1706. {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
  1707. external LibHTTPD name LibNamePrefix + 'ap_ind' + LibSuff8;
  1708. {*
  1709. * Search a string from right to left for the first occurrence of a
  1710. * specific character
  1711. * @param str The string to search
  1712. * @param c The character to search for
  1713. * @return The index of the first occurrence of c in str
  1714. }
  1715. function ap_rind(const str: PChar; c: Char): Integer;
  1716. {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
  1717. external LibHTTPD name LibNamePrefix + 'ap_rind' + LibSuff8;
  1718. {*
  1719. * Given a string, replace any bare &quot; with \\&quot; .
  1720. * @param p The pool to allocate memory from
  1721. * @param instring The string to search for &quot;
  1722. * @return A copy of the string with escaped quotes
  1723. }
  1724. function ap_escape_quotes(p: Papr_pool_t; const instring: PChar): PChar;
  1725. {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
  1726. external LibHTTPD name LibNamePrefix + 'ap_escape_quotes' + LibSuff8;
  1727. {*
  1728. * Given a string, append the PID deliminated by delim.
  1729. * Usually used to create a pid-appended filepath name
  1730. * (eg: /a/b/foo -> /a/b/foo.6726). A function, and not
  1731. * a macro, to avoid unistd.h dependency
  1732. * @param p The pool to allocate memory from
  1733. * @param string The string to append the PID to
  1734. * @param delim The string to use to deliminate the string from the PID
  1735. * @return A copy of the string with the PID appended
  1736. }
  1737. function ap_append_pid(p: Papr_pool_t; const string_, delim: PChar): PChar;
  1738. {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
  1739. external LibHTTPD name LibNamePrefix + 'ap_append_pid' + LibSuff12;
  1740. {*
  1741. * Parse a given timeout parameter string into an apr_interval_time_t value.
  1742. * The unit of the time interval is given as postfix string to the numeric
  1743. * string. Currently the following units are understood:
  1744. *
  1745. * ms : milliseconds
  1746. * s : seconds
  1747. * mi[n] : minutes
  1748. * h : hours
  1749. *
  1750. * If no unit is contained in the given timeout parameter the default_time_unit
  1751. * will be used instead.
  1752. * @param timeout_parameter The string containing the timeout parameter.
  1753. * @param timeout The timeout value to be returned.
  1754. * @param default_time_unit The default time unit to use if none is specified
  1755. * in timeout_parameter.
  1756. * @return Status value indicating whether the parsing was successful or not.
  1757. }
  1758. function ap_timeout_parameter_parse(const timeout_parameter: PChar;
  1759. timeout: Papr_interval_time_t;
  1760. const default_time_unit: PChar): apr_status_t;
  1761. {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
  1762. external LibHTTPD name LibNamePrefix + 'ap_timeout_parameter_parse' + LibSuff12;
  1763. {*
  1764. * Determine if a request has a request body or not.
  1765. *
  1766. * @param r the request_rec of the request
  1767. * @return truth value
  1768. }
  1769. function ap_request_has_body(r: Prequest_rec): Integer;
  1770. {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
  1771. external LibHTTPD name LibNamePrefix + 'ap_request_has_body' + LibSuff4;
  1772. {*
  1773. * Cleanup a string (mainly to be filesystem safe)
  1774. * We only allow '_' and alphanumeric chars. Non-printable
  1775. * map to 'x' and all others map to '_'
  1776. *
  1777. * @param p pool to use to allocate dest
  1778. * @param src string to clean up
  1779. * @param dest cleaned up, allocated string
  1780. * @return Status value indicating whether the cleaning was successful or not.
  1781. }
  1782. function ap_pstr2_alnum(p: Papr_pool_t; const src: PChar;
  1783. const dest: PPChar): apr_status_t;
  1784. {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
  1785. external LibHTTPD name LibNamePrefix + 'ap_pstr2_alnum' + LibSuff12;
  1786. {*
  1787. * Cleanup a string (mainly to be filesystem safe)
  1788. * We only allow '_' and alphanumeric chars. Non-printable
  1789. * map to 'x' and all others map to '_'
  1790. *
  1791. * @param src string to clean up
  1792. * @param dest cleaned up, pre-allocated string
  1793. * @return Status value indicating whether the cleaning was successful or not.
  1794. }
  1795. function ap_str2_alnum(const src: PChar; dest: PChar): apr_status_t;
  1796. {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
  1797. external LibHTTPD name LibNamePrefix + 'ap_str2_alnum' + LibSuff8;
  1798. {*
  1799. * Structure to store the contents of an HTTP form of the type
  1800. * application/x-www-form-urlencoded.
  1801. *
  1802. * Currently it contains the name as a char* of maximum length
  1803. * HUGE_STRING_LEN, and a value in the form of a bucket brigade
  1804. * of arbitrary length.
  1805. }
  1806. (* Const before type ignored *)
  1807. type
  1808. ap_form_pair_t = record
  1809. name : PChar;
  1810. value : Papr_bucket_brigade;
  1811. end;
  1812. {*
  1813. * Read the body and parse any form found, which must be of the
  1814. * type application/x-www-form-urlencoded.
  1815. * @param r request containing POSTed form data
  1816. * @param f filter
  1817. * @param ptr returned array of ap_form_pair_t
  1818. * @param num max num of params or -1 for unlimited
  1819. * @param size max size allowed for parsed data
  1820. * @return OK or HTTP error
  1821. }
  1822. //AP_DECLARE(int) ap_parse_form_data(request_rec *r, struct ap_filter_t *f,
  1823. // apr_array_header_t **ptr,
  1824. // apr_size_t num, apr_size_t size);
  1825. function ap_parse_form_data(r: Prequest_rec; f: Pap_filter_t;
  1826. ptr: PPapr_array_header_t;
  1827. num: apr_size_t; size: apr_size_t): Integer;
  1828. {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
  1829. external LibHTTPD name LibNamePrefix + 'ap_parse_form_data' + LibSuff20;
  1830. { Misc system hackery }
  1831. {*
  1832. * Given the name of an object in the file system determine if it is a directory
  1833. * @param p The pool to allocate from
  1834. * @param name The name of the object to check
  1835. * @return 1 if it is a directory, 0 otherwise
  1836. }
  1837. function ap_is_rdirectory(p: Papr_pool_t; const name: PChar): Integer;
  1838. {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
  1839. external LibHTTPD name LibNamePrefix + 'ap_is_rdirectory' + LibSuff8;
  1840. {*
  1841. * Given the name of an object in the file system determine if it is a directory - this version is symlink aware
  1842. * @param p The pool to allocate from
  1843. * @param name The name of the object to check
  1844. * @return 1 if it is a directory, 0 otherwise
  1845. }
  1846. function ap_is_directory(p: Papr_pool_t; const name: PChar): Integer;
  1847. {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
  1848. external LibHTTPD name LibNamePrefix + 'ap_is_directory' + LibSuff8;
  1849. //#ifdef _OSD_POSIX
  1850. //extern int os_init_job_environment(server_rec *s, const char *user_name, int one_process);
  1851. //#endif /* _OSD_POSIX */
  1852. //{$ifdef _OSD_POSIX}
  1853. //function os_init_job_environment(s:Pserver_rec; const user_name:Pchar; one_process:integer):integer;cdecl;
  1854. //{$endif} { _OSD_POSIX }
  1855. {*
  1856. * Determine the local host name for the current machine
  1857. * @param p The pool to allocate from
  1858. * @return A copy of the local host name
  1859. }
  1860. //char *ap_get_local_host(apr_pool_t *p);
  1861. {*
  1862. * Log an assertion to the error log
  1863. * @param szExp The assertion that failed
  1864. * @param szFile The file the assertion is in
  1865. * @param nLine The line the assertion is defined on
  1866. }
  1867. procedure ap_log_assert(const szExp, szFile: PChar; nLine: Integer);
  1868. {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
  1869. external LibHTTPD name LibNamePrefix + 'ap_log_assert' + LibSuff12;
  1870. {*
  1871. * @internal Internal Assert function
  1872. }
  1873. {#define ap_assert(exp) ((exp) ? (void)0 : ap_log_assert(#exp,__FILE__,__LINE__)) }
  1874. {*
  1875. * Redefine assert() to something more useful for an Apache...
  1876. *
  1877. * Use ap_assert() if the condition should always be checked.
  1878. * Use AP_DEBUG_ASSERT() if the condition should only be checked when AP_DEBUG
  1879. * is defined.
  1880. }
  1881. {#ifdef AP_DEBUG
  1882. #define AP_DEBUG_ASSERT(exp) ap_assert(exp)
  1883. #else
  1884. #define AP_DEBUG_ASSERT(exp) ((void)0)
  1885. #endif }
  1886. {*
  1887. * @defgroup stopsignal Flags which indicate places where the server should stop for debugging.
  1888. * @
  1889. * A set of flags which indicate places where the server should raise(SIGSTOP).
  1890. * This is useful for debugging, because you can then attach to that process
  1891. * with gdb and continue. This is important in cases where one_process
  1892. * debugging isn't possible.
  1893. }
  1894. {* stop on a Detach }
  1895. {#define SIGSTOP_DETACH 1 }
  1896. {* stop making a child process }
  1897. {#define SIGSTOP_MAKE_CHILD 2 }
  1898. {* stop spawning a child process }
  1899. {#define SIGSTOP_SPAWN_CHILD 4 }
  1900. {* stop spawning a child process with a piped log }
  1901. {#define SIGSTOP_PIPED_LOG_SPAWN 8 }
  1902. {* stop spawning a CGI child process }
  1903. {#define SIGSTOP_CGI_CHILD 16 }
  1904. {* Macro to get GDB started }
  1905. {#ifdef DEBUG_SIGSTOP
  1906. extern int raise_sigstop_flags;
  1907. #define RAISE_SIGSTOP(x) do if (raise_sigstop_flags & SIGSTOP_##x) raise(SIGSTOP); while (0)
  1908. #else
  1909. #define RAISE_SIGSTOP(x)
  1910. #endif }
  1911. {* @ }
  1912. {*
  1913. * Get HTML describing the address and (optionally) admin of the server.
  1914. * @param prefix Text which is prepended to the return value
  1915. * @param r The request_rec
  1916. * @return HTML describing the server, allocated in @a r's pool.
  1917. }
  1918. function ap_psignature(const prefix: PChar; r: Prequest_rec): PChar;
  1919. {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
  1920. external LibHTTPD name LibNamePrefix + 'ap_psignature' + LibSuff8;
  1921. {* strtoul does not exist on sunos4. }
  1922. {$ifdef strtoul}
  1923. {$undef strtoul}
  1924. {$endif}
  1925. ///** strtoul does not exist on sunos4. */
  1926. //#ifdef strtoul
  1927. //#undef strtoul
  1928. //#endif
  1929. //#define strtoul strtoul_is_not_a_portable_function_use_strtol_instead
  1930. { The C library has functions that allow const to be silently dropped ...
  1931. these macros detect the drop in maintainer mode, but use the native
  1932. methods for normal builds
  1933. Note that on some platforms (e.g., AIX with gcc, Solaris with gcc), string.h needs
  1934. to be included before the macros are defined or compilation will fail.
  1935. }
  1936. {#include <string.h>
  1937. AP_DECLARE(char *) ap_strchr(char *s, int c);
  1938. AP_DECLARE(const char *) ap_strchr_c(const char *s, int c);
  1939. AP_DECLARE(char *) ap_strrchr(char *s, int c);
  1940. AP_DECLARE(const char *) ap_strrchr_c(const char *s, int c);
  1941. AP_DECLARE(char *) ap_strstr(char *s, const char *c);
  1942. AP_DECLARE(const char *) ap_strstr_c(const char *s, const char *c);
  1943. #ifdef AP_DEBUG
  1944. #undef strchr
  1945. # define strchr(s, c) ap_strchr(s,c)
  1946. #undef strrchr
  1947. # define strrchr(s, c) ap_strrchr(s,c)
  1948. #undef strstr
  1949. # define strstr(s, c) ap_strstr(s,c)
  1950. #else
  1951. }
  1952. {* use this instead of strchr }
  1953. {# define ap_strchr(s, c) strchr(s, c) }
  1954. {* use this instead of strchr }
  1955. {# define ap_strchr_c(s, c) strchr(s, c) }
  1956. {* use this instead of strrchr }
  1957. {# define ap_strrchr(s, c) strrchr(s, c) }
  1958. {* use this instead of strrchr }
  1959. {# define ap_strrchr_c(s, c) strrchr(s, c) }
  1960. {* use this instead of strrstr }
  1961. {# define ap_strstr(s, c) strstr(s, c) }
  1962. {* use this instead of strrstr }
  1963. {# define ap_strstr_c(s, c) strstr(s, c) }
  1964. {#endif }
  1965. {*
  1966. * Generate pseudo random bytes.
  1967. * This is a convenience interface to apr_random. It is cheaper but less
  1968. * secure than apr_generate_random_bytes().
  1969. * @param buf where to store the bytes
  1970. * @param size number of bytes to generate
  1971. * @note ap_random_insecure_bytes() is thread-safe, it uses a mutex on
  1972. * threaded MPMs.
  1973. }
  1974. procedure ap_random_insecure_bytes(buf: Pointer; size: apr_size_t);
  1975. {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
  1976. external LibHTTPD name LibNamePrefix + 'ap_random_insecure_bytes' + LibSuff8;
  1977. {*
  1978. * Get a pseudo random number in a range.
  1979. * @param min low end of range
  1980. * @param max high end of range
  1981. * @return a number in the range
  1982. }
  1983. function ap_random_pick(min, max: apr_uint32_t): apr_uint32_t;
  1984. {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
  1985. external LibHTTPD name LibNamePrefix + 'ap_random_pick' + LibSuff8;
  1986. {*
  1987. * Abort with a error message signifying out of memory
  1988. }
  1989. //AP_DECLARE(void) ap_abort_on_oom(void) __attribute__((noreturn));
  1990. procedure ap_abort_on_oom;
  1991. {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
  1992. external LibHTTPD name LibNamePrefix + 'ap_abort_on_oom' + LibSuff0;
  1993. {*
  1994. * Wrapper for malloc() that calls ap_abort_on_oom() if out of memory
  1995. * @param size size of the memory block
  1996. * @return pointer to the allocated memory
  1997. * @note ap_malloc may be implemented as a macro
  1998. }
  1999. function ap_malloc(size: size_t): Pointer;
  2000. {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
  2001. external LibHTTPD name LibNamePrefix + 'ap_malloc' + LibSuff4;
  2002. {*
  2003. * Wrapper for calloc() that calls ap_abort_on_oom() if out of memory
  2004. * @param nelem number of elements to allocate memory for
  2005. * @param size size of a single element
  2006. * @return pointer to the allocated memory
  2007. * @note ap_calloc may be implemented as a macro
  2008. }
  2009. //AP_DECLARE(void *) ap_calloc(size_t nelem, size_t size)
  2010. // __attribute__((malloc))
  2011. // AP_FN_ATTR_ALLOC_SIZE2(1,2);
  2012. {*
  2013. * Wrapper for realloc() that calls ap_abort_on_oom() if out of memory
  2014. * @param ptr pointer to the old memory block (or NULL)
  2015. * @param size new size of the memory block
  2016. * @return pointer to the reallocated memory
  2017. * @note ap_realloc may be implemented as a macro
  2018. }
  2019. //AP_DECLARE(void *) ap_realloc(void *ptr, size_t size)
  2020. //#define AP_NORESTART APR_OS_START_USEERR + 1
  2021. { !APACHE_HTTPD_H }
  2022. {* @ //APACHE Daemon }
  2023. {* @ //APACHE Core }
  2024. {* @ //APACHE super group }