📄 httpd.h
字号:
#ifndef AP_MODULE_DECLARE
# define AP_MODULE_DECLARE(type) type
#endif
#ifndef AP_MODULE_DECLARE_NONSTD
# define AP_MODULE_DECLARE_NONSTD(type) type
#endif
#ifndef AP_MODULE_DECLARE_DATA
# define AP_MODULE_DECLARE_DATA
#endif
/**
* @internal
* modules should not used functions marked AP_CORE_DECLARE
*/
#ifndef AP_CORE_DECLARE
# define AP_CORE_DECLARE AP_DECLARE
#endif
/**
* @internal
* modules should not used functions marked AP_CORE_DECLARE_NONSTD
*/
#ifndef AP_CORE_DECLARE_NONSTD
# define AP_CORE_DECLARE_NONSTD AP_DECLARE_NONSTD
#endif
/**
* The numeric version information is broken out into fields within this
* structure.
*/
typedef struct {
int major; /**< major number */
int minor; /**< minor number */
int patch; /**< patch number */
const char *add_string; /**< additional string like "-dev" */
} ap_version_t;
/**
* Return httpd's version information in a numeric form.
*
* @param version Pointer to a version structure for returning the version
* information.
*/
AP_DECLARE(void) ap_get_server_revision(ap_version_t *version);
/**
* Get the server version string
* @return The server version string
*/
AP_DECLARE(const char *) ap_get_server_version(void);
/**
* Add a component to the version string
* @param pconf The pool to allocate the component from
* @param component The string to add
*/
AP_DECLARE(void) ap_add_version_component(apr_pool_t *pconf, const char *component);
/**
* Get the date a time that the server was built
* @return The server build time string
*/
AP_DECLARE(const char *) ap_get_server_built(void);
#define DECLINED -1 /**< Module declines to handle */
#define DONE -2 /**< Module has served the response completely
* - it's safe to die() with no more output
*/
#define OK 0 /**< Module has handled this stage. */
/**
* @defgroup HTTP_Status HTTP Status Codes
* @{
*/
/**
* The size of the static array in http_protocol.c for storing
* all of the potential response status-lines (a sparse table).
* A future version should dynamically generate the apr_table_t at startup.
*/
#define RESPONSE_CODES 57
#define HTTP_CONTINUE 100
#define HTTP_SWITCHING_PROTOCOLS 101
#define HTTP_PROCESSING 102
#define HTTP_OK 200
#define HTTP_CREATED 201
#define HTTP_ACCEPTED 202
#define HTTP_NON_AUTHORITATIVE 203
#define HTTP_NO_CONTENT 204
#define HTTP_RESET_CONTENT 205
#define HTTP_PARTIAL_CONTENT 206
#define HTTP_MULTI_STATUS 207
#define HTTP_MULTIPLE_CHOICES 300
#define HTTP_MOVED_PERMANENTLY 301
#define HTTP_MOVED_TEMPORARILY 302
#define HTTP_SEE_OTHER 303
#define HTTP_NOT_MODIFIED 304
#define HTTP_USE_PROXY 305
#define HTTP_TEMPORARY_REDIRECT 307
#define HTTP_BAD_REQUEST 400
#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;
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -