diff options
author | Ryan Bloom <rbb@apache.org> | 2000-11-18 18:13:29 +0100 |
---|---|---|
committer | Ryan Bloom <rbb@apache.org> | 2000-11-18 18:13:29 +0100 |
commit | e56d9d5bafc5e23c8a7054b8e77964e555b036ae (patch) | |
tree | 23cb03e33109e93445d0fbec7d6cef47b199b9b3 | |
parent | Change references of AF_ to reflect APR_ so they should work (diff) | |
download | apache2-e56d9d5bafc5e23c8a7054b8e77964e555b036ae.tar.xz apache2-e56d9d5bafc5e23c8a7054b8e77964e555b036ae.zip |
Begin to remove some of the cache-ing logic from the http proxy.
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@87013 13f79535-47bb-0310-9956-ffa450edef68
-rw-r--r-- | modules/proxy/mod_proxy.c | 53 | ||||
-rw-r--r-- | modules/proxy/mod_proxy.h | 4 | ||||
-rw-r--r-- | modules/proxy/proxy_connect.c | 2 | ||||
-rw-r--r-- | modules/proxy/proxy_http.c | 30 |
4 files changed, 12 insertions, 77 deletions
diff --git a/modules/proxy/mod_proxy.c b/modules/proxy/mod_proxy.c index a35ce9c97d..af25dc5e19 100644 --- a/modules/proxy/mod_proxy.c +++ b/modules/proxy/mod_proxy.c @@ -288,7 +288,6 @@ static int proxy_handler(request_rec *r) apr_array_header_t *proxies = conf->proxies; struct proxy_remote *ents = (struct proxy_remote *) proxies->elts; int i, rc; - ap_cache_el *cr = NULL; int direct_connect = 0; const char *maxfwd_str; const char *pragma, *auth, *imstr; @@ -328,48 +327,6 @@ static int proxy_handler(request_rec *r) "Request for %s, pragma=%s, auth=%s, imstr=%s", url, pragma, auth, imstr); - /* can this request be cached at all? */ - if (r->method_number == M_GET && strlen(url) < 1024 && - !ap_proxy_liststr(pragma, "no-cache") && auth == NULL) - { - if(ap_cache_seek(conf->cache, url, &cr) == APR_SUCCESS) - { - int has_m = 0; - /* now we need to check if the last modified date is write if */ - - if(imstr) - { - time_t ims = (time_t)ap_parseHTTPdate(ap_proxy_date_canon(r->pool, imstr)); - if(ims == BAD_DATE) - apr_table_unset(r->headers_in, "If-Modified-Since"); - else - { - /* ok we were asked to check, so let's do that */ - if(ap_cache_el_header(cr, "Last-Modified", - (char **)&imstr) == APR_SUCCESS) - { - time_t lm = - ap_parseHTTPdate(ap_proxy_date_canon(r->pool, imstr)); if(lm != BAD_DATE) - { - if(ims < lm) - apr_table_set(r->headers_in, - "If-Modified-Since", imstr); - else - { - - has_m = 1; - } - } - } - } - } - return has_m ? HTTP_NOT_MODIFIED : ap_proxy_cache_send(r, cr); - } - /* if there wasn't an entry in the cache we get here, - we need to create one */ - ap_cache_create(conf->cache, url, &cr); - } - /* If the host doesn't have a domain name, add one and redirect. */ if (conf->domain != NULL) { rc = proxy_needsdomain(r, url, conf->domain); @@ -412,11 +369,11 @@ static int proxy_handler(request_rec *r) * proxy code. */ if (r->method_number == M_CONNECT) - rc = ap_proxy_connect_handler(r, cr, url, ents[i].hostname, + rc = ap_proxy_connect_handler(r, url, ents[i].hostname, ents[i].port); /* we only know how to handle communication to a proxy via http */ else if (strcasecmp(ents[i].protocol, "http") == 0) - rc = ap_proxy_http_handler(r, cr, url, ents[i].hostname, + rc = ap_proxy_http_handler(r, url, ents[i].hostname, ents[i].port); else rc = DECLINED; @@ -434,11 +391,11 @@ static int proxy_handler(request_rec *r) */ /* handle the scheme */ if (r->method_number == M_CONNECT) - return ap_proxy_connect_handler(r, cr, url, NULL, 0); + return ap_proxy_connect_handler(r, url, NULL, 0); if (strcasecmp(scheme, "http") == 0) - return ap_proxy_http_handler(r, cr, url, NULL, 0); + return ap_proxy_http_handler(r, url, NULL, 0); if (strcasecmp(scheme, "ftp") == 0) - return ap_proxy_ftp_handler(r, cr, url); + return ap_proxy_ftp_handler(r, NULL, url); else return HTTP_FORBIDDEN; } diff --git a/modules/proxy/mod_proxy.h b/modules/proxy/mod_proxy.h index a5de889595..9ab5296f60 100644 --- a/modules/proxy/mod_proxy.h +++ b/modules/proxy/mod_proxy.h @@ -231,7 +231,7 @@ typedef struct { /* proxy_connect.c */ -int ap_proxy_connect_handler(request_rec *r, ap_cache_el *c, char *url, +int ap_proxy_connect_handler(request_rec *r, char *url, const char *proxyhost, int proxyport); /* proxy_ftp.c */ @@ -243,7 +243,7 @@ int ap_proxy_ftp_handler(request_rec *r, ap_cache_el *c, char *url); int ap_proxy_http_canon(request_rec *r, char *url, const char *scheme, int def_port); -int ap_proxy_http_handler(request_rec *r, ap_cache_el *c, char *url, +int ap_proxy_http_handler(request_rec *r, char *url, const char *proxyhost, int proxyport); /* proxy_util.c */ diff --git a/modules/proxy/proxy_connect.c b/modules/proxy/proxy_connect.c index 82724f9321..0563f01964 100644 --- a/modules/proxy/proxy_connect.c +++ b/modules/proxy/proxy_connect.c @@ -110,7 +110,7 @@ allowed_port(proxy_server_conf *conf, int port) } -int ap_proxy_connect_handler(request_rec *r, ap_cache_el *c, char *url, +int ap_proxy_connect_handler(request_rec *r, char *url, const char *proxyhost, int proxyport) { struct in_addr destaddr; diff --git a/modules/proxy/proxy_http.c b/modules/proxy/proxy_http.c index 2420b6f4d4..b14c3f5b8e 100644 --- a/modules/proxy/proxy_http.c +++ b/modules/proxy/proxy_http.c @@ -169,7 +169,7 @@ static void clear_connection(apr_pool_t *p, apr_table_t *headers) * we return DECLINED so that we can try another proxy. (Or the direct * route.) */ -int ap_proxy_http_handler(request_rec *r, ap_cache_el *c, char *url, +int ap_proxy_http_handler(request_rec *r, char *url, const char *proxyhost, int proxyport) { const char *strp; @@ -190,7 +190,6 @@ int ap_proxy_http_handler(request_rec *r, ap_cache_el *c, char *url, int destport = 0; char *destportstr = NULL; const char *urlptr = NULL; - char *datestr, *clen; apr_ssize_t cntr; apr_file_t *cachefp = NULL; char *buf; @@ -202,7 +201,6 @@ int ap_proxy_http_handler(request_rec *r, ap_cache_el *c, char *url, proxy_server_conf *conf = (proxy_server_conf *) ap_get_module_config(sconf, &proxy_module); struct noproxy_entry *npent = (struct noproxy_entry *) conf->noproxies->elts; - struct nocache_entry *ncent = (struct nocache_entry *) conf->nocaches->elts; int nocache = 0; memset(&server, '\0', sizeof(server)); @@ -424,7 +422,6 @@ int ap_proxy_http_handler(request_rec *r, ap_cache_el *c, char *url, else { clear_connection(p, resp_hdrs); /* Strip Connection hdrs */ - ap_cache_el_header_merge(c, resp_hdrs); if (apr_table_get(resp_hdrs, "Content-type")) { r->content_type = apr_pstrdup(r->pool, apr_table_get(resp_hdrs, "Content-type")); } @@ -438,11 +435,6 @@ int ap_proxy_http_handler(request_rec *r, ap_cache_el *c, char *url, } else { apr_snprintf(portstr, sizeof portstr, ":%d", i); } - ap_cache_el_header_add(c, "Via", (conf->viaopt == via_full) - ? apr_psprintf(p, "%d.%d %s%s (%s)", major, minor, - ap_get_server_name(r), portstr, AP_SERVER_BASEVERSION) - : apr_psprintf(p, "%d.%d %s%s", major, minor, - ap_get_server_name(r), portstr)); } } else { @@ -456,6 +448,8 @@ int ap_proxy_http_handler(request_rec *r, ap_cache_el *c, char *url, * HTTP/1.0 requires us to accept 3 types of dates, but only generate * one type */ + +#if 0 if (ap_cache_el_header(c, "Date", &datestr) == APR_SUCCESS) ap_cache_el_header_set(c, "Date", ap_proxy_date_canon(p, datestr)); if (ap_cache_el_header(c, "Last-Modified", &datestr) == APR_SUCCESS) @@ -467,21 +461,7 @@ int ap_proxy_http_handler(request_rec *r, ap_cache_el *c, char *url, ap_cache_el_header_set(c, "Location", proxy_location_reverse_map(r, datestr)); if (ap_cache_el_header(c, "URI", &datestr) == APR_SUCCESS) ap_cache_el_header_set(c, "URI", proxy_location_reverse_map(r, datestr)); - -/* check if NoCache directive on this host */ - if (ap_cache_el_header(c, "Content-Length", &clen) == APR_SUCCESS) - content_length = atoi(clen ? clen : "-1"); - - for (i = 0; i < conf->nocaches->nelts; i++) { - if ((ncent[i].name != NULL && ap_strstr_c(desthost, ncent[i].name) != NULL) - || destaddr.s_addr == ncent[i].addr.s_addr || ncent[i].name[0] == '*') - nocache = 1; - } - - if(nocache || !ap_proxy_cache_should_cache(r, resp_hdrs, !backasswards)) - ap_proxy_cache_error(&c); - else - ap_cache_el_data(c, &cachefp); +#endif /* write status line */ #if 0 @@ -514,7 +494,6 @@ int ap_proxy_http_handler(request_rec *r, ap_cache_el *c, char *url, if (cachefp && apr_write(cachefp, buffer, &cntr) != APR_SUCCESS) { ap_log_rerror(APLOG_MARK, APLOG_ERR, 0, r, "proxy: error writing extra data to cache"); - ap_proxy_cache_error(&c); } } @@ -539,6 +518,5 @@ int ap_proxy_http_handler(request_rec *r, ap_cache_el *c, char *url, } apr_close_socket(sock); - if(c) ap_proxy_cache_update(c); return OK; } |