http_core.h 22 KB

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