?? http_request.h
字號:
/* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#ifndef APACHE_HTTP_REQUEST_H
#define APACHE_HTTP_REQUEST_H
#include "apr_hooks.h"
#include "util_filter.h"
#ifdef __cplusplus
extern "C" {
#endif
#define AP_SUBREQ_NO_ARGS 0
#define AP_SUBREQ_MERGE_ARGS 1
/**
* @file http_request.h
* @brief Apache Request library
*/
/* http_request.c is the code which handles the main line of request
* processing, once a request has been read in (finding the right per-
* directory configuration, building it if necessary, and calling all
* the module dispatch functions in the right order).
*
* The pieces here which are public to the modules, allow them to learn
* how the server would handle some other file or URI, or perhaps even
* direct the server to serve that other file instead of the one the
* client requested directly.
*
* There are two ways to do that. The first is the sub_request mechanism,
* which handles looking up files and URIs as adjuncts to some other
* request (e.g., directory entries for multiviews and directory listings);
* the lookup functions stop short of actually running the request, but
* (e.g., for includes), a module may call for the request to be run
* by calling run_sub_req. The space allocated to create sub_reqs can be
* reclaimed by calling destroy_sub_req --- be sure to copy anything you care
* about which was allocated in its apr_pool_t elsewhere before doing this.
*/
/**
* An internal handler used by the ap_process_request, all subrequest mechanisms
* and the redirect mechanism.
* @param r The request, subrequest or internal redirect to pre-process
* @return The return code for the request
*/
AP_DECLARE(int) ap_process_request_internal(request_rec *r);
/**
* Create a subrequest from the given URI. This subrequest can be
* inspected to find information about the requested URI
* @param new_uri The URI to lookup
* @param r The current request
* @param next_filter The first filter the sub_request should use. If this is
* NULL, it defaults to the first filter for the main request
* @return The new request record
* @deffunc request_rec * ap_sub_req_lookup_uri(const char *new_uri, const request_rec *r)
*/
AP_DECLARE(request_rec *) ap_sub_req_lookup_uri(const char *new_uri,
const request_rec *r,
ap_filter_t *next_filter);
/**
* Create a subrequest for the given file. This subrequest can be
* inspected to find information about the requested file
* @param new_file The file to lookup
* @param r The current request
* @param next_filter The first filter the sub_request should use. If this is
* NULL, it defaults to the first filter for the main request
* @return The new request record
* @deffunc request_rec * ap_sub_req_lookup_file(const char *new_file, const request_rec *r)
*/
AP_DECLARE(request_rec *) ap_sub_req_lookup_file(const char *new_file,
const request_rec *r,
ap_filter_t *next_filter);
/**
* Create a subrequest for the given apr_dir_read result. This subrequest
* can be inspected to find information about the requested file
* @param finfo The apr_dir_read result to lookup
* @param r The current request
* @param subtype What type of subrequest to perform, one of;
* <PRE>
* AP_SUBREQ_NO_ARGS ignore r->args and r->path_info
* AP_SUBREQ_MERGE_ARGS merge r->args and r->path_info
* </PRE>
* @param next_filter The first filter the sub_request should use. If this is
* NULL, it defaults to the first filter for the main request
* @return The new request record
* @deffunc request_rec * ap_sub_req_lookup_dirent(apr_finfo_t *finfo, int subtype, const request_rec *r)
* @tip The apr_dir_read flags value APR_FINFO_MIN|APR_FINFO_NAME flag is the
* minimum recommended query if the results will be passed to apr_dir_read.
* The file info passed must include the name, and must have the same relative
* directory as the current request.
*/
AP_DECLARE(request_rec *) ap_sub_req_lookup_dirent(const apr_finfo_t *finfo,
const request_rec *r,
int subtype,
ap_filter_t *next_filter);
/**
* Create a subrequest for the given URI using a specific method. This
* subrequest can be inspected to find information about the requested URI
* @param method The method to use in the new subrequest
* @param new_uri The URI to lookup
* @param r The current request
* @param next_filter The first filter the sub_request should use. If this is
* NULL, it defaults to the first filter for the main request
* @return The new request record
* @deffunc request_rec * ap_sub_req_method_uri(const char *method, const char *new_uri, const request_rec *r)
*/
AP_DECLARE(request_rec *) ap_sub_req_method_uri(const char *method,
const char *new_uri,
const request_rec *r,
ap_filter_t *next_filter);
/**
* An output filter to strip EOS buckets from sub-requests. This always
* has to be inserted at the end of a sub-requests filter stack.
* @param f The current filter
* @param bb The brigade to filter
* @deffunc apr_status_t ap_sub_req_output_filter(ap_filter_t *f, apr_bucket_brigade *bb)
*/
AP_CORE_DECLARE_NONSTD(apr_status_t) ap_sub_req_output_filter(ap_filter_t *f,
apr_bucket_brigade *bb);
/**
* Run the handler for the subrequest
* @param r The subrequest to run
* @return The return code for the subrequest
* @deffunc int ap_run_sub_req(request_rec *r)
*/
AP_DECLARE(int) ap_run_sub_req(request_rec *r);
/**
* Free the memory associated with a subrequest
* @param r The subrequest to finish
* @deffunc void ap_destroy_sub_req(request_rec *r)
*/
AP_DECLARE(void) ap_destroy_sub_req(request_rec *r);
/*
* Then there's the case that you want some other request to be served
* as the top-level request INSTEAD of what the client requested directly.
* If so, call this from a handler, and then immediately return OK.
*/
/**
* Redirect the current request to some other uri
* @param new_uri The URI to replace the current request with
* @param r The current request
* @deffunc void ap_internal_redirect(const char *new_uri, request_rec *r)
*/
AP_DECLARE(void) ap_internal_redirect(const char *new_uri, request_rec *r);
/**
* This function is designed for things like actions or CGI scripts, when
* using AddHandler, and you want to preserve the content type across
* an internal redirect.
* @param new_uri The URI to replace the current request with.
* @param r The current request
* @deffunc void ap_internal_redirect_handler(const char *new_uri, request_rec *r)
*/
AP_DECLARE(void) ap_internal_redirect_handler(const char *new_uri, request_rec *r);
/**
* Redirect the current request to a sub_req, merging the pools
* @param sub_req A subrequest created from this request
* @param r The current request
* @deffunc void ap_internal_fast_redirect(request_rec *sub_req, request_rec *r)
* @tip the sub_req's pool will be merged into r's pool, be very careful
* not to destroy this subrequest, it will be destroyed with the main request!
*/
AP_DECLARE(void) ap_internal_fast_redirect(request_rec *sub_req, request_rec *r);
/**
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -