http_config.inc 46 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206
  1. { Licensed to the Apache Software Foundation (ASF) under one or more
  2. * contributor license agreements. See the NOTICE file distributed with
  3. * this work for additional information regarding copyright ownership.
  4. * The ASF licenses this file to You under the Apache License, Version 2.0
  5. * (the "License"); you may not use this file except in compliance with
  6. * the License. You may obtain a copy of the License at
  7. *
  8. * http://www.apache.org/licenses/LICENSE-2.0
  9. *
  10. * Unless required by applicable law or agreed to in writing, software
  11. * distributed under the License is distributed on an "AS IS" BASIS,
  12. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  13. * See the License for the specific language governing permissions and
  14. * limitations under the License.
  15. }
  16. {
  17. Declarations from other files centered here
  18. }
  19. const
  20. (* Hook orderings *)
  21. (** run this hook first, before ANYTHING *)
  22. APR_HOOK_REALLY_FIRST = -10;
  23. (** run this hook first *)
  24. APR_HOOK_FIRST = 0;
  25. (** run this hook somewhere *)
  26. APR_HOOK_MIDDLE = 10;
  27. (** run this hook after every other hook which is defined*)
  28. APR_HOOK_LAST = 20;
  29. (** run this hook last, after EVERYTHING *)
  30. APR_HOOK_REALLY_LAST = 30;
  31. {
  32. * @file http_config.h
  33. * @brief Apache Configuration
  34. *
  35. * @defgroup APACHE_CORE_CONFIG Configuration
  36. * @ingroup APACHE_CORE
  37. }
  38. //#include "apr_hooks.h"
  39. {.$include util_cfgtree.inc}
  40. {
  41. * @defgroup ConfigDirectives Allowed locations for configuration directives.
  42. *
  43. * The allowed locations for a configuration directive are the union of
  44. * those indicated by each set bit in the req_override mask.
  45. }
  46. const
  47. OR_NONE = 0; {< *.conf is not available anywhere in this override }
  48. OR_LIMIT = 1; {< *.conf inside <Directory> or <Location>
  49. and .htaccess when AllowOverride Limit }
  50. OR_OPTIONS = 2; {< *.conf anywhere
  51. and .htaccess when AllowOverride Options }
  52. OR_FILEINFO = 4; {< *.conf anywhere
  53. and .htaccess when AllowOverride FileInfo }
  54. OR_AUTHCFG = 8; {< *.conf inside <Directory> or <Location>
  55. and .htaccess when AllowOverride AuthConfig }
  56. OR_INDEXES = 16; {< *.conf anywhere
  57. and .htaccess when AllowOverride Indexes }
  58. OR_UNSET = 32; {< unset a directive (in Allow) }
  59. ACCESS_CONF = 64; {< *.conf inside <Directory> or <Location> }
  60. RSRC_CONF = 128; {< *.conf outside <Directory> or <Location> }
  61. EXEC_ON_READ = 256; {< force directive to execute a command
  62. which would modify the configuration (like including another
  63. file, or IFModule }
  64. { this directive can be placed anywhere }
  65. OR_ALL = (OR_LIMIT or OR_OPTIONS or OR_FILEINFO or OR_AUTHCFG or OR_INDEXES);
  66. {
  67. * This can be returned by a function if they don't wish to handle
  68. * a command. Make it something not likely someone will actually use
  69. * as an error code.
  70. }
  71. const
  72. DECLINE_CMD = '\a\b';
  73. {
  74. * The central data structures around here...
  75. }
  76. { Command dispatch structures... }
  77. {
  78. * How the directives arguments should be parsed.
  79. * @remark Note that for all of these except RAW_ARGS, the config routine is
  80. * passed a freshly allocated string which can be modified or stored
  81. * or whatever...
  82. }
  83. type
  84. cmd_how = (
  85. RAW_ARGS, {< cmd_func parses command line itself }
  86. TAKE1, {< one argument only }
  87. TAKE2, {< two arguments only }
  88. ITERATE, {< one argument, occuring multiple times
  89. * (e.g., IndexIgnore)
  90. }
  91. ITERATE2, {< two arguments, 2nd occurs multiple times
  92. * (e.g., AddIcon)
  93. }
  94. FLAG, {< One of 'On' or 'Off' }
  95. NO_ARGS, {< No args at all, e.g. </Directory> }
  96. TAKE12, {< one or two arguments }
  97. TAKE3, {< three arguments only }
  98. TAKE23, {< two or three arguments }
  99. TAKE123, {< one, two or three arguments }
  100. TAKE13, {< one or three arguments }
  101. TAKE_ARGV {< an argc and argv are passed }
  102. );
  103. {
  104. * This structure is passed to a command which is being invoked,
  105. * to carry a large variety of miscellaneous data which is all of
  106. * use to *somebody*...
  107. }
  108. Pcmd_parms = ^cmd_parms_struct;
  109. //#if defined(AP_HAVE_DESIGNATED_INITIALIZER) || defined(DOXYGEN)
  110. {
  111. * All the types of functions that can be used in directives
  112. * @internal
  113. }
  114. { function to call for a no-args }
  115. no_args_t = function (parms: Pcmd_parms; mconfig: Pointer): PChar; cdecl;
  116. { function to call for a raw-args }
  117. raw_args_t = function (parms: Pcmd_parms; mconfig: Pointer; const args: PChar): PChar; cdecl;
  118. { function to call for a argv/argc }
  119. take_argv_t = function (parms: Pcmd_parms; mconfig: Pointer; argc: cint; argv: array of PChar): PChar; cdecl;
  120. { function to call for a take1 }
  121. take1_t = function (parms: Pcmd_parms; mconfig: Pointer; const w: PChar): PChar; cdecl;
  122. { function to call for a take2 }
  123. take2_t = function (parms: Pcmd_parms; mconfig: Pointer; const w, w2: PChar): PChar; cdecl;
  124. { function to call for a take3 }
  125. take3_t = function (parms: Pcmd_parms; mconfig: Pointer; const w, w2, w3: PChar): PChar; cdecl;
  126. { function to call for a flag }
  127. flag_t = function (parms: Pcmd_parms; mconfig: Pointer; on_: Integer): PChar; cdecl;
  128. cmd_func_kind = ( cfk_no_args, cfk_raw_args, cfk_take_argv, cfk_take1, cfk_take2, cfk_take3, cfk_flag);
  129. cmd_func = record
  130. case cmd_func_kind of
  131. cfk_no_args : ( func_no_args : no_args_t );
  132. cfk_raw_args : ( func_raw_args : raw_args_t );
  133. cfk_take_argv : ( func_take_argv : take_argv_t);
  134. cfk_take1 : ( func_take1 : take1_t);
  135. cfk_take2 : ( func_take2 : take2_t);
  136. cfk_take3 : ( func_take3 : take3_t);
  137. cfk_flag : ( func_flag : flag_t);
  138. end;
  139. Pcmd_func = ^cmd_func;
  140. //const
  141. { This configuration directive does not take any arguments }
  142. // AP_NO_ARGS = func.no_args;
  143. { This configuration directive will handle it's own parsing of arguments}
  144. // AP_RAW_ARGS = func.raw_args;
  145. { This configuration directive will handle it's own parsing of arguments}
  146. //# define AP_TAKE_ARGV func.take_argv
  147. { This configuration directive takes 1 argument}
  148. // AP_TAKE1 = func.take1;
  149. { This configuration directive takes 2 arguments }
  150. // AP_TAKE2 = func.take2;
  151. { This configuration directive takes 3 arguments }
  152. // AP_TAKE3 = func.take3;
  153. { This configuration directive takes a flag (on/off) as a argument}
  154. // AP_FLAG = func.flag;
  155. { method of declaring a directive with no arguments }
  156. //# define AP_INIT_NO_ARGS(directive, func, mconfig, where, help) \
  157. // directive, { .no_args=func }, mconfig, where, RAW_ARGS, help }
  158. { method of declaring a directive with raw argument parsing }
  159. //# define AP_INIT_RAW_ARGS(directive, func, mconfig, where, help) \
  160. // directive, { .raw_args=func }, mconfig, where, RAW_ARGS, help }
  161. { method of declaring a directive with raw argument parsing }
  162. //# define AP_INIT_TAKE_ARGV(directive, func, mconfig, where, help) \
  163. // { directive, { .take_argv=func }, mconfig, where, TAKE_ARGV, help }
  164. { method of declaring a directive which takes 1 argument }
  165. //# define AP_INIT_TAKE1(directive, func, mconfig, where, help) \
  166. // directive, { .take1=func }, mconfig, where, TAKE1, help }
  167. { method of declaring a directive which takes multiple arguments }
  168. //# define AP_INIT_ITERATE(directive, func, mconfig, where, help) \
  169. // directive, { .take1=func }, mconfig, where, ITERATE, help }
  170. { method of declaring a directive which takes 2 arguments }
  171. //# define AP_INIT_TAKE2(directive, func, mconfig, where, help) \
  172. // directive, { .take2=func }, mconfig, where, TAKE2, help }
  173. { method of declaring a directive which takes 1 or 2 arguments }
  174. //# define AP_INIT_TAKE12(directive, func, mconfig, where, help) \
  175. // directive, { .take2=func }, mconfig, where, TAKE12, help }
  176. { method of declaring a directive which takes multiple 2 arguments }
  177. //# define AP_INIT_ITERATE2(directive, func, mconfig, where, help) \
  178. // directive, { .take2=func }, mconfig, where, ITERATE2, help }
  179. { method of declaring a directive which takes 1 or 3 arguments }
  180. //# define AP_INIT_TAKE13(directive, func, mconfig, where, help) \
  181. // directive, { .take3=func }, mconfig, where, TAKE13, help }
  182. { method of declaring a directive which takes 2 or 3 arguments }
  183. //# define AP_INIT_TAKE23(directive, func, mconfig, where, help) \
  184. // directive, { .take3=func }, mconfig, where, TAKE23, help }
  185. { method of declaring a directive which takes 1 to 3 arguments }
  186. //# define AP_INIT_TAKE123(directive, func, mconfig, where, help) \
  187. // directive, { .take3=func }, mconfig, where, TAKE123, help }
  188. { method of declaring a directive which takes 3 arguments }
  189. //# define AP_INIT_TAKE3(directive, func, mconfig, where, help) \
  190. // directive, { .take3=func }, mconfig, where, TAKE3, help }
  191. { method of declaring a directive which takes a flag (on/off) as a argument}
  192. //# define AP_INIT_FLAG(directive, func, mconfig, where, help) \
  193. // directive, { .flag=func }, mconfig, where, FLAG, help }
  194. //#else { AP_HAVE_DESIGNATED_INITIALIZER }
  195. //typedef const char *( *cmd_func) ();
  196. //# define AP_NO_ARGS func
  197. //# define AP_RAW_ARGS func
  198. //# define AP_TAKE_ARGV func
  199. //# define AP_TAKE1 func
  200. //# define AP_TAKE2 func
  201. //# define AP_TAKE3 func
  202. //# define AP_FLAG func
  203. //# define AP_INIT_NO_ARGS(directive, func, mconfig, where, help) \
  204. { directive, func, mconfig, where, RAW_ARGS, help }
  205. //# define AP_INIT_RAW_ARGS(directive, func, mconfig, where, help) \
  206. { directive, func, mconfig, where, RAW_ARGS, help }
  207. //# define AP_INIT_TAKE_ARGV(directive, func, mconfig, where, help) \
  208. { directive, func, mconfig, where, TAKE_ARGV, help }
  209. //# define AP_INIT_TAKE1(directive, func, mconfig, where, help) \
  210. { directive, func, mconfig, where, TAKE1, help }
  211. //# define AP_INIT_ITERATE(directive, func, mconfig, where, help) \
  212. { directive, func, mconfig, where, ITERATE, help }
  213. //# define AP_INIT_TAKE2(directive, func, mconfig, where, help) \
  214. { directive, func, mconfig, where, TAKE2, help }
  215. //# define AP_INIT_TAKE12(directive, func, mconfig, where, help) \
  216. { directive, func, mconfig, where, TAKE12, help }
  217. //# define AP_INIT_ITERATE2(directive, func, mconfig, where, help) \
  218. { directive, func, mconfig, where, ITERATE2, help }
  219. //# define AP_INIT_TAKE13(directive, func, mconfig, where, help) \
  220. { directive, func, mconfig, where, TAKE13, help }
  221. //# define AP_INIT_TAKE23(directive, func, mconfig, where, help) \
  222. { directive, func, mconfig, where, TAKE23, help }
  223. //# define AP_INIT_TAKE123(directive, func, mconfig, where, help) \
  224. { directive, func, mconfig, where, TAKE123, help }
  225. //# define AP_INIT_TAKE3(directive, func, mconfig, where, help) \
  226. { directive, func, mconfig, where, TAKE3, help }
  227. //# define AP_INIT_FLAG(directive, func, mconfig, where, help) \
  228. { directive, func, mconfig, where, FLAG, help }
  229. //#endif { AP_HAVE_DESIGNATED_INITIALIZER }
  230. {
  231. * The command record structure. Each modules can define a table of these
  232. * to define the directives it will implement.
  233. }
  234. command_struct = record
  235. { Name of this command }
  236. name: PChar;
  237. { The function to be called when this directive is parsed }
  238. func: cmd_func;
  239. { Extra data, for functions which implement multiple commands... }
  240. cmd_data: Pointer;
  241. { What overrides need to be allowed to enable this command. }
  242. req_override: Integer;
  243. { What the command expects as arguments
  244. * @defvar cmd_how args_how}
  245. args_how: cmd_how;
  246. { 'usage' message, in case of syntax errors }
  247. errmsg: PChar;
  248. end;
  249. command_rec = command_struct;
  250. Pcommand_rec = ^command_rec;
  251. { Constants here were moved up }
  252. { Common structure for reading of config files / passwd files etc. }
  253. getch_t = function (param: Pointer): Integer;
  254. getstr_t = function (buf: Pointer; bufsiz: size_t; param: Pointer): Pointer;
  255. close_t = function (param: Pointer): Integer;
  256. ap_configfile_t = record
  257. getch: getch_t; {< a getc()-like function }
  258. getstr: getstr_t; {< a fgets()-like function }
  259. close: close_t; {< a close handler function }
  260. param: Pointer; {< the argument passed to getch/getstr/close }
  261. name: PChar; {< the filename / description }
  262. line_number: cuint;{< current line number, starting at 1 }
  263. end;
  264. Pap_configfile_t = ^ap_configfile_t;
  265. PPap_configfile_t = ^Pap_configfile_t;
  266. {
  267. * This structure is passed to a command which is being invoked,
  268. * to carry a large variety of miscellaneous data which is all of
  269. * use to *somebody*...
  270. }
  271. cmd_parms_struct = record
  272. { Argument to command from cmd_table }
  273. info: Pointer;
  274. { Which allow-override bits are set }
  275. override_: Integer;
  276. { Which methods are <Limit>ed }
  277. limited: apr_int64_t;
  278. { methods which are limited }
  279. limited_xmethods: Papr_array_header_t;
  280. { methods which are xlimited }
  281. xlimited: Pap_method_list_t;
  282. { Config file structure. }
  283. config_file: Pap_configfile_t;
  284. { the directive specifying this command }
  285. directive: Pap_directive_t;
  286. { Pool to allocate new storage in }
  287. pool: Papr_pool_t;
  288. { Pool for scratch memory; persists during configuration, but
  289. * wiped before the first request is served... }
  290. temp_pool: Papr_pool_t;
  291. { Server_rec being configured for }
  292. server: Pserver_rec;
  293. { If configuring for a directory, pathname of that directory.
  294. * NOPE! That's what it meant previous to the existance of <Files>,
  295. * <Location> and regex matching. Now the only usefulness that can be
  296. * derived from this field is whether a command is being called in a
  297. * server context (path == NULL) or being called in a dir context
  298. * (path != NULL). }
  299. path: PChar;
  300. { configuration command }
  301. cmd: Pcommand_rec;
  302. { per_dir_config vector passed to handle_command }
  303. context: Pap_conf_vector_t;
  304. { directive with syntax error }
  305. err_directive: Pap_directive_t;
  306. { Which allow-override-opts bits are set }
  307. override_opts: cint;
  308. end;
  309. cmd_parms = cmd_parms_struct;
  310. {
  311. * Module structures. Just about everything is dispatched through
  312. * these, directly or indirectly (through the command and handler
  313. * tables).
  314. }
  315. type
  316. Pmodule_struct = ^module_struct;
  317. module_struct = record
  318. { API version, *not* module version; check that module is
  319. * compatible with this version of the server.
  320. }
  321. version: Integer;
  322. { API minor version. Provides API feature milestones. Not checked
  323. * during module init }
  324. minor_version: Integer;
  325. { Index to this modules structures in config vectors. }
  326. module_index: Integer;
  327. { The name of the module's C file }
  328. name: PChar;
  329. { The handle for the DSO. Internal use only }
  330. dynamic_load_handle: Pointer;
  331. { A pointer to the next module in the list
  332. * @defvar module_struct *next }
  333. next: Pmodule_struct;
  334. { Magic Cookie to identify a module structure; It's mainly
  335. * important for the DSO facility (see also mod_so). }
  336. magic: Cardinal;
  337. { Function to allow MPMs to re-write command line arguments. This
  338. * hook is only available to MPMs.
  339. * @param The process that the server is running in.
  340. }
  341. rewrite_args: procedure(process: Pprocess_rec); cdecl;
  342. { Function to allow all modules to create per directory configuration
  343. * structures.
  344. * @param p The pool to use for all allocations.
  345. * @param dir The directory currently being processed.
  346. * @return The per-directory structure created
  347. }
  348. create_dir_config: function(p: Papr_pool_t; dir: PChar): Pointer; cdecl;
  349. { Function to allow all modules to merge the per directory configuration
  350. * structures for two directories.
  351. * @param p The pool to use for all allocations.
  352. * @param base_conf The directory structure created for the parent directory.
  353. * @param new_conf The directory structure currently being processed.
  354. * @return The new per-directory structure created
  355. }
  356. merge_dir_config: function(p: Papr_pool_t; base_conf: Pointer;
  357. new_conf: Pointer): Pointer; cdecl;
  358. { Function to allow all modules to create per server configuration
  359. * structures.
  360. * @param p The pool to use for all allocations.
  361. * @param s The server currently being processed.
  362. * @return The per-server structure created
  363. }
  364. create_server_config: function(p: Papr_pool_t; s: Pserver_rec): Pointer; cdecl;
  365. { Function to allow all modules to merge the per server configuration
  366. * structures for two servers.
  367. * @param p The pool to use for all allocations.
  368. * @param base_conf The directory structure created for the parent directory.
  369. * @param new_conf The directory structure currently being processed.
  370. * @return The new per-directory structure created
  371. }
  372. merge_server_config: function(p: Papr_pool_t; base_conf: Pointer;
  373. new_conf: Pointer): Pointer; cdecl;
  374. { A command_rec table that describes all of the directives this module
  375. * defines. }
  376. cmds: Pcommand_rec;
  377. { A hook to allow modules to hook other points in the request processing.
  378. * In this function, modules should call the ap_hook_*() functions to
  379. * register an interest in a specific step in processing the current
  380. * request.
  381. * @param p the pool to use for all allocations
  382. }
  383. register_hooks: procedure(p: Papr_pool_t); cdecl;
  384. end;
  385. module = module_struct;
  386. Pmodule = ^module;
  387. PPmodule = ^Pmodule;
  388. {
  389. * @defgroup ModuleInit Module structure initializers
  390. *
  391. * Initializer for the first few module slots, which are only
  392. * really set up once we start running. Note that the first two slots
  393. * provide a version check; this should allow us to deal with changes to
  394. * the API. The major number should reflect changes to the API handler table
  395. * itself or removal of functionality. The minor number should reflect
  396. * additions of functionality to the existing API. (the server can detect
  397. * an old-format module, and either handle it back-compatibly, or at least
  398. * signal an error). See src/include/ap_mmn.h for MMN version history.
  399. }
  400. { The one used in Apache 1.3, which will deliberately cause an error }
  401. //#define STANDARD_MODULE_STUFF this_module_needs_to_be_ported_to_apache_2_0
  402. { Use this in all standard modules }
  403. procedure STANDARD20_MODULE_STUFF(var mod_: module);
  404. { Use this only in MPMs }
  405. procedure MPM20_MODULE_STUFF(var mod_: module);
  406. { CONFIGURATION VECTOR FUNCTIONS }
  407. { configuration vector structure - Moved to httpd.pas}
  408. {
  409. ap_get_module_config, ap_set_module_config are both commented out because even thought
  410. they are on the headers, they are not present on the libhttpd.dll library.
  411. }
  412. {
  413. * Generic accessors for other modules to get at their own module-specific
  414. * data
  415. * @param conf_vector The vector in which the modules configuration is stored.
  416. * usually r->per_dir_config or s->module_config
  417. * @param m The module to get the data for.
  418. * @return The module-specific data
  419. }
  420. {
  421. Function not found on the dll
  422. }
  423. //function ap_get_module_config(const cv: Pap_conf_vector_t; const m: Pmodule): Pointer;
  424. // {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
  425. // external LibHTTPD name LibNamePrefix + 'ap_get_module_config' + LibSuff8;
  426. {
  427. * Generic accessors for other modules to set at their own module-specific
  428. * data
  429. * @param conf_vector The vector in which the modules configuration is stored.
  430. * usually r->per_dir_config or s->module_config
  431. * @param m The module to set the data for.
  432. * @param val The module-specific data to set
  433. }
  434. //procedure ap_set_module_config(const cv: Pap_conf_vector_t; const m: Pmodule;
  435. // val: Pointer);
  436. // {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
  437. // external LibHTTPD name LibNamePrefix + 'ap_set_module_config' + LibSuff12;
  438. {$ifndef AP_DEBUG}
  439. function ap_get_module_config(v: Pap_conf_vector_t; m: Pmodule): Pap_conf_vector_t;
  440. procedure ap_set_module_config(v: Pap_conf_vector_t; m: Pmodule; val: Pap_conf_vector_t);
  441. {$endif} { AP_DEBUG }
  442. {
  443. * Generic command handling function for strings
  444. * @param cmd The command parameters for this directive
  445. * @param struct_ptr pointer into a given type
  446. * @param arg The argument to the directive
  447. * @return An error string or NULL on success
  448. }
  449. function ap_set_string_slot(cmd: Pcmd_parms; struct_ptr: Pointer; const arg: PChar): PChar;
  450. cdecl; external LibHTTPD name 'ap_set_string_slot';
  451. {
  452. * Generic command handling function for integers
  453. * @param cmd The command parameters for this directive
  454. * @param struct_ptr pointer into a given type
  455. * @param arg The argument to the directive
  456. * @return An error string or NULL on success
  457. }
  458. function ap_set_int_slot(cmd: Pcmd_parms; struct_ptr: Pointer; const arg: PChar): PChar;
  459. cdecl; external LibHTTPD name 'ap_set_int_slot';
  460. {
  461. * Return true if the specified method is limited by being listed in
  462. * a <Limit> container, or by *not* being listed in a <LimiteExcept>
  463. * container.
  464. *
  465. * @param method Pointer to a string specifying the method to check.
  466. * @param cmd Pointer to the cmd_parms structure passed to the
  467. * directive handler.
  468. * @return 0 if the method is not limited in the current scope
  469. }
  470. function ap_method_is_limited(cmd: Pcmd_parms; const method: PChar): Integer;
  471. {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
  472. external LibHTTPD name LibNamePrefix + 'ap_method_is_limited' + LibSuff8;
  473. {
  474. * Generic command handling function for strings, always sets the value
  475. * to a lowercase string
  476. * @param cmd The command parameters for this directive
  477. * @param struct_ptr pointer into a given type
  478. * @param arg The argument to the directive
  479. * @return An error string or NULL on success
  480. }
  481. function ap_set_string_slot_lower(cmd: Pcmd_parms; struct_ptr: Pointer; const arg: PChar): PChar;
  482. cdecl; external LibHTTPD name 'ap_set_string_slot_lower';
  483. {
  484. * Generic command handling function for flags
  485. * @param cmd The command parameters for this directive
  486. * @param struct_ptr pointer into a given type
  487. * @param arg The argument to the directive (either 1 or 0)
  488. * @return An error string or NULL on success
  489. }
  490. function ap_set_flag_slot(cmd: Pcmd_parms; struct_ptr: Pointer; const arg: PChar): PChar;
  491. cdecl; external LibHTTPD name 'ap_set_flag_slot';
  492. {
  493. * Generic command handling function for files
  494. * @param cmd The command parameters for this directive
  495. * @param struct_ptr pointer into a given type
  496. * @param arg The argument to the directive
  497. * @return An error string or NULL on success
  498. }
  499. function ap_set_file_slot(cmd: Pcmd_parms; struct_ptr: Pointer; const arg: PChar): PChar;
  500. cdecl; external LibHTTPD name 'ap_set_file_slot';
  501. {
  502. * Generic command handling function to respond with cmd->help as an error
  503. * @param cmd The command parameters for this directive
  504. * @param struct_ptr pointer into a given type
  505. * @param arg The argument to the directive
  506. * @return The cmd->help value as the error string
  507. * @tip This allows simple declarations such as;
  508. * <pre>
  509. * AP_INIT_RAW_ARGS("Foo", ap_set_deprecated, NULL, OR_ALL,
  510. * "The Foo directive is no longer supported, use Bar"),
  511. * </pre>
  512. }
  513. function ap_set_deprecated(cmd: Pcmd_parms; struct_ptr: Pointer; const arg: PChar): PChar;
  514. cdecl; external LibHTTPD name 'ap_set_deprecated';
  515. {
  516. * For modules which need to read config files, open logs, etc. this returns
  517. * the canonical form of fname made absolute to ap_server_root.
  518. * @param p pool to allocate data from
  519. * @param fname The file name
  520. }
  521. function ap_server_root_relative(p: Papr_pool_t; const fname: PChar): PChar;
  522. {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
  523. external LibHTTPD name LibNamePrefix + 'ap_server_root_relative' + LibSuff8;
  524. { Finally, the hook for dynamically loading modules in... }
  525. {
  526. * Add a module to the server
  527. * @param m The module structure of the module to add
  528. * @param p The pool of the same lifetime as the module
  529. }
  530. function ap_add_module(m: Pmodule; p: Papr_pool_t): PChar;
  531. {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
  532. external LibHTTPD name LibNamePrefix + 'ap_add_module' + LibSuff8;
  533. {
  534. * Remove a module from the server. There are some caveats:
  535. * when the module is removed, its slot is lost so all the current
  536. * per-dir and per-server configurations are invalid. So we should
  537. * only ever call this function when you are invalidating almost
  538. * all our current data. I.e. when doing a restart.
  539. * @param m the module structure of the module to remove
  540. }
  541. procedure ap_remove_module(m: Pmodule);
  542. {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
  543. external LibHTTPD name LibNamePrefix + 'ap_remove_module' + LibSuff4;
  544. {
  545. * Add a module to the chained modules list and the list of loaded modules
  546. * @param m The module structure of the module to add
  547. * @param p The pool with the same lifetime as the module
  548. }
  549. procedure ap_add_loaded_module(mod_: Pmodule; p: Papr_pool_t);
  550. {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
  551. external LibHTTPD name LibNamePrefix + 'ap_add_loaded_module' + LibSuff8;
  552. {
  553. * Remove a module fromthe chained modules list and the list of loaded modules
  554. * @param m the module structure of the module to remove
  555. }
  556. procedure ap_remove_loaded_module(m: Pmodule);
  557. {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
  558. external LibHTTPD name LibNamePrefix + 'ap_remove_loaded_module' + LibSuff4;
  559. {
  560. * Find the name of the specified module
  561. * @param m The module to get the name for
  562. * @return the name of the module
  563. }
  564. function ap_find_module_name(m: Pmodule): PChar;
  565. {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
  566. external LibHTTPD name LibNamePrefix + 'ap_find_module_name' + LibSuff4;
  567. {
  568. * Find a module based on the name of the module
  569. * @param name the name of the module
  570. * @return the module structure if found, NULL otherwise
  571. }
  572. function ap_find_linked_module(const name: PChar): Pmodule;
  573. {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
  574. external LibHTTPD name LibNamePrefix + 'ap_find_linked_module' + LibSuff4;
  575. {
  576. * Open a ap_configfile_t as apr_file_t
  577. * @param ret_cfg open ap_configfile_t struct pointer
  578. * @param p The pool to allocate the structure from
  579. * @param name the name of the file to open
  580. }
  581. function ap_pcfg_openfile(ret_cfg: PPap_configfile_t;
  582. p: Papr_pool_t; const name: PChar): apr_status_t;
  583. {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
  584. external LibHTTPD name LibNamePrefix + 'ap_pcfg_openfile' + LibSuff12;
  585. {
  586. * Allocate a ap_configfile_t handle with user defined functions and params
  587. * @param p The pool to allocate from
  588. * @param descr The name of the file
  589. * @param param The argument passed to getch/getstr/close
  590. * @param getc_func The getch function
  591. * @param gets_func The getstr function
  592. * @param close_func The close function
  593. }
  594. type
  595. getc_func_t = function (param: Pointer): Integer;
  596. gets_func_t = function (buf: Pointer; bufsiz: size_t; param: Pointer): Pointer;
  597. close_func_t = function (param: Pointer): Integer;
  598. function ap_pcfg_open_custom(p: Papr_pool_t;
  599. const descr: PChar; param: Pointer;
  600. getc_func: getc_func_t; gets_func: gets_func_t;
  601. close_func: close_func_t): Pap_configfile_t;
  602. {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
  603. external LibHTTPD name LibNamePrefix + 'ap_pcfg_open_custom' + LibSuff24;
  604. {
  605. * Read one line from open ap_configfile_t, strip LF, increase line number
  606. * @param buf place to store the line read
  607. * @param bufsize size of the buffer
  608. * @param cfp File to read from
  609. * @return 1 on success, 0 on failure
  610. }
  611. function ap_cfg_getline(bug: PChar;
  612. bufsize: size_t; cfp: Pap_configfile_t): Integer;
  613. {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
  614. external LibHTTPD name LibNamePrefix + 'ap_cfg_getline' + LibSuff12;
  615. {
  616. * Read one char from open configfile_t, increase line number upon LF
  617. * @param cfp The file to read from
  618. * @return the character read
  619. }
  620. function ap_cfg_getc(cfp: Pap_configfile_t): Integer;
  621. {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
  622. external LibHTTPD name LibNamePrefix + 'ap_cfg_getc' + LibSuff4;
  623. {
  624. * Detach from open ap_configfile_t, calling the close handler
  625. * @param cfp The file to close
  626. * @return 1 on sucess, 0 on failure
  627. }
  628. function ap_cfg_closefile(cfp: Pap_configfile_t): Integer;
  629. {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
  630. external LibHTTPD name LibNamePrefix + 'ap_cfg_closefile' + LibSuff4;
  631. {
  632. * Read all data between the current <foo> and the matching </foo>. All
  633. * of this data is forgotten immediately.
  634. * @param cmd The cmd_parms to pass to the directives inside the container
  635. * @param directive The directive name to read until
  636. * @return Error string on failure, NULL on success
  637. }
  638. function ap_soak_end_container(cmd: Pcmd_parms; directive: PChar): PChar;
  639. {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
  640. external LibHTTPD name LibNamePrefix + 'ap_soak_end_container' + LibSuff8;
  641. {
  642. * Read all data between the current <foo> and the matching </foo> and build
  643. * a config tree from it
  644. * @param p pool to allocate from
  645. * @param temp_pool Temporary pool to allocate from
  646. * @param parms The cmd_parms to pass to all directives read
  647. * @param current The current node in the tree
  648. * @param curr_parent The current parent node
  649. * @param orig_directive The directive to read until hit.
  650. * @return Error string on failure, NULL on success
  651. }
  652. function ap_build_cont_config(p, temp_pool: Papr_pool_t;
  653. parms: Pcmd_parms; current, curr_parent: PPap_directive_t;
  654. orig_directive: PChar): PChar;
  655. {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
  656. external LibHTTPD name LibNamePrefix + 'ap_build_cont_config' + LibSuff24;
  657. {
  658. * Build a config tree from a config file
  659. * @param parms The cmd_parms to pass to all of the directives in the file
  660. * @param conf_pool The pconf pool
  661. * @param temp_pool The temporary pool
  662. * @param conftree Place to store the root node of the config tree
  663. * @return Error string on erro, NULL otherwise
  664. }
  665. function ap_build_config(parms: Pcmd_parms;
  666. conf_pool, temp_pool: Papr_pool_t; conftree: PPap_directive_t): PChar;
  667. {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
  668. external LibHTTPD name LibNamePrefix + 'ap_build_config' + LibSuff16;
  669. {
  670. * Walk a config tree and setup the server's internal structures
  671. * @param conftree The config tree to walk
  672. * @param parms The cmd_parms to pass to all functions
  673. * @param section_vector The per-section config vector.
  674. * @return Error string on error, NULL otherwise
  675. }
  676. function ap_walk_config(conftree: Pap_directive_t;
  677. parms: Pcmd_parms; section_vector: Pap_conf_vector_t): PChar;
  678. {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
  679. external LibHTTPD name LibNamePrefix + 'ap_walk_config' + LibSuff12;
  680. {
  681. * @defgroup ap_check_cmd_context Check command context
  682. }
  683. {
  684. * Check the context a command is used in.
  685. * @param cmd The command to check
  686. * @param forbidden Where the command is forbidden.
  687. * @return Error string on error, NULL on success
  688. }
  689. function ap_check_cmd_context(cmd: Pcmd_parms;
  690. forbidden: cuint): PChar;
  691. {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
  692. external LibHTTPD name LibNamePrefix + 'ap_check_cmd_context' + LibSuff8;
  693. const
  694. NOT_IN_VIRTUALHOST = $01; {< Forbidden in <Virtualhost> }
  695. NOT_IN_LIMIT = $02; {< Forbidden in <Limit> }
  696. NOT_IN_DIRECTORY = $04; {< Forbidden in <Directory> }
  697. NOT_IN_LOCATION = $08; {< Forbidden in <Location> }
  698. NOT_IN_FILES = $10; {< Forbidden in <Files> }
  699. { Forbidden in <Directory>/<Location>/<Files>}
  700. NOT_IN_DIR_LOC_FILE = (NOT_IN_DIRECTORY or NOT_IN_LOCATION or NOT_IN_FILES);
  701. { Forbidden in <VirtualHost>/<Limit>/<Directory>/<Location>/<Files> }
  702. GLOBAL_ONLY = (NOT_IN_VIRTUALHOST or NOT_IN_LIMIT or NOT_IN_DIR_LOC_FILE);
  703. //#ifdef CORE_PRIVATE
  704. {
  705. * @brief This structure is used to assign symbol names to module pointers
  706. }
  707. type
  708. ap_module_symbol_t = record
  709. name: PChar;
  710. modp: Pmodule;
  711. end;
  712. {
  713. * The topmost module in the list
  714. * @defvar module *ap_top_module
  715. }
  716. //AP_DECLARE_DATA extern module *ap_top_module;
  717. {
  718. * Array of all statically linked modules
  719. * @defvar module *ap_prelinked_modules[]
  720. }
  721. //AP_DECLARE_DATA extern module *ap_prelinked_modules[];
  722. {
  723. * Array of all statically linked modulenames (symbols)
  724. * @defvar ap_module_symbol_t ap_prelinked_modulenames[]
  725. }
  726. //AP_DECLARE_DATA extern ap_module_symbol_t ap_prelinked_module_symbols[];
  727. {
  728. * Array of all preloaded modules
  729. * @defvar module *ap_preloaded_modules[]
  730. }
  731. //AP_DECLARE_DATA extern module *ap_preloaded_modules[];
  732. {
  733. * Array of all loaded modules
  734. * @defvar module **ap_loaded_modules
  735. }
  736. //AP_DECLARE_DATA extern module **ap_loaded_modules;
  737. { For mod_so.c... }
  738. { Run a single module's two create_config hooks
  739. * @param p the pool to allocate from
  740. * @param s The server to configure for.
  741. * @param m The module to configure
  742. }
  743. procedure ap_single_module_configure(p: Papr_pool_t;
  744. s: Pserver_rec; m: Pmodule);
  745. {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
  746. external LibHTTPD name LibNamePrefix + 'ap_single_module_configure' + LibSuff12;
  747. { For http_main.c... }
  748. {
  749. * Add all of the prelinked modules into the loaded module list
  750. * @param process The process that is currently running the server
  751. }
  752. function ap_setup_prelinked_modules(process: Pprocess_rec): PChar;
  753. {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
  754. external LibHTTPD name LibNamePrefix + 'ap_setup_prelinked_modules' + LibSuff4;
  755. {
  756. * Show the preloaded configuration directives, the help string explaining
  757. * the directive arguments, in what module they are handled, and in
  758. * what parts of the configuration they are allowed. Used for httpd -h.
  759. }
  760. procedure ap_show_directives;
  761. {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
  762. external LibHTTPD name LibNamePrefix + 'ap_show_directives' + LibSuff0;
  763. {
  764. * Show the preloaded module names. Used for httpd -l.
  765. }
  766. procedure ap_show_modules;
  767. {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
  768. external LibHTTPD name LibNamePrefix + 'ap_show_modules' + LibSuff0;
  769. {
  770. * Show the MPM name. Used in reporting modules such as mod_info to
  771. * provide extra information to the user
  772. }
  773. function ap_show_mpm: PChar;
  774. {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
  775. external LibHTTPD name LibNamePrefix + 'ap_show_mpm' + LibSuff0;
  776. {
  777. * Read all config files and setup the server
  778. * @param process The process running the server
  779. * @param temp_pool A pool to allocate temporary data from.
  780. * @param config_name The name of the config file
  781. * @param conftree Place to store the root of the config tree
  782. * @return The setup server_rec list.
  783. }
  784. function ap_read_config(process: Pprocess_rec;
  785. temp_pool: Papr_pool_t; const config_name: PChar;
  786. conftree: PPap_directive_t): Pserver_rec;
  787. {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
  788. external LibHTTPD name LibNamePrefix + 'ap_read_config' + LibSuff16;
  789. {
  790. * Run all rewrite args hooks for loaded modules
  791. * @param process The process currently running the server
  792. }
  793. procedure ap_run_rewrite_args(process: Pprocess_rec);
  794. {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
  795. external LibHTTPD name LibNamePrefix + 'ap_run_rewrite_args' + LibSuff4;
  796. {
  797. * Run the register hooks function for a specified module
  798. * @param m The module to run the register hooks function fo
  799. * @param p The pool valid for the lifetime of the module
  800. }
  801. procedure ap_register_hooks(m: Pmodule; p: Papr_pool_t);
  802. {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
  803. external LibHTTPD name LibNamePrefix + 'ap_register_hooks' + LibSuff8;
  804. {
  805. * Setup all virtual hosts
  806. * @param p The pool to allocate from
  807. * @param main_server The head of the server_rec list
  808. }
  809. procedure ap_fixup_virtual_hosts(p: Papr_pool_t; main_server: Pserver_rec);
  810. {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
  811. external LibHTTPD name LibNamePrefix + 'ap_fixup_virtual_hosts' + LibSuff8;
  812. { For http_request.c... }
  813. {
  814. * Setup the config vector for a request_rec
  815. * @param p The pool to allocate the config vector from
  816. * @return The config vector
  817. }
  818. function ap_create_request_config(p: Papr_pool_t): Pap_conf_vector_t;
  819. {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
  820. external LibHTTPD name LibNamePrefix + 'ap_create_request_config' + LibSuff4;
  821. {
  822. * Setup the config vector for per dir module configs
  823. * @param p The pool to allocate the config vector from
  824. * @return The config vector
  825. }
  826. function ap_create_per_dir_config(p: Papr_pool_t): Pap_conf_vector_t;
  827. {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
  828. external LibHTTPD name LibNamePrefix + 'ap_create_per_dir_config' + LibSuff4;
  829. {
  830. * Run all of the modules merge per dir config functions
  831. * @param p The pool to pass to the merge functions
  832. * @param base The base directory config structure
  833. * @param new_conf The new directory config structure
  834. }
  835. function ap_merge_per_dir_configs(p: Papr_pool_t;
  836. base, new_conf: Pap_conf_vector_t): Pap_conf_vector_t;
  837. {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
  838. external LibHTTPD name LibNamePrefix + 'ap_merge_per_dir_configs' + LibSuff12;
  839. { For http_connection.c... }
  840. {
  841. * Setup the config vector for a connection_rec
  842. * @param p The pool to allocate the config vector from
  843. * @return The config vector
  844. }
  845. function ap_create_conn_config(p: Papr_pool_t): Pap_conf_vector_t;
  846. {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
  847. external LibHTTPD name LibNamePrefix + 'ap_create_conn_config' + LibSuff4;
  848. { For http_core.c... (<Directory> command and virtual hosts) }
  849. {
  850. * parse an htaccess file
  851. * @param resulting htaccess_result
  852. * @param r The request currently being served
  853. * @param override Which overrides are active
  854. * @param path The path to the htaccess file
  855. * @param access_name The list of possible names for .htaccess files
  856. * int The status of the current request
  857. }
  858. function ap_parse_htaccess(result: PPap_conf_vector_t;
  859. r: Prequest_rec; override_: Integer; override_opts: cint;
  860. const path, access_name: PChar): Integer;
  861. {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
  862. external LibHTTPD name LibNamePrefix + 'ap_parse_htaccess' + LibSuff24;
  863. {
  864. * Setup a virtual host
  865. * @param p The pool to allocate all memory from
  866. * @param hostname The hostname of the virtual hsot
  867. * @param main_server The main server for this Apache configuration
  868. * @param ps Place to store the new server_rec
  869. * return Error string on error, NULL on success
  870. }
  871. function ap_init_virtual_host(p: Papr_pool_t;
  872. const hostname: PChar; main_server: Pserver_rec;
  873. ps: PPserver_rec): PChar;
  874. {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
  875. external LibHTTPD name LibNamePrefix + 'ap_init_virtual_host' + LibSuff16;
  876. {
  877. * Process the config file for Apache
  878. * @param s The server rec to use for the command parms
  879. * @param fname The name of the config file
  880. * @param conftree The root node of the created config tree
  881. * @param p Pool for general allocation
  882. * @param ptem Pool for temporary allocation
  883. }
  884. function ap_process_resource_config(s: Pserver_rec;
  885. const fname: PChar; conftree: PPap_directive_t;
  886. p, ptemp: Papr_pool_t): PChar;
  887. {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
  888. external LibHTTPD name LibNamePrefix + 'ap_process_resource_config' + LibSuff20;
  889. {
  890. * Process all directives in the config tree
  891. * @param s The server rec to use in the command parms
  892. * @param conftree The config tree to process
  893. * @param p The pool for general allocation
  894. * @param ptemp The pool for temporary allocations
  895. }
  896. function ap_process_config_tree(s: Pserver_rec;
  897. conftree: Pap_directive_t; p, ptemp: Papr_pool_t): cint;
  898. {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
  899. external LibHTTPD name LibNamePrefix + 'ap_process_config_tree' + LibSuff16;
  900. { Module-method dispatchers, also for http_request.c }
  901. {
  902. * Run the handler phase of each module until a module accepts the
  903. * responsibility of serving the request
  904. * @param r The current request
  905. * @return The status of the current request
  906. }
  907. function ap_invoke_handler(r: Prequest_rec): Integer;
  908. {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
  909. external LibHTTPD name LibNamePrefix + 'ap_invoke_handler' + LibSuff4;
  910. { for mod_perl }
  911. {
  912. * Find a given directive in a command_rec table
  913. * @param name The directive to search for
  914. * @param cmds The table to search
  915. * @return The directive definition of the specified directive
  916. }
  917. function ap_find_command(const name: PChar;
  918. const cmds: Pcommand_rec): Pcommand_rec;
  919. {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
  920. external LibHTTPD name LibNamePrefix + 'ap_find_command' + LibSuff8;
  921. {
  922. * Find a given directive in a list module
  923. * @param cmd_name The directive to search for
  924. * @param mod The module list to search
  925. * @return The directive definition of the specified directive
  926. }
  927. function ap_find_command_in_modules(const cmd_name: PChar;
  928. mod_: PPmodule): Pcommand_rec;
  929. {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
  930. external LibHTTPD name LibNamePrefix + 'ap_find_command_in_modules' + LibSuff8;
  931. {
  932. * Ask a module to create per-server and per-section (dir/loc/file) configs
  933. * (if it hasn't happened already). The results are stored in the server's
  934. * config, and the specified per-section config vector.
  935. * @param server The server to operate upon.
  936. * @param section_vector The per-section config vector.
  937. * @param section Which section to create a config for.
  938. * @param mod The module which is defining the config data.
  939. * @param pconf A pool for all configuration allocations.
  940. * @return The (new) per-section config data.
  941. }
  942. function ap_set_config_vectors(server: Pserver_rec;
  943. ection_vector: Pap_conf_vector_t; const section: PChar;
  944. mod_: Pmodule; pconf: Papr_pool_t): Pointer;
  945. {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
  946. external LibHTTPD name LibNamePrefix + 'ap_set_config_vectors' + LibSuff20;
  947. {#endif}
  948. { Hooks }
  949. {
  950. * Run the header parser functions for each module
  951. * @param r The current request
  952. * @return OK or DECLINED
  953. }
  954. type
  955. ap_HOOK_header_parser_t = function(r: Prequest_rec): Integer; cdecl;
  956. procedure ap_hook_header_parser(pf: ap_HOOK_header_parser_t;
  957. const aszPre: PPChar; const aszSucc:
  958. PPChar; nOrder: Integer);
  959. {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
  960. external LibHTTPD name LibNamePrefix + 'ap_hook_header_parser' + LibSuff16;
  961. {
  962. * Run the pre_config function for each module
  963. * @param pconf The config pool
  964. * @param plog The logging streams pool
  965. * @param ptemp The temporary pool
  966. * @return OK or DECLINED on success anything else is a error
  967. }
  968. type
  969. ap_HOOK_pre_config_t = function(pconf: Papr_pool_t; plog: Papr_pool_t;
  970. ptemp: Papr_pool_t): Integer; cdecl;
  971. procedure ap_hook_pre_config(pf: ap_HOOK_pre_config_t; const aszPre: PPChar;
  972. const aszSucc: PPChar; nOrder: Integer);
  973. {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
  974. external LibHTTPD name LibNamePrefix + 'ap_hook_pre_config' + LibSuff16;
  975. {
  976. * Run the test_config function for each module; this hook is run
  977. * only if the server was invoked to test the configuration syntax.
  978. * @param pconf The config pool
  979. * @param s The list of server_recs
  980. }
  981. type
  982. ap_HOOK_test_config_t = procedure (pconf: Papr_pool_t; s: Pserver_rec); cdecl;
  983. procedure ap_hook_test_config(pf: ap_HOOK_test_config_t; const aszPre: PPChar;
  984. const aszSucc: PPChar; nOrder: Integer);
  985. {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
  986. external LibHTTPD name LibNamePrefix + 'ap_hook_test_config' + LibSuff16;
  987. {
  988. * Run the post_config function for each module
  989. * @param pconf The config pool
  990. * @param plog The logging streams pool
  991. * @param ptemp The temporary pool
  992. * @param s The list of server_recs
  993. * @return OK or DECLINED on success anything else is a error
  994. }
  995. type
  996. ap_HOOK_post_config_t = function(pconf, plog, ptemp: Papr_pool_t; s: Pserver_rec): Integer; cdecl;
  997. procedure ap_hook_post_config(pf: ap_HOOK_post_config_t; const aszPre: PPChar;
  998. const aszSucc: PPChar; nOrder: Integer);
  999. {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
  1000. external LibHTTPD name LibNamePrefix + 'ap_hook_post_config' + LibSuff16;
  1001. {
  1002. * Run the open_logs functions for each module
  1003. * @param pconf The config pool
  1004. * @param plog The logging streams pool
  1005. * @param ptemp The temporary pool
  1006. * @param s The list of server_recs
  1007. * @return OK or DECLINED on success anything else is a error
  1008. }
  1009. type
  1010. ap_HOOK_open_logs_t = function(pconf: Papr_pool_t; plog: Papr_pool_t;
  1011. ptemp: Papr_pool_t; s: Pserver_rec): Integer; cdecl;
  1012. procedure ap_hook_open_logs(pf: ap_HOOK_open_logs_t; const aszPre: PPChar;
  1013. const aszSucc: PPChar; nOrder: Integer);
  1014. {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
  1015. external LibHTTPD name LibNamePrefix + 'ap_hook_open_logs' + LibSuff16;
  1016. {
  1017. * Run the child_init functions for each module
  1018. * @param pchild The child pool
  1019. * @param s The list of server_recs in this server
  1020. }
  1021. type
  1022. ap_HOOK_child_init_t = procedure(pchild: Papr_pool_t; s: Pserver_rec); cdecl;
  1023. procedure ap_hook_child_init(pf: ap_HOOK_child_init_t; const aszPre: PPChar;
  1024. const aszSucc: PPChar; nOrder: Integer);
  1025. {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
  1026. external LibHTTPD name LibNamePrefix + 'ap_hook_child_init' + LibSuff16;
  1027. {
  1028. * Run the handler functions for each module
  1029. * @param r The request_rec
  1030. * @remark non-wildcard handlers should HOOK_MIDDLE, wildcard HOOK_LAST
  1031. }
  1032. type
  1033. ap_HOOK_handler_t = function(r: Prequest_rec): Integer; cdecl;
  1034. procedure ap_hook_handler(pf: ap_HOOK_handler_t; const aszPre: PPChar;
  1035. const aszSucc: PPChar; nOrder: Integer);
  1036. {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
  1037. external LibHTTPD name LibNamePrefix + 'ap_hook_handler' + LibSuff16;
  1038. {
  1039. * Run the quick handler functions for each module. The quick_handler
  1040. * is run before any other requests hooks are called (location_walk,
  1041. * directory_walk, access checking, et. al.). This hook was added
  1042. * to provide a quick way to serve content from a URI keyed cache.
  1043. *
  1044. * @param r The request_rec
  1045. * @param lookup_uri Controls whether the caller actually wants content or not.
  1046. * lookup is set when the quick_handler is called out of
  1047. * ap_sub_req_lookup_uri()
  1048. }
  1049. type
  1050. ap_HOOK_quick_handler_t = function(r: Prequest_rec;
  1051. lookup_uri: Integer): Integer; cdecl;
  1052. procedure ap_hook_quick_handler(pf: ap_HOOK_quick_handler_t;
  1053. const aszPre: PPChar; const aszSucc: PPChar; nOrder: Integer);
  1054. {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
  1055. external LibHTTPD name LibNamePrefix + 'ap_hook_quick_handler' + LibSuff16;
  1056. {
  1057. * Retrieve the optional functions for each module.
  1058. * This is run immediately before the server starts. Optional functions should
  1059. * be registered during the hook registration phase.
  1060. }
  1061. type
  1062. ap_HOOK_optional_fn_retrieve_t = procedure; cdecl;
  1063. procedure ap_hook_optional_fn_retrieve(pf: ap_HOOK_optional_fn_retrieve_t;
  1064. const aszPre: PPChar; const aszSucc: PPChar; nOrder: Integer);
  1065. {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
  1066. external LibHTTPD name LibNamePrefix + 'ap_hook_optional_fn_retrieve' + LibSuff16;