http_request.h 26 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630
  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_request.h
  18. * @brief Apache Request library
  19. *
  20. * @defgroup APACHE_CORE_REQ Apache Request Processing
  21. * @ingroup APACHE_CORE
  22. * @{
  23. */
  24. /*
  25. * request.c is the code which handles the main line of request
  26. * processing, once a request has been read in (finding the right per-
  27. * directory configuration, building it if necessary, and calling all
  28. * the module dispatch functions in the right order).
  29. *
  30. * The pieces here which are public to the modules, allow them to learn
  31. * how the server would handle some other file or URI, or perhaps even
  32. * direct the server to serve that other file instead of the one the
  33. * client requested directly.
  34. *
  35. * There are two ways to do that. The first is the sub_request mechanism,
  36. * which handles looking up files and URIs as adjuncts to some other
  37. * request (e.g., directory entries for multiviews and directory listings);
  38. * the lookup functions stop short of actually running the request, but
  39. * (e.g., for includes), a module may call for the request to be run
  40. * by calling run_sub_req. The space allocated to create sub_reqs can be
  41. * reclaimed by calling destroy_sub_req --- be sure to copy anything you care
  42. * about which was allocated in its apr_pool_t elsewhere before doing this.
  43. */
  44. #ifndef APACHE_HTTP_REQUEST_H
  45. #define APACHE_HTTP_REQUEST_H
  46. #include "apr_optional.h"
  47. #include "util_filter.h"
  48. #ifdef __cplusplus
  49. extern "C" {
  50. #endif
  51. #define AP_SUBREQ_NO_ARGS 0
  52. #define AP_SUBREQ_MERGE_ARGS 1
  53. /**
  54. * An internal handler used by the ap_process_request, all subrequest mechanisms
  55. * and the redirect mechanism.
  56. * @param r The request, subrequest or internal redirect to pre-process
  57. * @return The return code for the request
  58. */
  59. AP_DECLARE(int) ap_process_request_internal(request_rec *r);
  60. /**
  61. * Create a subrequest from the given URI. This subrequest can be
  62. * inspected to find information about the requested URI
  63. * @param new_uri The URI to lookup
  64. * @param r The current request
  65. * @param next_filter The first filter the sub_request should use. If this is
  66. * NULL, it defaults to the first filter for the main request
  67. * @return The new request record
  68. */
  69. AP_DECLARE(request_rec *) ap_sub_req_lookup_uri(const char *new_uri,
  70. const request_rec *r,
  71. ap_filter_t *next_filter);
  72. /**
  73. * Create a subrequest for the given file. This subrequest can be
  74. * inspected to find information about the requested file
  75. * @param new_file The file to lookup
  76. * @param r The current request
  77. * @param next_filter The first filter the sub_request should use. If this is
  78. * NULL, it defaults to the first filter for the main request
  79. * @return The new request record
  80. */
  81. AP_DECLARE(request_rec *) ap_sub_req_lookup_file(const char *new_file,
  82. const request_rec *r,
  83. ap_filter_t *next_filter);
  84. /**
  85. * Create a subrequest for the given apr_dir_read result. This subrequest
  86. * can be inspected to find information about the requested file
  87. * @param finfo The apr_dir_read result to lookup
  88. * @param r The current request
  89. * @param subtype What type of subrequest to perform, one of;
  90. * <PRE>
  91. * AP_SUBREQ_NO_ARGS ignore r->args and r->path_info
  92. * AP_SUBREQ_MERGE_ARGS merge r->args and r->path_info
  93. * </PRE>
  94. * @param next_filter The first filter the sub_request should use. If this is
  95. * NULL, it defaults to the first filter for the main request
  96. * @return The new request record
  97. * @note The apr_dir_read flags value APR_FINFO_MIN|APR_FINFO_NAME flag is the
  98. * minimum recommended query if the results will be passed to apr_dir_read.
  99. * The file info passed must include the name, and must have the same relative
  100. * directory as the current request.
  101. */
  102. AP_DECLARE(request_rec *) ap_sub_req_lookup_dirent(const apr_finfo_t *finfo,
  103. const request_rec *r,
  104. int subtype,
  105. ap_filter_t *next_filter);
  106. /**
  107. * Create a subrequest for the given URI using a specific method. This
  108. * subrequest can be inspected to find information about the requested URI
  109. * @param method The method to use in the new subrequest
  110. * @param new_uri The URI to lookup
  111. * @param r The current request
  112. * @param next_filter The first filter the sub_request should use. If this is
  113. * NULL, it defaults to the first filter for the main request
  114. * @return The new request record
  115. */
  116. AP_DECLARE(request_rec *) ap_sub_req_method_uri(const char *method,
  117. const char *new_uri,
  118. const request_rec *r,
  119. ap_filter_t *next_filter);
  120. /**
  121. * An output filter to strip EOS buckets from sub-requests. This always
  122. * has to be inserted at the end of a sub-requests filter stack.
  123. * @param f The current filter
  124. * @param bb The brigade to filter
  125. * @return status code
  126. */
  127. AP_CORE_DECLARE_NONSTD(apr_status_t) ap_sub_req_output_filter(ap_filter_t *f,
  128. apr_bucket_brigade *bb);
  129. /**
  130. * Run the handler for the subrequest
  131. * @param r The subrequest to run
  132. * @return The return code for the subrequest
  133. */
  134. AP_DECLARE(int) ap_run_sub_req(request_rec *r);
  135. /**
  136. * Free the memory associated with a subrequest
  137. * @param r The subrequest to finish
  138. */
  139. AP_DECLARE(void) ap_destroy_sub_req(request_rec *r);
  140. /*
  141. * Then there's the case that you want some other request to be served
  142. * as the top-level request INSTEAD of what the client requested directly.
  143. * If so, call this from a handler, and then immediately return OK.
  144. */
  145. /**
  146. * Redirect the current request to some other uri
  147. * @param new_uri The URI to replace the current request with
  148. * @param r The current request
  149. */
  150. AP_DECLARE(void) ap_internal_redirect(const char *new_uri, request_rec *r);
  151. /**
  152. * This function is designed for things like actions or CGI scripts, when
  153. * using AddHandler, and you want to preserve the content type across
  154. * an internal redirect.
  155. * @param new_uri The URI to replace the current request with.
  156. * @param r The current request
  157. */
  158. AP_DECLARE(void) ap_internal_redirect_handler(const char *new_uri, request_rec *r);
  159. /**
  160. * Redirect the current request to a sub_req, merging the pools
  161. * @param sub_req A subrequest created from this request
  162. * @param r The current request
  163. * @note the sub_req's pool will be merged into r's pool, be very careful
  164. * not to destroy this subrequest, it will be destroyed with the main request!
  165. */
  166. AP_DECLARE(void) ap_internal_fast_redirect(request_rec *sub_req, request_rec *r);
  167. /**
  168. * Can be used within any handler to determine if any authentication
  169. * is required for the current request
  170. * @param r The current request
  171. * @return 1 if authentication is required, 0 otherwise
  172. * @bug Behavior changed in 2.4.x refactoring, API no longer usable
  173. * @deprecated @see ap_some_authn_required()
  174. */
  175. AP_DECLARE(int) ap_some_auth_required(request_rec *r);
  176. /**
  177. * @defgroup APACHE_CORE_REQ_AUTH Access Control for Sub-Requests and
  178. * Internal Redirects
  179. * @ingroup APACHE_CORE_REQ
  180. * @{
  181. */
  182. #define AP_AUTH_INTERNAL_PER_URI 0 /**< Run access control hooks on all
  183. internal requests with URIs
  184. distinct from that of initial
  185. request */
  186. #define AP_AUTH_INTERNAL_PER_CONF 1 /**< Run access control hooks only on
  187. internal requests with
  188. configurations distinct from
  189. that of initial request */
  190. #define AP_AUTH_INTERNAL_MASK 0x000F /**< mask to extract internal request
  191. processing mode */
  192. /**
  193. * Clear flag which determines when access control hooks will be run for
  194. * internal requests.
  195. */
  196. AP_DECLARE(void) ap_clear_auth_internal(void);
  197. /**
  198. * Determine whether access control hooks will be run for all internal
  199. * requests with URIs distinct from that of the initial request, or only
  200. * those for which different configurations apply than those which applied
  201. * to the initial request. To accommodate legacy external modules which
  202. * may expect access control hooks to be run for all internal requests
  203. * with distinct URIs, this is the default behaviour unless all access
  204. * control hooks and authentication and authorization providers are
  205. * registered with AP_AUTH_INTERNAL_PER_CONF.
  206. * @param ptemp Pool used for temporary allocations
  207. */
  208. AP_DECLARE(void) ap_setup_auth_internal(apr_pool_t *ptemp);
  209. /**
  210. * Register an authentication or authorization provider with the global
  211. * provider pool.
  212. * @param pool The pool to create any storage from
  213. * @param provider_group The group to store the provider in
  214. * @param provider_name The name for this provider
  215. * @param provider_version The version for this provider
  216. * @param provider Opaque structure for this provider
  217. * @param type Internal request processing mode, either
  218. * AP_AUTH_INTERNAL_PER_URI or AP_AUTH_INTERNAL_PER_CONF
  219. * @return APR_SUCCESS if all went well
  220. */
  221. AP_DECLARE(apr_status_t) ap_register_auth_provider(apr_pool_t *pool,
  222. const char *provider_group,
  223. const char *provider_name,
  224. const char *provider_version,
  225. const void *provider,
  226. int type);
  227. /** @} */
  228. /* Optional functions coming from mod_authn_core and mod_authz_core
  229. * that list all registered authn/z providers.
  230. */
  231. APR_DECLARE_OPTIONAL_FN(apr_array_header_t *, authn_ap_list_provider_names,
  232. (apr_pool_t *ptemp));
  233. APR_DECLARE_OPTIONAL_FN(apr_array_header_t *, authz_ap_list_provider_names,
  234. (apr_pool_t *ptemp));
  235. /**
  236. * Determine if the current request is the main request or a subrequest
  237. * @param r The current request
  238. * @return 1 if this is the main request, 0 otherwise
  239. */
  240. AP_DECLARE(int) ap_is_initial_req(request_rec *r);
  241. /**
  242. * Function to set the r->mtime field to the specified value if it's later
  243. * than what's already there.
  244. * @param r The current request
  245. * @param dependency_mtime Time to set the mtime to
  246. */
  247. AP_DECLARE(void) ap_update_mtime(request_rec *r, apr_time_t dependency_mtime);
  248. /**
  249. * Add one or more methods to the list permitted to access the resource.
  250. * Usually executed by the content handler before the response header is
  251. * sent, but sometimes invoked at an earlier phase if a module knows it
  252. * can set the list authoritatively. Note that the methods are ADDED
  253. * to any already permitted unless the reset flag is non-zero. The
  254. * list is used to generate the Allow response header field when it
  255. * is needed.
  256. * @param r The pointer to the request identifying the resource.
  257. * @param reset Boolean flag indicating whether this list should
  258. * completely replace any current settings.
  259. * @param ... A NULL-terminated list of strings, each identifying a
  260. * method name to add.
  261. * @return None.
  262. */
  263. AP_DECLARE(void) ap_allow_methods(request_rec *r, int reset, ...)
  264. AP_FN_ATTR_SENTINEL;
  265. /**
  266. * Add one or more methods to the list permitted to access the resource.
  267. * Usually executed by the content handler before the response header is
  268. * sent, but sometimes invoked at an earlier phase if a module knows it
  269. * can set the list authoritatively. Note that the methods are ADDED
  270. * to any already permitted unless the reset flag is non-zero. The
  271. * list is used to generate the Allow response header field when it
  272. * is needed.
  273. * @param r The pointer to the request identifying the resource.
  274. * @param reset Boolean flag indicating whether this list should
  275. * completely replace any current settings.
  276. * @param ... A list of method identifiers, from the "M_" series
  277. * defined in httpd.h, terminated with a value of -1
  278. * (e.g., "M_GET, M_POST, M_OPTIONS, -1")
  279. * @return None.
  280. */
  281. AP_DECLARE(void) ap_allow_standard_methods(request_rec *r, int reset, ...);
  282. #define MERGE_ALLOW 0
  283. #define REPLACE_ALLOW 1
  284. /**
  285. * Process a top-level request from a client, and synchronously write
  286. * the response to the client
  287. * @param r The current request
  288. */
  289. AP_DECLARE(void) ap_process_request(request_rec *r);
  290. /* For post-processing after a handler has finished with a request.
  291. * (Commonly used after it was suspended)
  292. */
  293. AP_DECLARE(void) ap_process_request_after_handler(request_rec *r);
  294. /**
  295. * Process a top-level request from a client, allowing some or all of
  296. * the response to remain buffered in the core output filter for later,
  297. * asynchronous write completion
  298. * @param r The current request
  299. */
  300. void ap_process_async_request(request_rec *r);
  301. /**
  302. * Kill the current request
  303. * @param type Why the request is dieing
  304. * @param r The current request
  305. */
  306. AP_DECLARE(void) ap_die(int type, request_rec *r);
  307. /**
  308. * Check whether a connection is still established and has data available,
  309. * optionnaly consuming blank lines ([CR]LF).
  310. * @param c The current connection
  311. * @param bb The brigade to filter
  312. * @param max_blank_lines Max number of blank lines to consume, or zero
  313. * to consider them as data (single read).
  314. * @return APR_SUCCESS: connection established with data available,
  315. * APR_EAGAIN: connection established and empty,
  316. * APR_NOTFOUND: too much blank lines,
  317. * APR_E*: connection/general error.
  318. */
  319. AP_DECLARE(apr_status_t) ap_check_pipeline(conn_rec *c, apr_bucket_brigade *bb,
  320. unsigned int max_blank_lines);
  321. /* Hooks */
  322. /**
  323. * Gives modules a chance to create their request_config entry when the
  324. * request is created.
  325. * @param r The current request
  326. * @ingroup hooks
  327. */
  328. AP_DECLARE_HOOK(int,create_request,(request_rec *r))
  329. /**
  330. * This hook allow modules an opportunity to translate the URI into an
  331. * actual filename. If no modules do anything special, the server's default
  332. * rules will be followed.
  333. * @param r The current request
  334. * @return OK, DECLINED, or HTTP_...
  335. * @ingroup hooks
  336. */
  337. AP_DECLARE_HOOK(int,translate_name,(request_rec *r))
  338. /**
  339. * This hook allow modules to set the per_dir_config based on their own
  340. * context (such as "<Proxy>" sections) and responds to contextless requests
  341. * such as TRACE that need no security or filesystem mapping.
  342. * based on the filesystem.
  343. * @param r The current request
  344. * @return DONE (or HTTP_) if this contextless request was just fulfilled
  345. * (such as TRACE), OK if this is not a file, and DECLINED if this is a file.
  346. * The core map_to_storage (HOOK_RUN_REALLY_LAST) will directory_walk
  347. * and file_walk the r->filename.
  348. *
  349. * @ingroup hooks
  350. */
  351. AP_DECLARE_HOOK(int,map_to_storage,(request_rec *r))
  352. /**
  353. * This hook is used to analyze the request headers, authenticate the user,
  354. * and set the user information in the request record (r->user and
  355. * r->ap_auth_type). This hook is only run when Apache determines that
  356. * authentication/authorization is required for this resource (as determined
  357. * by the 'Require' directive). It runs after the access_checker hook, and
  358. * before the auth_checker hook. This hook should be registered with
  359. * ap_hook_check_authn().
  360. *
  361. * @param r The current request
  362. * @return OK, DECLINED, or HTTP_...
  363. * @ingroup hooks
  364. * @see ap_hook_check_authn
  365. */
  366. AP_DECLARE_HOOK(int,check_user_id,(request_rec *r))
  367. /**
  368. * Allows modules to perform module-specific fixing of header fields. This
  369. * is invoked just before any content-handler
  370. * @param r The current request
  371. * @return OK, DECLINED, or HTTP_...
  372. * @ingroup hooks
  373. */
  374. AP_DECLARE_HOOK(int,fixups,(request_rec *r))
  375. /**
  376. * This routine is called to determine and/or set the various document type
  377. * information bits, like Content-type (via r->content_type), language, et
  378. * cetera.
  379. * @param r the current request
  380. * @return OK, DECLINED, or HTTP_...
  381. * @ingroup hooks
  382. */
  383. AP_DECLARE_HOOK(int,type_checker,(request_rec *r))
  384. /**
  385. * This hook is used to apply additional access control to this resource.
  386. * It runs *before* a user is authenticated, so this hook is really to
  387. * apply additional restrictions independent of a user. It also runs
  388. * independent of 'Require' directive usage. This hook should be registered
  389. * with ap_hook_check_access().
  390. *
  391. * @param r the current request
  392. * @return OK, DECLINED, or HTTP_...
  393. * @ingroup hooks
  394. * @see ap_hook_check_access
  395. */
  396. AP_DECLARE_HOOK(int,access_checker,(request_rec *r))
  397. /**
  398. * This hook is used to apply additional access control and/or bypass
  399. * authentication for this resource. It runs *before* a user is authenticated,
  400. * but after the auth_checker hook.
  401. * This hook should be registered with ap_hook_check_access_ex().
  402. *
  403. * @param r the current request
  404. * @return OK (allow acces), DECLINED (let later modules decide),
  405. * or HTTP_... (deny access)
  406. * @ingroup hooks
  407. * @see ap_hook_check_access_ex
  408. */
  409. AP_DECLARE_HOOK(int,access_checker_ex,(request_rec *r))
  410. /**
  411. * This hook is used to check to see if the resource being requested
  412. * is available for the authenticated user (r->user and r->ap_auth_type).
  413. * It runs after the access_checker and check_user_id hooks. Note that
  414. * it will *only* be called if Apache determines that access control has
  415. * been applied to this resource (through a 'Require' directive). This
  416. * hook should be registered with ap_hook_check_authz().
  417. *
  418. * @param r the current request
  419. * @return OK, DECLINED, or HTTP_...
  420. * @ingroup hooks
  421. * @see ap_hook_check_authz
  422. */
  423. AP_DECLARE_HOOK(int,auth_checker,(request_rec *r))
  424. /**
  425. * Register a hook function that will apply additional access control to
  426. * the current request.
  427. * @param pf An access_checker hook function
  428. * @param aszPre A NULL-terminated array of strings that name modules whose
  429. * hooks should precede this one
  430. * @param aszSucc A NULL-terminated array of strings that name modules whose
  431. * hooks should succeed this one
  432. * @param nOrder An integer determining order before honouring aszPre and
  433. * aszSucc (for example, HOOK_MIDDLE)
  434. * @param type Internal request processing mode, either
  435. * AP_AUTH_INTERNAL_PER_URI or AP_AUTH_INTERNAL_PER_CONF
  436. */
  437. AP_DECLARE(void) ap_hook_check_access(ap_HOOK_access_checker_t *pf,
  438. const char * const *aszPre,
  439. const char * const *aszSucc,
  440. int nOrder, int type);
  441. /**
  442. * Register a hook function that will apply additional access control
  443. * and/or bypass authentication for the current request.
  444. * @param pf An access_checker_ex hook function
  445. * @param aszPre A NULL-terminated array of strings that name modules whose
  446. * hooks should precede this one
  447. * @param aszSucc A NULL-terminated array of strings that name modules whose
  448. * hooks should succeed this one
  449. * @param nOrder An integer determining order before honouring aszPre and
  450. * aszSucc (for example, HOOK_MIDDLE)
  451. * @param type Internal request processing mode, either
  452. * AP_AUTH_INTERNAL_PER_URI or AP_AUTH_INTERNAL_PER_CONF
  453. */
  454. AP_DECLARE(void) ap_hook_check_access_ex(ap_HOOK_access_checker_ex_t *pf,
  455. const char * const *aszPre,
  456. const char * const *aszSucc,
  457. int nOrder, int type);
  458. /**
  459. * Register a hook function that will analyze the request headers,
  460. * authenticate the user, and set the user information in the request record.
  461. * @param pf A check_user_id hook function
  462. * @param aszPre A NULL-terminated array of strings that name modules whose
  463. * hooks should precede this one
  464. * @param aszSucc A NULL-terminated array of strings that name modules whose
  465. * hooks should succeed this one
  466. * @param nOrder An integer determining order before honouring aszPre and
  467. * aszSucc (for example, HOOK_MIDDLE)
  468. * @param type Internal request processing mode, either
  469. * AP_AUTH_INTERNAL_PER_URI or AP_AUTH_INTERNAL_PER_CONF
  470. */
  471. AP_DECLARE(void) ap_hook_check_authn(ap_HOOK_check_user_id_t *pf,
  472. const char * const *aszPre,
  473. const char * const *aszSucc,
  474. int nOrder, int type);
  475. /**
  476. * Register a hook function that determine if the resource being requested
  477. * is available for the currently authenticated user.
  478. * @param pf An auth_checker hook function
  479. * @param aszPre A NULL-terminated array of strings that name modules whose
  480. * hooks should precede this one
  481. * @param aszSucc A NULL-terminated array of strings that name modules whose
  482. * hooks should succeed this one
  483. * @param nOrder An integer determining order before honouring aszPre and
  484. * aszSucc (for example, HOOK_MIDDLE)
  485. * @param type Internal request processing mode, either
  486. * AP_AUTH_INTERNAL_PER_URI or AP_AUTH_INTERNAL_PER_CONF
  487. */
  488. AP_DECLARE(void) ap_hook_check_authz(ap_HOOK_auth_checker_t *pf,
  489. const char * const *aszPre,
  490. const char * const *aszSucc,
  491. int nOrder, int type);
  492. /**
  493. * This hook allows modules to insert filters for the current request
  494. * @param r the current request
  495. * @ingroup hooks
  496. */
  497. AP_DECLARE_HOOK(void,insert_filter,(request_rec *r))
  498. /**
  499. * This hook allows modules to affect the request immediately after the
  500. * per-directory configuration for the request has been generated.
  501. * @param r The current request
  502. * @return OK (allow acces), DECLINED (let later modules decide),
  503. * or HTTP_... (deny access)
  504. * @ingroup hooks
  505. */
  506. AP_DECLARE_HOOK(int,post_perdir_config,(request_rec *r))
  507. /**
  508. * This hook allows a module to force authn to be required when
  509. * processing a request.
  510. * This hook should be registered with ap_hook_force_authn().
  511. * @param r The current request
  512. * @return OK (force authn), DECLINED (let later modules decide)
  513. * @ingroup hooks
  514. */
  515. AP_DECLARE_HOOK(int,force_authn,(request_rec *r))
  516. /**
  517. * This hook allows modules to handle/emulate the apr_stat() calls
  518. * needed for directory walk.
  519. * @param finfo where to put the stat data
  520. * @param r The current request
  521. * @param wanted APR_FINFO_* flags to pass to apr_stat()
  522. * @return apr_status_t or AP_DECLINED (let later modules decide)
  523. * @ingroup hooks
  524. */
  525. AP_DECLARE_HOOK(apr_status_t,dirwalk_stat,(apr_finfo_t *finfo, request_rec *r, apr_int32_t wanted))
  526. AP_DECLARE(int) ap_location_walk(request_rec *r);
  527. AP_DECLARE(int) ap_directory_walk(request_rec *r);
  528. AP_DECLARE(int) ap_file_walk(request_rec *r);
  529. AP_DECLARE(int) ap_if_walk(request_rec *r);
  530. /** End Of REQUEST (EOR) bucket */
  531. AP_DECLARE_DATA extern const apr_bucket_type_t ap_bucket_type_eor;
  532. /**
  533. * Determine if a bucket is an End Of REQUEST (EOR) bucket
  534. * @param e The bucket to inspect
  535. * @return true or false
  536. */
  537. #define AP_BUCKET_IS_EOR(e) (e->type == &ap_bucket_type_eor)
  538. /**
  539. * Make the bucket passed in an End Of REQUEST (EOR) bucket
  540. * @param b The bucket to make into an EOR bucket
  541. * @param r The request to destroy when this bucket is destroyed
  542. * @return The new bucket, or NULL if allocation failed
  543. */
  544. AP_DECLARE(apr_bucket *) ap_bucket_eor_make(apr_bucket *b, request_rec *r);
  545. /**
  546. * Create a bucket referring to an End Of REQUEST (EOR). This bucket
  547. * holds a pointer to the request_rec, so that the request can be
  548. * destroyed right after all of the output has been sent to the client.
  549. *
  550. * @param list The freelist from which this bucket should be allocated
  551. * @param r The request to destroy when this bucket is destroyed
  552. * @return The new bucket, or NULL if allocation failed
  553. */
  554. AP_DECLARE(apr_bucket *) ap_bucket_eor_create(apr_bucket_alloc_t *list,
  555. request_rec *r);
  556. /**
  557. * Can be used within any handler to determine if any authentication
  558. * is required for the current request. Note that if used with an
  559. * access_checker hook, an access_checker_ex hook or an authz provider; the
  560. * caller should take steps to avoid a loop since this function is
  561. * implemented by calling these hooks.
  562. * @param r The current request
  563. * @return TRUE if authentication is required, FALSE otherwise
  564. */
  565. AP_DECLARE(int) ap_some_authn_required(request_rec *r);
  566. #ifdef __cplusplus
  567. }
  568. #endif
  569. #endif /* !APACHE_HTTP_REQUEST_H */
  570. /** @} */