From c9dc3847d275bcab207f05d476335ca9693319c2 Mon Sep 17 00:00:00 2001 From: Chuck Murcko Date: Wed, 7 Feb 2001 05:41:35 +0000 Subject: [PATCH] Changes to get running on the current codebase PR: Obtained from: Submitted by: Reviewed by: git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@88004 13f79535-47bb-0310-9956-ffa450edef68 --- modules/proxy/mod_proxy.c | 19 +++++++++---------- modules/proxy/mod_proxy.h | 32 ++++++-------------------------- modules/proxy/proxy_http.c | 3 +++ modules/proxy/proxy_util.c | 4 ++-- 4 files changed, 20 insertions(+), 38 deletions(-) diff --git a/modules/proxy/mod_proxy.c b/modules/proxy/mod_proxy.c index 4e4c0380f1..edc16a7241 100644 --- a/modules/proxy/mod_proxy.c +++ b/modules/proxy/mod_proxy.c @@ -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) @@ -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; } @@ -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, @@ -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); } @@ -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 }; diff --git a/modules/proxy/mod_proxy.h b/modules/proxy/mod_proxy.h index 0b2a89c080..6588c32b72 100644 --- a/modules/proxy/mod_proxy.h +++ b/modules/proxy/mod_proxy.h @@ -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 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 15 April 1997 + Chuck Murcko 02-06-01 */ @@ -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" @@ -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); diff --git a/modules/proxy/proxy_http.c b/modules/proxy/proxy_http.c index 68e9837b6a..f5467d9903 100644 --- a/modules/proxy/proxy_http.c +++ b/modules/proxy/proxy_http.c @@ -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" diff --git a/modules/proxy/proxy_util.c b/modules/proxy/proxy_util.c index ed858b98e9..d726202760 100644 --- a/modules/proxy/proxy_util.c +++ b/modules/proxy/proxy_util.c @@ -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; @@ -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, @@ -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 -- 2.40.0