mod_proxy.h revision 7f4a72152dcbb1b8fcedf85113ac18806a807627
e76d78338026fa47dca32eaf7f5c15eabb1b951aJan Zeleny/* Copyright 1999-2004 The Apache Software Foundation
e76d78338026fa47dca32eaf7f5c15eabb1b951aJan Zeleny * Licensed under the Apache License, Version 2.0 (the "License");
e76d78338026fa47dca32eaf7f5c15eabb1b951aJan Zeleny * you may not use this file except in compliance with the License.
e76d78338026fa47dca32eaf7f5c15eabb1b951aJan Zeleny * You may obtain a copy of the License at
e76d78338026fa47dca32eaf7f5c15eabb1b951aJan Zeleny * Unless required by applicable law or agreed to in writing, software
e76d78338026fa47dca32eaf7f5c15eabb1b951aJan Zeleny * distributed under the License is distributed on an "AS IS" BASIS,
e76d78338026fa47dca32eaf7f5c15eabb1b951aJan Zeleny * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
e76d78338026fa47dca32eaf7f5c15eabb1b951aJan Zeleny * See the License for the specific language governing permissions and
e76d78338026fa47dca32eaf7f5c15eabb1b951aJan Zeleny * limitations under the License.
e76d78338026fa47dca32eaf7f5c15eabb1b951aJan Zeleny * Main include file for the Apache proxy
e76d78338026fa47dca32eaf7f5c15eabb1b951aJan Zeleny Also note numerous FIXMEs and CHECKMEs which should be eliminated.
aab938c5975f0e3b85c7c79a5d718e5fefed7217Simo Sorce This code is once again experimental!
aab938c5975f0e3b85c7c79a5d718e5fefed7217Simo Sorce Things to do:
e76d78338026fa47dca32eaf7f5c15eabb1b951aJan Zeleny 1. Make it completely work (for FTP too)
e76d78338026fa47dca32eaf7f5c15eabb1b951aJan Zeleny Chuck Murcko <chuck@topsail.org> 02-06-01
7fe69bb6ec70bce439c6b975a9a0044c98ff502bSimo Sorce/* for proxy_canonenc() */
7fe69bb6ec70bce439c6b975a9a0044c98ff502bSimo Sorce enc_path, enc_search, enc_user, enc_fpath, enc_parm
aab938c5975f0e3b85c7c79a5d718e5fefed7217Simo Sorce#else /*APR_CHARSET_EBCDIC*/
e76d78338026fa47dca32eaf7f5c15eabb1b951aJan Zeleny#endif /*APR_CHARSET_EBCDIC*/
aab938c5975f0e3b85c7c79a5d718e5fefed7217Simo Sorce/* default Max-Forwards header setting */
aab938c5975f0e3b85c7c79a5d718e5fefed7217Simo Sorce/* static information about a remote proxy */
aab938c5975f0e3b85c7c79a5d718e5fefed7217Simo Sorce const char *scheme; /* the schemes handled by this proxy, or '*' */
aab938c5975f0e3b85c7c79a5d718e5fefed7217Simo Sorce const char *protocol; /* the scheme used to talk to this proxy */
aab938c5975f0e3b85c7c79a5d718e5fefed7217Simo Sorce const char *hostname; /* the hostname of this proxy */
e76d78338026fa47dca32eaf7f5c15eabb1b951aJan Zeleny regex_t *regexp; /* compiled regex (if any) for the remote */
e76d78338026fa47dca32eaf7f5c15eabb1b951aJan Zeleny int use_regex; /* simple boolean. True if we have a regex pattern */
e76d78338026fa47dca32eaf7f5c15eabb1b951aJan Zeleny const char *real;
e76d78338026fa47dca32eaf7f5c15eabb1b951aJan Zeleny const char *fake;
e76d78338026fa47dca32eaf7f5c15eabb1b951aJan Zeleny int (*matcher) (struct dirconn_entry * This, request_rec *r);
84c611c1b7c04cc7735ab54d4e5f48284b79e6fbJan Zeleny const char *name;
84c611c1b7c04cc7735ab54d4e5f48284b79e6fbJan Zelenytypedef struct {
84c611c1b7c04cc7735ab54d4e5f48284b79e6fbJan Zeleny const char *domain; /* domain name to use in absence of a domain name in the request */
84c611c1b7c04cc7735ab54d4e5f48284b79e6fbJan Zeleny int req; /* true if proxy requests are enabled */
84c611c1b7c04cc7735ab54d4e5f48284b79e6fbJan Zeleny } viaopt; /* how to deal with proxy Via: headers */
cb388d52f49f54963379cc20a25e14d17fe6e9a3Simo Sorce * the following setting masks the error page
cb388d52f49f54963379cc20a25e14d17fe6e9a3Simo Sorce * returned from the 'proxied server' and just
cb388d52f49f54963379cc20a25e14d17fe6e9a3Simo Sorce * forwards the status code upwards.
cb388d52f49f54963379cc20a25e14d17fe6e9a3Simo Sorce * This allows the main server (us) to generate
cb388d52f49f54963379cc20a25e14d17fe6e9a3Simo Sorce * the error page, (so it will look like a error
84c611c1b7c04cc7735ab54d4e5f48284b79e6fbJan Zeleny * returned from the rest of the system
204cfc89a076fd32bf34f2abb3f809304aaa88abSimo Sorce/* putting new stuff on the end maximises binary back-compatibility.
204cfc89a076fd32bf34f2abb3f809304aaa88abSimo Sorce * the strmatch_patterns are really a const just to have a
204cfc89a076fd32bf34f2abb3f809304aaa88abSimo Sorce * case-independent strstr.
65393a294e635822c1d7a15fe5853dc457ad8a2aSimo Sorcetypedef struct {
84c611c1b7c04cc7735ab54d4e5f48284b79e6fbJan Zeleny const char *p; /* The path */
84c611c1b7c04cc7735ab54d4e5f48284b79e6fbJan Zeleny int p_is_fnmatch; /* Is this path an fnmatch candidate? */
84c611c1b7c04cc7735ab54d4e5f48284b79e6fbJan Zelenytypedef struct {
65393a294e635822c1d7a15fe5853dc457ad8a2aSimo Sorcetypedef struct {
84c611c1b7c04cc7735ab54d4e5f48284b79e6fbJan Zeleny float cache_completion; /* completion percentage */
84c611c1b7c04cc7735ab54d4e5f48284b79e6fbJan Zeleny/* Create a set of PROXY_DECLARE(type), PROXY_DECLARE_NONSTD(type) and
84c611c1b7c04cc7735ab54d4e5f48284b79e6fbJan Zeleny * PROXY_DECLARE_DATA with appropriate export and import tags for the platform
3912262270a6449ebe1d3e92c27c217b4044f894Simo Sorce#if !defined(WIN32)
84c611c1b7c04cc7735ab54d4e5f48284b79e6fbJan Zeleny#define PROXY_DECLARE(type) __declspec(dllexport) type __stdcall
84c611c1b7c04cc7735ab54d4e5f48284b79e6fbJan Zeleny#define PROXY_DECLARE_NONSTD(type) __declspec(dllexport) type
84c611c1b7c04cc7735ab54d4e5f48284b79e6fbJan Zeleny#define PROXY_DECLARE(type) __declspec(dllimport) type __stdcall
65393a294e635822c1d7a15fe5853dc457ad8a2aSimo Sorce#define PROXY_DECLARE_NONSTD(type) __declspec(dllimport) type
84c611c1b7c04cc7735ab54d4e5f48284b79e6fbJan Zeleny * Hook an optional proxy hook. Unlike static hooks, this uses a macro
84c611c1b7c04cc7735ab54d4e5f48284b79e6fbJan Zeleny * instead of a function.
84c611c1b7c04cc7735ab54d4e5f48284b79e6fbJan Zeleny#define PROXY_OPTIONAL_HOOK(name,fn,pre,succ,order) \
3912262270a6449ebe1d3e92c27c217b4044f894Simo SorceAPR_DECLARE_EXTERNAL_HOOK(proxy, PROXY, int, scheme_handler, (request_rec *r,
84c611c1b7c04cc7735ab54d4e5f48284b79e6fbJan ZelenyAPR_DECLARE_EXTERNAL_HOOK(proxy, PROXY, int, canon_handler, (request_rec *r,
84c611c1b7c04cc7735ab54d4e5f48284b79e6fbJan ZelenyAPR_DECLARE_EXTERNAL_HOOK(proxy, PROXY, int, create_req, (request_rec *r, request_rec *pr))
3912262270a6449ebe1d3e92c27c217b4044f894Simo SorceAPR_DECLARE_EXTERNAL_HOOK(proxy, PROXY, int, fixups, (request_rec *r))
204cfc89a076fd32bf34f2abb3f809304aaa88abSimo SorcePROXY_DECLARE(request_rec *)ap_proxy_make_fake_req(conn_rec *c, request_rec *r);
204cfc89a076fd32bf34f2abb3f809304aaa88abSimo SorcePROXY_DECLARE(void) ap_proxy_c2hex(int ch, char *x);
204cfc89a076fd32bf34f2abb3f809304aaa88abSimo SorcePROXY_DECLARE(char *)ap_proxy_canonenc(apr_pool_t *p, const char *x, int len, enum enctype t,
3912262270a6449ebe1d3e92c27c217b4044f894Simo SorcePROXY_DECLARE(char *)ap_proxy_canon_netloc(apr_pool_t *p, char **const urlp, char **userp,
204cfc89a076fd32bf34f2abb3f809304aaa88abSimo Sorce char **passwordp, char **hostp, apr_port_t *port);
204cfc89a076fd32bf34f2abb3f809304aaa88abSimo SorcePROXY_DECLARE(const char *)ap_proxy_date_canon(apr_pool_t *p, const char *x);
204cfc89a076fd32bf34f2abb3f809304aaa88abSimo SorcePROXY_DECLARE(int) ap_proxy_liststr(const char *list, const char *val);
204cfc89a076fd32bf34f2abb3f809304aaa88abSimo SorcePROXY_DECLARE(char *)ap_proxy_removestr(apr_pool_t *pool, const char *list, const char *val);
204cfc89a076fd32bf34f2abb3f809304aaa88abSimo SorcePROXY_DECLARE(int) ap_proxy_hex2sec(const char *x);
204cfc89a076fd32bf34f2abb3f809304aaa88abSimo SorcePROXY_DECLARE(void) ap_proxy_sec2hex(int t, char *y);
204cfc89a076fd32bf34f2abb3f809304aaa88abSimo SorcePROXY_DECLARE(int) ap_proxyerror(request_rec *r, int statuscode, const char *message);
204cfc89a076fd32bf34f2abb3f809304aaa88abSimo SorcePROXY_DECLARE(int) ap_proxy_is_ipaddr(struct dirconn_entry *This, apr_pool_t *p);
3912262270a6449ebe1d3e92c27c217b4044f894Simo SorcePROXY_DECLARE(int) ap_proxy_is_domainname(struct dirconn_entry *This, apr_pool_t *p);
3912262270a6449ebe1d3e92c27c217b4044f894Simo SorcePROXY_DECLARE(int) ap_proxy_is_hostname(struct dirconn_entry *This, apr_pool_t *p);
7fe69bb6ec70bce439c6b975a9a0044c98ff502bSimo SorcePROXY_DECLARE(int) ap_proxy_is_word(struct dirconn_entry *This, apr_pool_t *p);
7fe69bb6ec70bce439c6b975a9a0044c98ff502bSimo SorcePROXY_DECLARE(int) ap_proxy_checkproxyblock(request_rec *r, proxy_server_conf *conf, apr_sockaddr_t *uri_addr);
84c611c1b7c04cc7735ab54d4e5f48284b79e6fbJan ZelenyPROXY_DECLARE(int) ap_proxy_pre_http_request(conn_rec *c, request_rec *r);
84c611c1b7c04cc7735ab54d4e5f48284b79e6fbJan ZelenyPROXY_DECLARE(apr_status_t) ap_proxy_string_read(conn_rec *c, apr_bucket_brigade *bb, char *buff, size_t bufflen, int *eos);
84c611c1b7c04cc7735ab54d4e5f48284b79e6fbJan ZelenyPROXY_DECLARE(void) ap_proxy_table_unmerge(apr_pool_t *p, apr_table_t *t, char *key);
84c611c1b7c04cc7735ab54d4e5f48284b79e6fbJan ZelenyPROXY_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 *);
84c611c1b7c04cc7735ab54d4e5f48284b79e6fbJan ZelenyPROXY_DECLARE(int) ap_proxy_ssl_enable(conn_rec *c);
3912262270a6449ebe1d3e92c27c217b4044f894Simo SorcePROXY_DECLARE(int) ap_proxy_ssl_disable(conn_rec *c);
c03b28a38b14fdb59f74864ae4dc56affe256508Simo Sorce/* For proxy_util */
84c611c1b7c04cc7735ab54d4e5f48284b79e6fbJan Zelenyextern module AP_MODULE_DECLARE_DATA proxy_module;
84c611c1b7c04cc7735ab54d4e5f48284b79e6fbJan Zeleny#endif /*MOD_PROXY_H*/