/* 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)
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;
}
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,
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);
}
create_proxy_config, /* create per-server config structure */
NULL, /* merge per-server config structures */
proxy_cmds, /* command table */
- proxy_handlers, /* handlers */
register_hooks
};
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
*/
#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"
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);
#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"
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;
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,
return total_bytes_rcvd;
}
+#endif /* 0, ap_proxy_send_fb */
/*
* Sends response line and headers. Uses the client fd and the