⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 mod_proxy.h

📁 Apache官方在今天放出产品系列2.2的最新版本2.2.11的源码包 最流行的HTTP服务器软件之一
💻 H
📖 第 1 页 / 共 3 页
字号:
/* worker status flags */#define PROXY_WORKER_INITIALIZED    0x0001#define PROXY_WORKER_IGNORE_ERRORS  0x0002#define PROXY_WORKER_IN_SHUTDOWN    0x0010#define PROXY_WORKER_DISABLED       0x0020#define PROXY_WORKER_STOPPED        0x0040#define PROXY_WORKER_IN_ERROR       0x0080#define PROXY_WORKER_HOT_STANDBY    0x0100#define PROXY_WORKER_NOT_USABLE_BITMAP ( PROXY_WORKER_IN_SHUTDOWN | \PROXY_WORKER_DISABLED | PROXY_WORKER_STOPPED | PROXY_WORKER_IN_ERROR )/* NOTE: these check the shared status */#define PROXY_WORKER_IS_INITIALIZED(f)   ( (f)->s && \  ( (f)->s->status &  PROXY_WORKER_INITIALIZED ) )#define PROXY_WORKER_IS_STANDBY(f)   ( (f)->s && \  ( (f)->s->status &  PROXY_WORKER_HOT_STANDBY ) )#define PROXY_WORKER_IS_USABLE(f)   ( (f)->s && \  ( !( (f)->s->status & PROXY_WORKER_NOT_USABLE_BITMAP) ) && \  PROXY_WORKER_IS_INITIALIZED(f) )/* default worker retry timeout in seconds */#define PROXY_WORKER_DEFAULT_RETRY  60#define PROXY_WORKER_MAX_ROUTE_SIZ  63/* Runtime worker status informations. Shared in scoreboard */typedef struct {    int             status;    apr_time_t      error_time; /* time of the last error */    int             retries;    /* number of retries on this worker */    int             lbstatus;   /* Current lbstatus */    int             lbfactor;   /* dynamic lbfactor */    apr_off_t       transferred;/* Number of bytes transferred to remote */    apr_off_t       read;       /* Number of bytes read from remote */    apr_size_t      elected;    /* Number of times the worker was elected */    char            route[PROXY_WORKER_MAX_ROUTE_SIZ+1];    char            redirect[PROXY_WORKER_MAX_ROUTE_SIZ+1];    void            *context;   /* general purpose storage */    apr_size_t      busy;       /* busyness factor */    int             lbset;      /* load balancer cluster set */} proxy_worker_stat;/* Worker configuration */struct proxy_worker {    int             id;         /* scoreboard id */    apr_interval_time_t retry;  /* retry interval */    int             lbfactor;   /* initial load balancing factor */    const char      *name;    const char      *scheme;    /* scheme to use ajp|http|https */    const char      *hostname;  /* remote backend address */    const char      *route;     /* balancing route */    const char      *redirect;  /* temporary balancing redirection route */    int             status;     /* temporary worker status */    apr_port_t      port;    int             min;        /* Desired minimum number of available connections */    int             smax;       /* Soft maximum on the total number of connections */    int             hmax;       /* Hard maximum on the total number of connections */    apr_interval_time_t ttl;    /* maximum amount of time in seconds a connection                                 * may be available while exceeding the soft limit */    apr_interval_time_t timeout; /* connection timeout */    char            timeout_set;    apr_interval_time_t acquire; /* acquire timeout when the maximum number of connections is exceeded */    char            acquire_set;    apr_size_t      recv_buffer_size;    char            recv_buffer_size_set;    apr_size_t      io_buffer_size;    char            io_buffer_size_set;    char            keepalive;    char            keepalive_set;    proxy_conn_pool     *cp;        /* Connection pool to use */    proxy_worker_stat   *s;         /* Shared data */    void            *opaque;    /* per scheme worker data */    int             is_address_reusable;#if APR_HAS_THREADS    apr_thread_mutex_t  *mutex;  /* Thread lock for updating address cache */#endif    void            *context;   /* general purpose storage */    enum {         flush_off,         flush_on,         flush_auto    } flush_packets;           /* control AJP flushing */    int             flush_wait;  /* poll wait time in microseconds if flush_auto */    int             lbset;      /* load balancer cluster set */    apr_interval_time_t ping_timeout;    char ping_timeout_set;    char            retry_set;    char            disablereuse;    char            disablereuse_set;    apr_interval_time_t conn_timeout;    char            conn_timeout_set;};/* * Wait 10000 microseconds to find out if more data is currently * available at the backend. Just an arbitrary choose. */#define PROXY_FLUSH_WAIT 10000struct proxy_balancer {    apr_array_header_t *workers; /* array of proxy_workers */    const char *name;            /* name of the load balancer */    const char *sticky;          /* sticky session identifier */    int         sticky_force;    /* Disable failover for sticky sessions */    apr_interval_time_t timeout; /* Timeout for waiting on free connection */    int                 max_attempts; /* Number of attempts before failing */    char                max_attempts_set;    proxy_balancer_method *lbmethod;    /* XXX: Perhaps we will need the proc mutex too.     * Altrough we are only using arithmetic operations     * it may lead to a incorrect calculations.     * For now use only the thread mutex.     */#if APR_HAS_THREADS    apr_thread_mutex_t  *mutex;  /* Thread lock for updating lb params */#endif    void            *context;   /* general purpose storage */    int             scolonsep;  /* true if ';' seps sticky session paths */};struct proxy_balancer_method {    const char *name;            /* name of the load balancer method*/    proxy_worker *(*finder)(proxy_balancer *balancer,                            request_rec *r);    void            *context;   /* general purpose storage */};#if APR_HAS_THREADS#define PROXY_THREAD_LOCK(x)      apr_thread_mutex_lock((x)->mutex)#define PROXY_THREAD_UNLOCK(x)    apr_thread_mutex_unlock((x)->mutex)#else#define PROXY_THREAD_LOCK(x)      APR_SUCCESS#define PROXY_THREAD_UNLOCK(x)    APR_SUCCESS#endif/* hooks *//* Create a set of PROXY_DECLARE(type), PROXY_DECLARE_NONSTD(type) and  * PROXY_DECLARE_DATA with appropriate export and import tags for the platform */#if !defined(WIN32)#define PROXY_DECLARE(type)            type#define PROXY_DECLARE_NONSTD(type)     type#define PROXY_DECLARE_DATA#elif defined(PROXY_DECLARE_STATIC)#define PROXY_DECLARE(type)            type __stdcall#define PROXY_DECLARE_NONSTD(type)     type#define PROXY_DECLARE_DATA#elif defined(PROXY_DECLARE_EXPORT)#define PROXY_DECLARE(type)            __declspec(dllexport) type __stdcall#define PROXY_DECLARE_NONSTD(type)     __declspec(dllexport) type#define PROXY_DECLARE_DATA             __declspec(dllexport)#else#define PROXY_DECLARE(type)            __declspec(dllimport) type __stdcall#define PROXY_DECLARE_NONSTD(type)     __declspec(dllimport) type#define PROXY_DECLARE_DATA             __declspec(dllimport)#endif/** * Hook an optional proxy hook.  Unlike static hooks, this uses a macro * instead of a function. */#define PROXY_OPTIONAL_HOOK(name,fn,pre,succ,order) \        APR_OPTIONAL_HOOK(proxy,name,fn,pre,succ,order)APR_DECLARE_EXTERNAL_HOOK(proxy, PROXY, int, scheme_handler, (request_rec *r,                           proxy_worker *worker, proxy_server_conf *conf, char *url,                           const char *proxyhost, apr_port_t proxyport))APR_DECLARE_EXTERNAL_HOOK(proxy, PROXY, int, canon_handler, (request_rec *r,                           char *url))APR_DECLARE_EXTERNAL_HOOK(proxy, PROXY, int, create_req, (request_rec *r, request_rec *pr))APR_DECLARE_EXTERNAL_HOOK(proxy, PROXY, int, fixups, (request_rec *r)) /** * pre request hook. * It will return the most suitable worker at the moment * and coresponding balancer. * The url is rewritten from balancer://cluster/uri to scheme://host:port/uri * and then the scheme_handler is called. * */APR_DECLARE_EXTERNAL_HOOK(proxy, PROXY, int, pre_request, (proxy_worker **worker,                          proxy_balancer **balancer,                          request_rec *r,                          proxy_server_conf *conf, char **url))                          /** * post request hook. * It is called after request for updating runtime balancer status. */APR_DECLARE_EXTERNAL_HOOK(proxy, PROXY, int, post_request, (proxy_worker *worker,                          proxy_balancer *balancer, request_rec *r,                          proxy_server_conf *conf))/** * request status hook * It is called after all proxy processing has been done.  This gives other * modules a chance to create default content on failure, for example */APR_DECLARE_EXTERNAL_HOOK(proxy, PROXY, int, request_status,                          (int *status, request_rec *r))/* proxy_util.c */PROXY_DECLARE(request_rec *)ap_proxy_make_fake_req(conn_rec *c, request_rec *r);PROXY_DECLARE(int) ap_proxy_hex2c(const char *x);PROXY_DECLARE(void) ap_proxy_c2hex(int ch, char *x);PROXY_DECLARE(char *)ap_proxy_canonenc(apr_pool_t *p, const char *x, int len, enum enctype t,                                       int forcedec, int proxyreq);PROXY_DECLARE(char *)ap_proxy_canon_netloc(apr_pool_t *p, char **const urlp, char **userp,                                           char **passwordp, char **hostp, apr_port_t *port);PROXY_DECLARE(const char *)ap_proxy_date_canon(apr_pool_t *p, const char *x);PROXY_DECLARE(int) ap_proxy_liststr(const char *list, const char *val);PROXY_DECLARE(char *)ap_proxy_removestr(apr_pool_t *pool, const char *list, const char *val);PROXY_DECLARE(int) ap_proxy_hex2sec(const char *x);PROXY_DECLARE(void) ap_proxy_sec2hex(int t, char *y);PROXY_DECLARE(int) ap_proxyerror(request_rec *r, int statuscode, const char *message);PROXY_DECLARE(int) ap_proxy_is_ipaddr(struct dirconn_entry *This, apr_pool_t *p);PROXY_DECLARE(int) ap_proxy_is_domainname(struct dirconn_entry *This, apr_pool_t *p);PROXY_DECLARE(int) ap_proxy_is_hostname(struct dirconn_entry *This, apr_pool_t *p);PROXY_DECLARE(int) ap_proxy_is_word(struct dirconn_entry *This, apr_pool_t *p);PROXY_DECLARE(int) ap_proxy_checkproxyblock(request_rec *r, proxy_server_conf *conf, apr_sockaddr_t *uri_addr);PROXY_DECLARE(int) ap_proxy_pre_http_request(conn_rec *c, request_rec *r);PROXY_DECLARE(apr_status_t) ap_proxy_string_read(conn_rec *c, apr_bucket_brigade *bb, char *buff, size_t bufflen, int *eos);PROXY_DECLARE(void) ap_proxy_table_unmerge(apr_pool_t *p, apr_table_t *t, char *key);/* DEPRECATED (will be replaced with ap_proxy_connect_backend */PROXY_DECLARE(int) ap_proxy_connect_to_backend(apr_socket_t **, const char *, apr_sockaddr_t *, const char *, proxy_server_conf *, server_rec *, apr_pool_t *);PROXY_DECLARE(apr_status_t) ap_proxy_ssl_connection_cleanup(proxy_conn_rec *conn,                                                            request_rec *r);PROXY_DECLARE(int) ap_proxy_ssl_enable(conn_rec *c);PROXY_DECLARE(int) ap_proxy_ssl_disable(conn_rec *c);PROXY_DECLARE(int) ap_proxy_conn_is_https(conn_rec *c);PROXY_DECLARE(const char *) ap_proxy_ssl_val(apr_pool_t *p, server_rec *s, conn_rec *c, request_rec *r, const char *var);/* Header mapping functions, and a typedef of their signature */PROXY_DECLARE(const char *) ap_proxy_location_reverse_map(request_rec *r, proxy_dir_conf *conf, const char *url);PROXY_DECLARE(const char *) ap_proxy_cookie_reverse_map(request_rec *r, proxy_dir_conf *conf, const char *str);#if !defined(WIN32)typedef const char *(*ap_proxy_header_reverse_map_fn)(request_rec *,                       proxy_dir_conf *, const char *);#elif defined(PROXY_DECLARE_STATIC)typedef const char *(__stdcall *ap_proxy_header_reverse_map_fn)(request_rec *,                                 proxy_dir_conf *, const char *);#elif defined(PROXY_DECLARE_EXPORT)typedef __declspec(dllexport) const char *  (__stdcall *ap_proxy_header_reverse_map_fn)(request_rec *,               proxy_dir_conf *, const char *);#elsetypedef __declspec(dllimport) const char *  (__stdcall *ap_proxy_header_reverse_map_fn)(request_rec *,               proxy_dir_conf *, const char *);#endif/* Connection pool API *//** * Get the worker from proxy configuration * @param p     memory pool used for finding worker * @param conf  current proxy server configuration * @param url   url to find the worker from

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -