http_core.inc 25 KB

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