http_core.inc 23 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702
  1. { Copyright 1999-2005 The Apache Software Foundation or its licensors, as
  2. * applicable.
  3. *
  4. * Licensed under the Apache License, Version 2.0 (the "License");
  5. * you may not use this file except in compliance with the License.
  6. * 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. //#include "apr.h"
  17. {$include apr/apr_hash.inc}
  18. {#include "apr_optional.h"}
  19. {$include util_filter.inc}
  20. {#if APR_HAVE_STRUCT_RLIMIT
  21. #include <sys/time.h>
  22. #include <sys/resource.h>
  23. #endif}
  24. {
  25. * @package CORE HTTP Daemon
  26. }
  27. { ****************************************************************
  28. *
  29. * The most basic server code is encapsulated in a single module
  30. * known as the core, which is just *barely* functional enough to
  31. * serve documents, though not terribly well.
  32. *
  33. * Largely for NCSA back-compatibility reasons, the core needs to
  34. * make pieces of its config structures available to other modules.
  35. * The accessors are declared here, along with the interpretation
  36. * of one of them (allow_options).
  37. }
  38. const
  39. OPT_NONE = 0;
  40. OPT_INDEXES = 1;
  41. OPT_INCLUDES = 2;
  42. OPT_SYM_LINKS = 4;
  43. OPT_EXECCGI = 8;
  44. OPT_UNSET = 16;
  45. OPT_INCNOEXEC = 32;
  46. OPT_SYM_OWNER = 64;
  47. OPT_MULTI = 128;
  48. OPT_ALL = (OPT_INDEXES or OPT_INCLUDES or OPT_SYM_LINKS or OPT_EXECCGI);
  49. { options for get_remote_host() }
  50. { REMOTE_HOST returns the hostname, or NULL if the hostname
  51. * lookup fails. It will force a DNS lookup according to the
  52. * HostnameLookups setting.
  53. }
  54. REMOTE_HOST = (0);
  55. { REMOTE_NAME returns the hostname, or the dotted quad if the
  56. * hostname lookup fails. It will force a DNS lookup according
  57. * to the HostnameLookups setting.
  58. }
  59. REMOTE_NAME = (1);
  60. { REMOTE_NOLOOKUP is like REMOTE_NAME except that a DNS lookup is
  61. * never forced.
  62. }
  63. REMOTE_NOLOOKUP = (2);
  64. { REMOTE_DOUBLE_REV will always force a DNS lookup, and also force
  65. * a double reverse lookup, regardless of the HostnameLookups
  66. * setting. The result is the (double reverse checked) hostname,
  67. * or NULL if any of the lookups fail.
  68. }
  69. REMOTE_DOUBLE_REV = (3);
  70. SATISFY_ALL = 0;
  71. SATISFY_ANY = 1;
  72. SATISFY_NOSPEC = 2;
  73. { Make sure we don't write less than 8000 bytes at any one time.
  74. }
  75. AP_MIN_BYTES_TO_WRITE = 8000;
  76. { default maximum of internal redirects }
  77. AP_DEFAULT_MAX_INTERNAL_REDIRECTS = 10;
  78. { default maximum subrequest nesting level }
  79. AP_DEFAULT_MAX_SUBREQ_DEPTH = 10;
  80. {
  81. * Retrieve the value of Options for this request
  82. * @param r The current request
  83. * @return the Options bitmask
  84. * @deffunc int ap_allow_options(request_rec *r)
  85. }
  86. function ap_allow_options(r: Prequest_rec): Integer;
  87. {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
  88. external LibHTTPD name LibNamePrefix + 'ap_allow_options' + LibSuff4;
  89. {
  90. * Retrieve the value of the AllowOverride for this request
  91. * @param r The current request
  92. * @return the overrides bitmask
  93. * @deffunc int ap_allow_overrides(request_rec *r)
  94. }
  95. function ap_allow_overrides(r: Prequest_rec): Integer;
  96. {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
  97. external LibHTTPD name LibNamePrefix + 'ap_allow_overrides' + LibSuff4;
  98. {
  99. * Retrieve the value of the DefaultType directive, or text/plain if not set
  100. * @param r The current request
  101. * @return The default type
  102. * @deffunc const char *ap_default_type(request_rec *r)
  103. }
  104. function ap_default_type(r: Prequest_rec): PChar;
  105. {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
  106. external LibHTTPD name LibNamePrefix + 'ap_default_type' + LibSuff4;
  107. {
  108. * Retrieve the document root for this server
  109. * @param r The current request
  110. * @warning Don't use this! If your request went through a Userdir, or
  111. * something like that, it'll screw you. But it's back-compatible...
  112. * @return The document root
  113. * @deffunc const char *ap_document_root(request_rec *r)
  114. }
  115. function ap_document_root(r: Prequest_rec): PChar;
  116. {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
  117. external LibHTTPD name LibNamePrefix + 'ap_document_root' + LibSuff4;
  118. {
  119. * Lookup the remote client's DNS name or IP address
  120. * @param conn The current connection
  121. * @param dir_config The directory config vector from the request
  122. * @param type The type of lookup to perform. One of:
  123. * <pre>
  124. * REMOTE_HOST returns the hostname, or NULL if the hostname
  125. * lookup fails. It will force a DNS lookup according to the
  126. * HostnameLookups setting.
  127. * REMOTE_NAME returns the hostname, or the dotted quad if the
  128. * hostname lookup fails. It will force a DNS lookup according
  129. * to the HostnameLookups setting.
  130. * REMOTE_NOLOOKUP is like REMOTE_NAME except that a DNS lookup is
  131. * never forced.
  132. * REMOTE_DOUBLE_REV will always force a DNS lookup, and also force
  133. * a double reverse lookup, regardless of the HostnameLookups
  134. * setting. The result is the (double reverse checked)
  135. * hostname, or NULL if any of the lookups fail.
  136. * </pre>
  137. * @param str_is_ip unless NULL is passed, this will be set to non-zero on output when an IP address
  138. * string is returned
  139. * @return The remote hostname
  140. * @deffunc const char *ap_get_remote_host(conn_rec *conn, void *dir_config, int type, int *str_is_ip)
  141. }
  142. function ap_get_remote_host(conn: Pconn_rec; dir_config: Pointer;
  143. _type: Integer; str_is_ip: PInteger): PChar;
  144. {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
  145. external LibHTTPD name LibNamePrefix + 'ap_get_remote_host' + LibSuff16;
  146. {
  147. * Retrieve the login name of the remote user. Undef if it could not be
  148. * determined
  149. * @param r The current request
  150. * @return The user logged in to the client machine
  151. * @deffunc const char *ap_get_remote_logname(request_rec *r)
  152. }
  153. function ap_get_remote_logname(r: Prequest_rec): PChar;
  154. {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
  155. external LibHTTPD name LibNamePrefix + 'ap_get_remote_logname' + LibSuff4;
  156. { Used for constructing self-referencing URLs, and things like SERVER_PORT,
  157. * and SERVER_NAME.
  158. }
  159. {
  160. * build a fully qualified URL from the uri and information in the request rec
  161. * @param p The pool to allocate the URL from
  162. * @param uri The path to the requested file
  163. * @param r The current request
  164. * @return A fully qualified URL
  165. * @deffunc char *ap_construct_url(apr_pool_t *p, const char *uri, request_rec *r)
  166. }
  167. function ap_construct_url(p: Papr_pool_t; const uri: PChar; r: Prequest_rec): PChar;
  168. {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
  169. external LibHTTPD name LibNamePrefix + 'ap_construct_url' + LibSuff12;
  170. {
  171. * Get the current server name from the request
  172. * @param r The current request
  173. * @return the server name
  174. * @deffunc const char *ap_get_server_name(request_rec *r)
  175. }
  176. function ap_get_server_name(r: Prequest_rec): PChar;
  177. {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
  178. external LibHTTPD name LibNamePrefix + 'ap_get_server_name' + LibSuff4;
  179. {
  180. * Get the current server port
  181. * @param The current request
  182. * @return The server's port
  183. * @deffunc apr_port_t ap_get_server_port(const request_rec *r)
  184. }
  185. function ap_get_server_port(r: Prequest_rec): apr_port_t;
  186. {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
  187. external LibHTTPD name LibNamePrefix + 'ap_get_server_port' + LibSuff4;
  188. {
  189. * Return the limit on bytes in request msg body
  190. * @param r The current request
  191. * @return the maximum number of bytes in the request msg body
  192. * @deffunc apr_off_t ap_get_limit_req_body(const request_rec *r)
  193. }
  194. function ap_get_limit_req_body(r: Prequest_rec): apr_off_t;
  195. {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
  196. external LibHTTPD name LibNamePrefix + 'ap_get_limit_req_body' + LibSuff4;
  197. {
  198. * Return the limit on bytes in XML request msg body
  199. * @param r The current request
  200. * @return the maximum number of bytes in XML request msg body
  201. * @deffunc size_t ap_get_limit_xml_body(const request_rec *r)
  202. }
  203. function ap_get_limit_xml_body(r: Prequest_rec): size_t;
  204. {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
  205. external LibHTTPD name LibNamePrefix + 'ap_get_limit_xml_body' + LibSuff4;
  206. {
  207. * Install a custom response handler for a given status
  208. * @param r The current request
  209. * @param status The status for which the custom response should be used
  210. * @param string The custom response. This can be a static string, a file
  211. * or a URL
  212. }
  213. procedure ap_custom_response(r: Prequest_rec; status: Integer; const str: PChar);
  214. {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
  215. external LibHTTPD name LibNamePrefix + 'ap_custom_response' + LibSuff12;
  216. {
  217. * Check if the current request is beyond the configured max. number of redirects or subrequests
  218. * @param r The current request
  219. * @return true (is exceeded) or false
  220. * @deffunc int ap_is_recursion_limit_exceeded(const request_rec *r)
  221. }
  222. function ap_is_recursion_limit_exceeded(r: Prequest_rec): Integer;
  223. {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
  224. external LibHTTPD name LibNamePrefix + 'ap_is_recursion_limit_exceeded' + LibSuff4;
  225. {
  226. * Check for a definition from the server command line
  227. * @param name The define to check for
  228. * @return 1 if defined, 0 otherwise
  229. * @deffunc int ap_exists_config_define(const char *name)
  230. }
  231. function ap_exists_config_define(name: PChar): Integer;
  232. {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
  233. external LibHTTPD name LibNamePrefix + 'ap_exists_config_define' + LibSuff4;
  234. { FIXME! See STATUS about how }
  235. function ap_core_translate(r: Prequest_rec): Integer;
  236. cdecl; external LibHTTPD name 'ap_core_translate';
  237. { Authentication stuff. This is one of the places where compatibility
  238. * with the old config files *really* hurts; they don't discriminate at
  239. * all between different authentication schemes, meaning that we need
  240. * to maintain common state for all of them in the core, and make it
  241. * available to the other modules through interfaces.
  242. }
  243. { A structure to keep track of authorization requirements }
  244. type
  245. require_line = record
  246. { Where the require line is in the config file. }
  247. method_mask: apr_int64_t;
  248. { The complete string from the command line }
  249. requirement: PChar;
  250. end;
  251. {
  252. * Return the type of authorization required for this request
  253. * @param r The current request
  254. * @return The authorization required
  255. * @deffunc const char *ap_auth_type(request_rec *r)
  256. }
  257. function ap_auth_type(r: Prequest_rec): PChar;
  258. {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
  259. external LibHTTPD name LibNamePrefix + 'ap_auth_type' + LibSuff4;
  260. {
  261. * Return the current Authorization realm
  262. * @param r The current request
  263. * @return The current authorization realm
  264. * @deffunc const char *ap_auth_name(request_rec *r)
  265. }
  266. function ap_auth_name(r: Prequest_rec): PChar;
  267. {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
  268. external LibHTTPD name LibNamePrefix + 'ap_auth_name' + LibSuff4;
  269. {
  270. * How the requires lines must be met.
  271. * @param r The current request
  272. * @return How the requirements must be met. One of:
  273. * <pre>
  274. * SATISFY_ANY -- any of the requirements must be met.
  275. * SATISFY_ALL -- all of the requirements must be met.
  276. * SATISFY_NOSPEC -- There are no applicable satisfy lines
  277. * </pre>
  278. * @deffunc int ap_satisfies(request_rec *r)
  279. }
  280. function ap_satisfies(r: Prequest_rec): Integer;
  281. {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
  282. external LibHTTPD name LibNamePrefix + 'ap_satisfies' + LibSuff4;
  283. {
  284. * Retrieve information about all of the requires directives for this request
  285. * @param r The current request
  286. * @return An array of all requires directives for this request
  287. * @deffunc const apr_array_header_t *ap_requires(request_rec *r)
  288. }
  289. function ap_requires(p: Papr_array_header_t): Integer;
  290. {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
  291. external LibHTTPD name LibNamePrefix + 'ap_requires' + LibSuff4;
  292. //#ifdef CORE_PRIVATE
  293. {
  294. * Core is also unlike other modules in being implemented in more than
  295. * one file... so, data structures are declared here, even though most of
  296. * the code that cares really is in http_core.c. Also, another accessor.
  297. }
  298. //AP_DECLARE_DATA extern module core_module;
  299. { Per-request configuration }
  300. type
  301. core_request_config = record
  302. { bucket brigade used by getline for look-ahead and
  303. * ap_get_client_block for holding left-over request body }
  304. bb: Papr_bucket_brigade;
  305. { an array of per-request working data elements, accessed
  306. * by ID using ap_get_request_note()
  307. * (Use ap_register_request_note() during initialization
  308. * to add elements)
  309. }
  310. notes: PPointer;
  311. { There is a script processor installed on the output filter chain,
  312. * so it needs the default_handler to deliver a (script) file into
  313. * the chain so it can process it. Normally, default_handler only
  314. * serves files on a GET request (assuming the file is actual content),
  315. * since other methods are not content-retrieval. This flag overrides
  316. * that behavior, stating that the "content" is actually a script and
  317. * won't actually be delivered as the response for the non-GET method.
  318. }
  319. deliver_script: Integer;
  320. { Custom response strings registered via ap_custom_response(),
  321. * or NULL; check per-dir config if nothing found here
  322. }
  323. response_code_strings: PPChar; { from ap_custom_response(), not from
  324. * ErrorDocument
  325. }
  326. { Should addition of charset= be suppressed for this request?
  327. }
  328. suppress_charset: Integer;
  329. end;
  330. { Standard entries that are guaranteed to be accessible via
  331. * ap_get_request_note() for each request (additional entries
  332. * can be added with ap_register_request_note())
  333. }
  334. const
  335. AP_NOTE_DIRECTORY_WALK = 0;
  336. AP_NOTE_LOCATION_WALK = 1;
  337. AP_NOTE_FILE_WALK = 2;
  338. AP_NUM_STD_NOTES = 3;
  339. {
  340. * Reserve an element in the core_request_config->notes array
  341. * for some application-specific data
  342. * @return An integer key that can be passed to ap_get_request_note()
  343. * during request processing to access this element for the
  344. * current request.
  345. }
  346. function ap_register_request_note: apr_size_t;
  347. {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
  348. external LibHTTPD name LibNamePrefix + 'ap_register_request_note' + LibSuff0;
  349. {
  350. * Retrieve a pointer to an element in the core_request_config->notes array
  351. * @param r The request
  352. * @param note_num A key for the element: either a value obtained from
  353. * ap_register_request_note() or one of the predefined AP_NOTE_*
  354. * values.
  355. * @return NULL if the note_num is invalid, otherwise a pointer to the
  356. * requested note element.
  357. * @remark At the start of a request, each note element is NULL. The
  358. * handle provided by ap_get_request_note() is a pointer-to-pointer
  359. * so that the caller can point the element to some app-specific
  360. * data structure. The caller should guarantee that any such
  361. * structure will last as long as the request itself.
  362. }
  363. function ap_get_request_note(r: Prequest_rec; note_num: apr_size_t): PPointer;
  364. {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
  365. external LibHTTPD name LibNamePrefix + 'ap_get_request_note' + LibSuff8;
  366. { Per-directory configuration }
  367. type
  368. allow_options_t = cuchar;
  369. overrides_t = cuchar;
  370. {
  371. * Bits of info that go into making an ETag for a file
  372. * document. Why a long? Because char historically
  373. * proved too short for Options, and int can be different
  374. * sizes on different platforms.
  375. }
  376. etag_components_t = culong;
  377. const
  378. ETAG_UNSET = 0;
  379. ETAG_NONE = (1 shl 0);
  380. ETAG_MTIME = (1 shl 1);
  381. ETAG_INODE = (1 shl 2);
  382. ETAG_SIZE = (1 shl 3);
  383. ETAG_BACKWARD = (ETAG_MTIME or ETAG_INODE or ETAG_SIZE);
  384. ETAG_ALL = (ETAG_MTIME or ETAG_INODE or ETAG_SIZE);
  385. { Hostname resolution etc }
  386. HOSTNAME_LOOKUP_OFF = 0;
  387. HOSTNAME_LOOKUP_ON = 1;
  388. HOSTNAME_LOOKUP_DOUBLE = 2;
  389. OSTNAME_LOOKUP_UNSET = 3;
  390. { Hostname resolution etc }
  391. USE_CANONICAL_NAME_OFF = (0);
  392. USE_CANONICAL_NAME_ON = (1);
  393. USE_CANONICAL_NAME_DNS = (2);
  394. USE_CANONICAL_NAME_UNSET = (3);
  395. { should we force a charset on any outgoing parameterless content-type?
  396. * if so, which charset?
  397. }
  398. ADD_DEFAULT_CHARSET_OFF = (0);
  399. ADD_DEFAULT_CHARSET_ON = (1);
  400. ADD_DEFAULT_CHARSET_UNSET = (2);
  401. {
  402. * Run-time performance tuning
  403. }
  404. ENABLE_MMAP_OFF = (0);
  405. ENABLE_MMAP_ON = (1);
  406. ENABLE_MMAP_UNSET = (2);
  407. ENABLE_SENDFILE_OFF = (0);
  408. ENABLE_SENDFILE_ON = (1);
  409. ENABLE_SENDFILE_UNSET = (2);
  410. type
  411. server_signature_e = (
  412. srv_sig_unset,
  413. srv_sig_off,
  414. srv_sig_on,
  415. srv_sig_withmail
  416. );
  417. core_dir_config = record
  418. { path of the directory/regex/etc. see also d_is_fnmatch/absolute below }
  419. d: PChar;
  420. { the number of slashes in d }
  421. d_components: Cardinal;
  422. { If (opts & OPT_UNSET) then no absolute assignment to options has
  423. * been made.
  424. * invariant: (opts_add & opts_remove) == 0
  425. * Which said another way means that the last relative (options + or -)
  426. * assignment made to each bit is recorded in exactly one of opts_add
  427. * or opts_remove.
  428. }
  429. opts: allow_options_t;
  430. opts_add: allow_options_t;
  431. opts_remove: allow_options_t;
  432. override_: overrides_t;
  433. { MIME typing --- the core doesn't do anything at all with this,
  434. * but it does know what to slap on a request for a document which
  435. * goes untyped by other mechanisms before it slips out the door...
  436. }
  437. ap_default_type: PChar;
  438. { Authentication stuff. Groan... }
  439. satisfy: PInteger; { for every method one }
  440. ap_auth_type: PChar;
  441. ap_auth_name: PChar;
  442. ap_requires: Papr_array_header_t;
  443. { Custom response config. These can contain text or a URL to redirect to.
  444. * if response_code_strings is NULL then there are none in the config,
  445. * if it's not null then it's allocated to sizeof(char*)*RESPONSE_CODES.
  446. * This lets us do quick merges in merge_core_dir_configs().
  447. }
  448. response_code_strings: PPChar; { from ErrorDocument, not from
  449. * ap_custom_response() }
  450. { Hostname resolution etc }
  451. { unsigned int hostname_lookups : 4; }
  452. { signed int do_rfc1413 : 2; }{ See if client is advertising a username? }
  453. { signed int content_md5 : 2; }{ calculate Content-MD5? }
  454. { unsigned use_canonical_name : 2; }
  455. { since is_fnmatch(conf->d) was being called so frequently in
  456. * directory_walk() and its relatives, this field was created and
  457. * is set to the result of that call.
  458. }
  459. { unsigned d_is_fnmatch : 1; }
  460. { should we force a charset on any outgoing parameterless content-type?
  461. * if so, which charset?
  462. }
  463. { unsigned add_default_charset : 2; }
  464. add_default_charset_name: PChar;
  465. { System Resource Control }
  466. {$ifdef RLIMIT_CPU}
  467. limit_cpu: Prlimit;
  468. {$endif}
  469. {$if defined(RLIMIT_DATA) or defined (RLIMIT_VMEM) or defined(RLIMIT_AS)}
  470. limit_mem: Prlimit;
  471. {$endif}
  472. {$ifdef RLIMIT_NPROC}
  473. limit_nproc: Prlimit;
  474. {$endif}
  475. limit_req_body: apr_off_t; { limit on bytes in request msg body }
  476. limit_xml_body: cLong; { limit on bytes in XML request msg body }
  477. { logging options }
  478. server_signature: server_signature_e;
  479. loglevel: Integer;
  480. { Access control }
  481. sec_file: Papr_array_header_t;
  482. r: Pregex_t;
  483. mime_type: PChar; { forced with ForceType }
  484. handler: PChar; { forced with SetHandler }
  485. output_filters: PChar; { forced with SetOutputFilters }
  486. input_filters: PChar; { forced with SetInputFilters }
  487. accept_path_info: Integer; { forced with AcceptPathInfo }
  488. ct_output_filters: Papr_hash_t; { added with AddOutputFilterByType }
  489. {
  490. * What attributes/data should be included in ETag generation?
  491. }
  492. etag_bits: etag_components_t;
  493. etag_add: etag_components_t;
  494. etag_remove: etag_components_t;
  495. {
  496. * Run-time performance tuning
  497. }
  498. { unsigned int enable_mmap : 2; }{ whether files in this dir can be mmap'ed }
  499. { unsigned int enable_sendfile : 2; }{ files in this dir can be mmap'ed }
  500. { unsigned int allow_encoded_slashes : 1; }{ URLs may contain %2f w/o being
  501. * pitched indiscriminately }
  502. end;
  503. { Per-server core configuration }
  504. const
  505. { TRACE control }
  506. AP_TRACE_UNSET = -1;
  507. AP_TRACE_DISABLE = 0;
  508. AP_TRACE_ENABLE = 1;
  509. AP_TRACE_EXTENDED = 2;
  510. type
  511. core_server_config = record
  512. {$ifdef GPROF}
  513. gprof_dir: PChar;
  514. {$endif}
  515. { Name translations --- we want the core to be able to do *something*
  516. * so it's at least a minimally functional web server on its own (and
  517. * can be tested that way). But let's keep it to the bare minimum:
  518. }
  519. ap_document_root: PChar;
  520. { Access control }
  521. access_name: PChar;
  522. sec_dir: Papr_array_header_t;
  523. sec_url: Papr_array_header_t;
  524. { recursion backstopper }
  525. redirect_limit: Integer; { maximum number of internal redirects }
  526. subreq_limit: Integer; { maximum nesting level of subrequests }
  527. { TRACE control }
  528. trace_enable: Integer;
  529. end;
  530. { for AddOutputFiltersByType in core.c }
  531. //void ap_add_output_filters_by_type(request_rec *r);
  532. { for http_config.c }
  533. //void ap_core_reorder_directories(apr_pool_t *, server_rec *);
  534. { for mod_perl }
  535. {AP_CORE_DECLARE(void) ap_add_per_dir_conf(server_rec *s, void *dir_config);
  536. AP_CORE_DECLARE(void) ap_add_per_url_conf(server_rec *s, void *url_config);
  537. AP_CORE_DECLARE(void) ap_add_file_conf(core_dir_config *conf, void *url_config);
  538. AP_CORE_DECLARE_NONSTD(const char *) ap_limit_section(cmd_parms *cmd, void *dummy, const char *arg);}
  539. //#endif COREPRIVATE
  540. { ----------------------------------------------------------------------
  541. *
  542. * Runtime status/management
  543. }
  544. type
  545. ap_mgmt_type_e = (
  546. ap_mgmt_type_string,
  547. ap_mgmt_type_long,
  548. ap_mgmt_type_hash
  549. );
  550. ap_mgmt_value = record
  551. case Integer of
  552. 0: (s_value: PChar);
  553. 1: (i_value: cLong);
  554. 2: (h_value: Papr_hash_t);
  555. end;
  556. ap_mgmt_item_t = record
  557. description: PChar;
  558. name: PChar;
  559. vtype: ap_mgmt_type_e;
  560. v: ap_mgmt_value;
  561. end;
  562. { Handles for core filters }
  563. {extern AP_DECLARE_DATA ap_filter_rec_t *ap_subreq_core_filter_handle;
  564. extern AP_DECLARE_DATA ap_filter_rec_t *ap_core_output_filter_handle;
  565. extern AP_DECLARE_DATA ap_filter_rec_t *ap_content_length_filter_handle;
  566. extern AP_DECLARE_DATA ap_filter_rec_t *ap_net_time_filter_handle;
  567. extern AP_DECLARE_DATA ap_filter_rec_t *ap_core_input_filter_handle;}
  568. {
  569. * This hook provdes a way for modules to provide metrics/statistics about
  570. * their operational status.
  571. *
  572. * @param p A pool to use to create entries in the hash table
  573. * @param val The name of the parameter(s) that is wanted. This is
  574. * tree-structured would be in the form ('*' is all the tree,
  575. * 'module.*' all of the module , 'module.foo.*', or
  576. * 'module.foo.bar' )
  577. * @param ht The hash table to store the results. Keys are item names, and
  578. * the values point to ap_mgmt_item_t structures.
  579. * @ingroup hooks
  580. }
  581. type
  582. ap_HOOK_get_mgmt_items_t = function(p: Papr_pool_t; const val: PChar;
  583. ht: Papr_hash_t): Integer; cdecl;
  584. procedure ap_hook_get_mgmt_items(pf: ap_HOOK_get_mgmt_items_t;
  585. const aszPre: PPChar; const aszSucc: PPChar; nOrder: Integer);
  586. {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
  587. external LibHTTPD name LibNamePrefix + 'ap_hook_get_mgmt_items' + LibSuff16;
  588. { ---------------------------------------------------------------------- }
  589. { ----------------------------------------------------------------------
  590. *
  591. * I/O logging with mod_logio
  592. }
  593. {APR_DECLARE_OPTIONAL_FN(void, ap_logio_add_bytes_out,
  594. (conn_rec *c, apr_off_t bytes));}