Loading modules/proxy/mod_proxy.c +9 −10 Original line number Diff line number Diff line Loading @@ -225,8 +225,10 @@ static int proxy_fixup(request_rec *r) /* canonicalise each specific scheme */ if (strncasecmp(url, "http:", 5) == 0) return ap_proxy_http_canon(r, url + 5, "http", DEFAULT_HTTP_PORT); #if FTP else if (strncasecmp(url, "ftp:", 4) == 0) return ap_proxy_ftp_canon(r, url + 4); #endif p = strchr(url, ':'); if (p == NULL || p == url) Loading Loading @@ -394,8 +396,10 @@ static int proxy_handler(request_rec *r) return ap_proxy_connect_handler(r, url, NULL, 0); if (strcasecmp(scheme, "http") == 0) return ap_proxy_http_handler(r, url, NULL, 0); #if FTP if (strcasecmp(scheme, "ftp") == 0) return ap_proxy_ftp_handler(r, NULL, url); #endif else return HTTP_FORBIDDEN; } Loading Loading @@ -709,12 +713,6 @@ static const char* return NULL; } static const handler_rec proxy_handlers[] = { {"proxy-server", proxy_handler}, {NULL} }; static const command_rec proxy_cmds[] = { AP_INIT_FLAG("ProxyRequests", set_proxy_req, NULL, RSRC_CONF, Loading Loading @@ -746,11 +744,13 @@ static const command_rec proxy_cmds[] = static void register_hooks(apr_pool_t *p) { /* [2] filename-to-URI translation */ /* handler */ ap_hook_handler(proxy_handler, NULL, NULL, APR_HOOK_FIRST); /* filename-to-URI translation */ ap_hook_translate_name(proxy_trans, NULL, NULL, APR_HOOK_FIRST); /* [8] fixups */ /* fixups */ ap_hook_fixups(proxy_fixup, NULL, NULL, APR_HOOK_FIRST); /* [1] post read_request handling */ /* post read_request handling */ ap_hook_post_read_request(proxy_detect, NULL, NULL, APR_HOOK_FIRST); } Loading @@ -762,6 +762,5 @@ module AP_MODULE_DECLARE_DATA proxy_module = create_proxy_config, /* create per-server config structure */ NULL, /* merge per-server config structures */ proxy_cmds, /* command table */ proxy_handlers, /* handlers */ register_hooks }; modules/proxy/mod_proxy.h +6 −26 Original line number Diff line number Diff line Loading @@ -71,35 +71,17 @@ If TESTING is set, then garbage collection doesn't delete ... probably a good idea when hacking. This code is still experimental! This code is once again experimental! Things to do: 1. Make it garbage collect in the background, not while someone is waiting for a response! 1. Make it completely work (for FTP too) 2. Check the logic thoroughly. 2. HTTP/1.1 3. Empty directories are only removed the next time round (but this does avoid two passes). Consider doing them the first time round. 3. Cache issues Ben Laurie <ben@algroup.co.uk> 30 Mar 96 More things to do: 0. Code cleanup (ongoing) 1. add 230 response output for ftp now that it works 2. Make the ftp proxy transparent, also same with (future) gopher & wais 3. Use protocol handler struct a la Apache module handlers (Dirk van Gulik) 4. Use a cache expiry database for more efficient GC (Jeremy Wohl) 5. Bulletproof GC against SIGALRM Chuck Murcko <chuck@topsail.org> 15 April 1997 Chuck Murcko <chuck@topsail.org> 02-06-01 */ Loading @@ -109,8 +91,7 @@ #include "httpd.h" #include "http_config.h" #include "http_protocol.h" #include "ap_cache.h" #include "buff.h" #include "proxy_cache.h" #include "apr_compat.h" #include "apr_strings.h" Loading Loading @@ -256,7 +237,6 @@ char *ap_proxy_canon_netloc(apr_pool_t *p, char **const urlp, char **userp, char **passwordp, char **hostp, int *port); const char *ap_proxy_date_canon(apr_pool_t *p, const char *x); apr_table_t *ap_proxy_read_headers(request_rec *r, char *buffer, int size, conn_rec *c); long int ap_proxy_send_fb(proxy_completion *, BUFF *f, request_rec *r, ap_cache_el *c); void ap_proxy_send_headers(request_rec *r, const char *respline, apr_table_t *hdrs); int ap_proxy_liststr(const char *list, const char *val); void ap_proxy_hash(const char *it, char *val, int ndepth, int nlength); Loading modules/proxy/proxy_http.c +3 −0 Original line number Diff line number Diff line Loading @@ -61,6 +61,9 @@ #define CORE_PRIVATE #include "mod_proxy.h" #include "apr_buckets.h" #include "util_filter.h" #include "ap_config.h" #include "http_log.h" #include "http_main.h" #include "http_core.h" Loading modules/proxy/proxy_util.c +2 −2 Original line number Diff line number Diff line Loading @@ -464,6 +464,7 @@ apr_table_t *ap_proxy_read_headers(request_rec *r, char *buffer, int size, conn_ return resp_hdrs; } #if 0 long int ap_proxy_send_fb(proxy_completion *completion, BUFF *f, request_rec *r, ap_cache_el *c) { int ok; Loading @@ -479,14 +480,12 @@ long int ap_proxy_send_fb(proxy_completion *completion, BUFF *f, request_rec *r, total_bytes_rcvd = 0; if (c) ap_cache_el_data(c, &cachefp); #if 0 #if APR_CHARSET_EBCDIC /* The cache copy is ASCII, not EBCDIC, even for text/html) */ ap_bsetflag(f, B_ASCII2EBCDIC|B_EBCDIC2ASCII, 0); if (c != NULL && c->fp != NULL) ap_bsetflag(c->fp, B_ASCII2EBCDIC|B_EBCDIC2ASCII, 0); ap_bsetflag(con->client, B_ASCII2EBCDIC|B_EBCDIC2ASCII, 0); #endif #endif /* Since we are reading from one buffer and writing to another, Loading Loading @@ -572,6 +571,7 @@ long int ap_proxy_send_fb(proxy_completion *completion, BUFF *f, request_rec *r, return total_bytes_rcvd; } #endif /* 0, ap_proxy_send_fb */ /* * Sends response line and headers. Uses the client fd and the Loading Loading
modules/proxy/mod_proxy.c +9 −10 Original line number Diff line number Diff line Loading @@ -225,8 +225,10 @@ static int proxy_fixup(request_rec *r) /* canonicalise each specific scheme */ if (strncasecmp(url, "http:", 5) == 0) return ap_proxy_http_canon(r, url + 5, "http", DEFAULT_HTTP_PORT); #if FTP else if (strncasecmp(url, "ftp:", 4) == 0) return ap_proxy_ftp_canon(r, url + 4); #endif p = strchr(url, ':'); if (p == NULL || p == url) Loading Loading @@ -394,8 +396,10 @@ static int proxy_handler(request_rec *r) return ap_proxy_connect_handler(r, url, NULL, 0); if (strcasecmp(scheme, "http") == 0) return ap_proxy_http_handler(r, url, NULL, 0); #if FTP if (strcasecmp(scheme, "ftp") == 0) return ap_proxy_ftp_handler(r, NULL, url); #endif else return HTTP_FORBIDDEN; } Loading Loading @@ -709,12 +713,6 @@ static const char* return NULL; } static const handler_rec proxy_handlers[] = { {"proxy-server", proxy_handler}, {NULL} }; static const command_rec proxy_cmds[] = { AP_INIT_FLAG("ProxyRequests", set_proxy_req, NULL, RSRC_CONF, Loading Loading @@ -746,11 +744,13 @@ static const command_rec proxy_cmds[] = static void register_hooks(apr_pool_t *p) { /* [2] filename-to-URI translation */ /* handler */ ap_hook_handler(proxy_handler, NULL, NULL, APR_HOOK_FIRST); /* filename-to-URI translation */ ap_hook_translate_name(proxy_trans, NULL, NULL, APR_HOOK_FIRST); /* [8] fixups */ /* fixups */ ap_hook_fixups(proxy_fixup, NULL, NULL, APR_HOOK_FIRST); /* [1] post read_request handling */ /* post read_request handling */ ap_hook_post_read_request(proxy_detect, NULL, NULL, APR_HOOK_FIRST); } Loading @@ -762,6 +762,5 @@ module AP_MODULE_DECLARE_DATA proxy_module = create_proxy_config, /* create per-server config structure */ NULL, /* merge per-server config structures */ proxy_cmds, /* command table */ proxy_handlers, /* handlers */ register_hooks };
modules/proxy/mod_proxy.h +6 −26 Original line number Diff line number Diff line Loading @@ -71,35 +71,17 @@ If TESTING is set, then garbage collection doesn't delete ... probably a good idea when hacking. This code is still experimental! This code is once again experimental! Things to do: 1. Make it garbage collect in the background, not while someone is waiting for a response! 1. Make it completely work (for FTP too) 2. Check the logic thoroughly. 2. HTTP/1.1 3. Empty directories are only removed the next time round (but this does avoid two passes). Consider doing them the first time round. 3. Cache issues Ben Laurie <ben@algroup.co.uk> 30 Mar 96 More things to do: 0. Code cleanup (ongoing) 1. add 230 response output for ftp now that it works 2. Make the ftp proxy transparent, also same with (future) gopher & wais 3. Use protocol handler struct a la Apache module handlers (Dirk van Gulik) 4. Use a cache expiry database for more efficient GC (Jeremy Wohl) 5. Bulletproof GC against SIGALRM Chuck Murcko <chuck@topsail.org> 15 April 1997 Chuck Murcko <chuck@topsail.org> 02-06-01 */ Loading @@ -109,8 +91,7 @@ #include "httpd.h" #include "http_config.h" #include "http_protocol.h" #include "ap_cache.h" #include "buff.h" #include "proxy_cache.h" #include "apr_compat.h" #include "apr_strings.h" Loading Loading @@ -256,7 +237,6 @@ char *ap_proxy_canon_netloc(apr_pool_t *p, char **const urlp, char **userp, char **passwordp, char **hostp, int *port); const char *ap_proxy_date_canon(apr_pool_t *p, const char *x); apr_table_t *ap_proxy_read_headers(request_rec *r, char *buffer, int size, conn_rec *c); long int ap_proxy_send_fb(proxy_completion *, BUFF *f, request_rec *r, ap_cache_el *c); void ap_proxy_send_headers(request_rec *r, const char *respline, apr_table_t *hdrs); int ap_proxy_liststr(const char *list, const char *val); void ap_proxy_hash(const char *it, char *val, int ndepth, int nlength); Loading
modules/proxy/proxy_http.c +3 −0 Original line number Diff line number Diff line Loading @@ -61,6 +61,9 @@ #define CORE_PRIVATE #include "mod_proxy.h" #include "apr_buckets.h" #include "util_filter.h" #include "ap_config.h" #include "http_log.h" #include "http_main.h" #include "http_core.h" Loading
modules/proxy/proxy_util.c +2 −2 Original line number Diff line number Diff line Loading @@ -464,6 +464,7 @@ apr_table_t *ap_proxy_read_headers(request_rec *r, char *buffer, int size, conn_ return resp_hdrs; } #if 0 long int ap_proxy_send_fb(proxy_completion *completion, BUFF *f, request_rec *r, ap_cache_el *c) { int ok; Loading @@ -479,14 +480,12 @@ long int ap_proxy_send_fb(proxy_completion *completion, BUFF *f, request_rec *r, total_bytes_rcvd = 0; if (c) ap_cache_el_data(c, &cachefp); #if 0 #if APR_CHARSET_EBCDIC /* The cache copy is ASCII, not EBCDIC, even for text/html) */ ap_bsetflag(f, B_ASCII2EBCDIC|B_EBCDIC2ASCII, 0); if (c != NULL && c->fp != NULL) ap_bsetflag(c->fp, B_ASCII2EBCDIC|B_EBCDIC2ASCII, 0); ap_bsetflag(con->client, B_ASCII2EBCDIC|B_EBCDIC2ASCII, 0); #endif #endif /* Since we are reading from one buffer and writing to another, Loading Loading @@ -572,6 +571,7 @@ long int ap_proxy_send_fb(proxy_completion *completion, BUFF *f, request_rec *r, return total_bytes_rcvd; } #endif /* 0, ap_proxy_send_fb */ /* * Sends response line and headers. Uses the client fd and the Loading