📄 httpd.h
字号:
#define HTTP_UNAUTHORIZED 401#define HTTP_PAYMENT_REQUIRED 402#define HTTP_FORBIDDEN 403#define HTTP_NOT_FOUND 404#define HTTP_METHOD_NOT_ALLOWED 405#define HTTP_NOT_ACCEPTABLE 406#define HTTP_PROXY_AUTHENTICATION_REQUIRED 407#define HTTP_REQUEST_TIME_OUT 408#define HTTP_CONFLICT 409#define HTTP_GONE 410#define HTTP_LENGTH_REQUIRED 411#define HTTP_PRECONDITION_FAILED 412#define HTTP_REQUEST_ENTITY_TOO_LARGE 413#define HTTP_REQUEST_URI_TOO_LARGE 414#define HTTP_UNSUPPORTED_MEDIA_TYPE 415#define HTTP_RANGE_NOT_SATISFIABLE 416#define HTTP_EXPECTATION_FAILED 417#define HTTP_UNPROCESSABLE_ENTITY 422#define HTTP_LOCKED 423#define HTTP_FAILED_DEPENDENCY 424#define HTTP_UPGRADE_REQUIRED 426#define HTTP_INTERNAL_SERVER_ERROR 500#define HTTP_NOT_IMPLEMENTED 501#define HTTP_BAD_GATEWAY 502#define HTTP_SERVICE_UNAVAILABLE 503#define HTTP_GATEWAY_TIME_OUT 504#define HTTP_VERSION_NOT_SUPPORTED 505#define HTTP_VARIANT_ALSO_VARIES 506#define HTTP_INSUFFICIENT_STORAGE 507#define HTTP_NOT_EXTENDED 510/** is the status code informational */#define ap_is_HTTP_INFO(x) (((x) >= 100)&&((x) < 200))/** is the status code OK ?*/#define ap_is_HTTP_SUCCESS(x) (((x) >= 200)&&((x) < 300))/** is the status code a redirect */#define ap_is_HTTP_REDIRECT(x) (((x) >= 300)&&((x) < 400))/** is the status code a error (client or server) */#define ap_is_HTTP_ERROR(x) (((x) >= 400)&&((x) < 600))/** is the status code a client error */#define ap_is_HTTP_CLIENT_ERROR(x) (((x) >= 400)&&((x) < 500))/** is the status code a server error */#define ap_is_HTTP_SERVER_ERROR(x) (((x) >= 500)&&((x) < 600))/** should the status code drop the connection */#define ap_status_drops_connection(x) \ (((x) == HTTP_BAD_REQUEST) || \ ((x) == HTTP_REQUEST_TIME_OUT) || \ ((x) == HTTP_LENGTH_REQUIRED) || \ ((x) == HTTP_REQUEST_ENTITY_TOO_LARGE) || \ ((x) == HTTP_REQUEST_URI_TOO_LARGE) || \ ((x) == HTTP_INTERNAL_SERVER_ERROR) || \ ((x) == HTTP_SERVICE_UNAVAILABLE) || \ ((x) == HTTP_NOT_IMPLEMENTED))/** @} *//** * @defgroup Methods List of Methods recognized by the server * @{ *//** * Methods recognized (but not necessarily handled) by the server. * These constants are used in bit shifting masks of size int, so it is * unsafe to have more methods than bits in an int. HEAD == M_GET. * This list must be tracked by the list in http_protocol.c in routine * ap_method_name_of(). */#define M_GET 0 /* RFC 2616: HTTP */#define M_PUT 1 /* : */#define M_POST 2#define M_DELETE 3#define M_CONNECT 4#define M_OPTIONS 5#define M_TRACE 6 /* RFC 2616: HTTP */#define M_PATCH 7 /* no rfc(!) ### remove this one? */#define M_PROPFIND 8 /* RFC 2518: WebDAV */#define M_PROPPATCH 9 /* : */#define M_MKCOL 10#define M_COPY 11#define M_MOVE 12#define M_LOCK 13#define M_UNLOCK 14 /* RFC 2518: WebDAV */#define M_VERSION_CONTROL 15 /* RFC 3253: WebDAV Versioning */#define M_CHECKOUT 16 /* : */#define M_UNCHECKOUT 17#define M_CHECKIN 18#define M_UPDATE 19#define M_LABEL 20#define M_REPORT 21#define M_MKWORKSPACE 22#define M_MKACTIVITY 23#define M_BASELINE_CONTROL 24#define M_MERGE 25#define M_INVALID 26 /* RFC 3253: WebDAV Versioning *//** * METHODS needs to be equal to the number of bits * we are using for limit masks. */#define METHODS 64/** * The method mask bit to shift for anding with a bitmask. */#define AP_METHOD_BIT ((apr_int64_t)1)/** @} *//** * Structure for handling HTTP methods. Methods known to the server are * accessed via a bitmask shortcut; extension methods are handled by * an array. */typedef struct ap_method_list_t ap_method_list_t;struct ap_method_list_t { /* The bitmask used for known methods */ apr_int64_t method_mask; /* the array used for extension methods */ apr_array_header_t *method_list;};/** * @defgroup module_magic Module Magic mime types * @{ *//** Magic for mod_cgi[d] */#define CGI_MAGIC_TYPE "application/x-httpd-cgi"/** Magic for mod_include */#define INCLUDES_MAGIC_TYPE "text/x-server-parsed-html"/** Magic for mod_include */#define INCLUDES_MAGIC_TYPE3 "text/x-server-parsed-html3"/** Magic for mod_dir */#define DIR_MAGIC_TYPE "httpd/unix-directory"/** @} *//* Just in case your linefeed isn't the one the other end is expecting. */#if !APR_CHARSET_EBCDIC/** linefeed */#define LF 10/** carrige return */#define CR 13/** carrige return /Line Feed Combo */#define CRLF "\015\012"#else /* APR_CHARSET_EBCDIC *//* For platforms using the EBCDIC charset, the transition ASCII->EBCDIC is done * in the buff package (bread/bputs/bwrite). Everywhere else, we use * "native EBCDIC" CR and NL characters. These are therefore * defined as * '\r' and '\n'. */#define CR '\r'#define LF '\n'#define CRLF "\r\n"#endif /* APR_CHARSET_EBCDIC */ /** * @defgroup values_request_rec_body Possible values for request_rec.read_body * @{ * Possible values for request_rec.read_body (set by handling module): *//** Send 413 error if message has any body */#define REQUEST_NO_BODY 0/** Send 411 error if body without Content-Length */#define REQUEST_CHUNKED_ERROR 1/** If chunked, remove the chunks for me. */#define REQUEST_CHUNKED_DECHUNK 2/** @} *//** * @defgroup values_request_rec_used_path_info Possible values for request_rec.used_path_info * @{ * Possible values for request_rec.used_path_info: *//** Accept the path_info from the request */#define AP_REQ_ACCEPT_PATH_INFO 0/** Return a 404 error if path_info was given */#define AP_REQ_REJECT_PATH_INFO 1/** Module may chose to use the given path_info */#define AP_REQ_DEFAULT_PATH_INFO 2/** @} *//* * Things which may vary per file-lookup WITHIN a request --- * e.g., state of MIME config. Basically, the name of an object, info * about the object, and any other info we may ahve which may need to * change as we go poking around looking for it (e.g., overridden by * .htaccess files). * * Note how the default state of almost all these things is properly * zero, so that allocating it with pcalloc does the right thing without * a whole lot of hairy initialization... so long as we are willing to * make the (fairly) portable assumption that the bit pattern of a NULL * pointer is, in fact, zero. *//** * This represents the result of calling htaccess; these are cached for * each request. */struct htaccess_result { /** the directory to which this applies */ const char *dir; /** the overrides allowed for the .htaccess file */ int override; /** the configuration directives */ struct ap_conf_vector_t *htaccess; /** the next one, or NULL if no more; N.B. never change this */ const struct htaccess_result *next;};/* The following four types define a hierarchy of activities, so that * given a request_rec r you can write r->connection->server->process * to get to the process_rec. While this reduces substantially the * number of arguments that various hooks require beware that in * threaded versions of the server you must consider multiplexing * issues. *//** A structure that represents one process */typedef struct process_rec process_rec;/** A structure that represents a virtual server */typedef struct server_rec server_rec;/** A structure that represents one connection */typedef struct conn_rec conn_rec;/** A structure that represents the current request */typedef struct request_rec request_rec;/* ### would be nice to not include this from httpd.h ... *//* This comes after we have defined the request_rec type */#include "apr_uri.h"/** A structure that represents one process */struct process_rec { /** Global pool. Cleared upon normal exit */ apr_pool_t *pool; /** Configuration pool. Cleared upon restart */ apr_pool_t *pconf; /** Number of command line arguments passed to the program */ int argc; /** The command line arguments */ const char * const *argv; /** The program name used to execute the program */ const char *short_name;};/** A structure that represents the current request */struct request_rec { /** The pool associated with the request */ apr_pool_t *pool; /** The connection to the client */ conn_rec *connection; /** The virtual host for this request */ server_rec *server; /** Pointer to the redirected request if this is an external redirect */ request_rec *next; /** Pointer to the previous request if this is an internal redirect */ request_rec *prev; /** Pointer to the main request if this is a sub-request * (see http_request.h) */ request_rec *main; /* Info about the request itself... we begin with stuff that only * protocol.c should ever touch... */ /** First line of request */ char *the_request; /** HTTP/0.9, "simple" request (e.g. GET /foo\n w/no headers) */ int assbackwards; /** A proxy request (calculated during post_read_request/translate_name) * possible values PROXYREQ_NONE, PROXYREQ_PROXY, PROXYREQ_REVERSE, * PROXYREQ_RESPONSE */ int proxyreq; /** HEAD request, as opposed to GET */ int header_only; /** Protocol string, as given to us, or HTTP/0.9 */ char *protocol; /** Protocol version number of protocol; 1.1 = 1001 */ int proto_num; /** Host, as set by full URI or Host: */ const char *hostname; /** Time when the request started */ apr_time_t request_time; /** Status line, if set by script */ const char *status_line; /** Status line */ int status; /* Request method, two ways; also, protocol, etc.. Outside of protocol.c, * look, but don't touch. */ /** Request method (eg. GET, HEAD, POST, etc.) */ const char *method; /** M_GET, M_POST, etc. */ int method_number; /** * 'allowed' is a bitvector of the allowed methods. * * A handler must ensure that the request method is one that * it is capable of handling. Generally modules should DECLINE * any request methods they do not handle. Prior to aborting the * handler like this the handler should set r->allowed to the list * of methods that it is willing to handle. This bitvector is used * to construct the "Allow:" header required for OPTIONS requests, * and HTTP_METHOD_NOT_ALLOWED and HTTP_NOT_IMPLEMENTED status codes. * * Since the default_handler deals with OPTIONS, all modules can * usually decline to deal with OPTIONS. TRACE is always allowed, * modules don't need to set it explicitly. * * Since the default_handler will always handle a GET, a * module which does *not* implement GET should probably return * HTTP_METHOD_NOT_ALLOWED. Unfortunately this means that a Script GET * handler can't be installed by mod_actions. */ apr_int64_t allowed; /** Array of extension methods */ apr_array_header_t *allowed_xmethods; /** List of allowed methods */ ap_method_list_t *allowed_methods; /** byte count in stream is for body */ apr_off_t sent_bodyct; /** body byte count, for easy access */ apr_off_t bytes_sent; /** Last modified time of the requested resource */ apr_time_t mtime; /* HTTP/1.1 connection-level features */ /** sending chunked transfer-coding */ int chunked; /** The Range: header */ const char *range; /** The "real" content length */ apr_off_t clength; /** Remaining bytes left to read from the request body */ apr_off_t remaining; /** Number of bytes that have been read from the request body */ apr_off_t read_length; /** Method for reading the request body * (eg. REQUEST_CHUNKED_ERROR, REQUEST_NO_BODY, * REQUEST_CHUNKED_DECHUNK, etc...) */ int read_body; /** reading chunked transfer-coding */ int read_chunked; /** is client waiting for a 100 response? */ unsigned expecting_100; /* MIME header environments, in and out. Also, an array containing * environment variables to be passed to subprocesses, so people can * write modules to add to that environment. * * The difference between headers_out and err_headers_out is that the * latter are printed even on error, and persist across internal redirects * (so the headers printed for ErrorDocument handlers will have them). * * The 'notes' apr_table_t is for notes from one module to another, with no * other set purpose in mind... */ /** MIME header environment from the request */ apr_table_t *headers_in; /** MIME header environment for the response */ apr_table_t *headers_out; /** MIME header environment for the response, printed even on errors and * persist across internal redirects */ apr_table_t *err_headers_out; /** Array of environment variables to be used for sub processes */ apr_table_t *subprocess_env; /** Notes from one module to another */ apr_table_t *notes; /* content_type, handler, content_encoding, and all content_languages * MUST be lowercased strings. They may be pointers to static strings; * they should not be modified in place. */ /** The content-type for the current request */ const char *content_type; /* Break these out --- we dispatch on 'em */ /** The handler string that we use to call a handler function */ const char *handler; /* What we *really* dispatch on */ /** How to encode the data */ const char *content_encoding; /** Array of strings representing the content languages */ apr_array_header_t *content_languages; /** variant list validator (if negotiated) */ char *vlist_validator; /** If an authentication check was made, this gets set to the user name. */ char *user; /** If an authentication check was made, this gets set to the auth type. */ char *ap_auth_type; /** This response can not be cached */ int no_cache; /** There is no local copy of this response */ int no_local_copy; /* What object is being requested (either directly, or via include * or content-negotiation mapping). */ /** The URI without any parsing performed */ char *unparsed_uri; /** The path portion of the URI */ char *uri; /** The filename on disk corresponding to this response */ char *filename; /* XXX: What does this mean? Please define "canonicalize" -aaron */ /** The true filename, we canonicalize r->filename if these don't match */ char *canonical_filename; /** The PATH_INFO extracted from this request */ char *path_info; /** The QUERY_ARGS extracted from this request */ char *args; /** finfo.protection (st_mode) set to zero if no such file */ apr_finfo_t finfo; /** A struct containing the components of URI */ apr_uri_t parsed_uri; /** * Flag for the handler to accept or reject path_info on * the current request. All modules should respect the * AP_REQ_ACCEPT_PATH_INFO and AP_REQ_REJECT_PATH_INFO * values, while AP_REQ_DEFAULT_PATH_INFO indicates they * may follow existing conventions. This is set to the * user's preference upon HOOK_VERY_FIRST of the fixups.
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -