httpd-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From r..@locus.apache.org
Subject cvs commit: apache-2.0/src/modules/proxy mod_proxy.c mod_proxy.h proxy_connect.c proxy_http.c
Date Sat, 18 Nov 2000 17:13:30 GMT
rbb         00/11/18 09:13:29

  Modified:    src/modules/proxy mod_proxy.c mod_proxy.h proxy_connect.c
                        proxy_http.c
  Log:
  Begin to remove some of the cache-ing logic from the http proxy.
  
  Revision  Changes    Path
  1.18      +5 -48     apache-2.0/src/modules/proxy/mod_proxy.c
  
  Index: mod_proxy.c
  ===================================================================
  RCS file: /home/cvs/apache-2.0/src/modules/proxy/mod_proxy.c,v
  retrieving revision 1.17
  retrieving revision 1.18
  diff -u -r1.17 -r1.18
  --- mod_proxy.c	2000/11/14 22:28:56	1.17
  +++ mod_proxy.c	2000/11/18 17:13:29	1.18
  @@ -288,7 +288,6 @@
       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 @@
                    "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 @@
   		 * 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 @@
    */
       /* 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;
   }
  
  
  
  1.21      +2 -2      apache-2.0/src/modules/proxy/mod_proxy.h
  
  Index: mod_proxy.h
  ===================================================================
  RCS file: /home/cvs/apache-2.0/src/modules/proxy/mod_proxy.h,v
  retrieving revision 1.20
  retrieving revision 1.21
  diff -u -r1.20 -r1.21
  --- mod_proxy.h	2000/11/17 00:19:30	1.20
  +++ mod_proxy.h	2000/11/18 17:13:29	1.21
  @@ -231,7 +231,7 @@
   
   /* 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_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 */
  
  
  
  1.17      +1 -1      apache-2.0/src/modules/proxy/proxy_connect.c
  
  Index: proxy_connect.c
  ===================================================================
  RCS file: /home/cvs/apache-2.0/src/modules/proxy/proxy_connect.c,v
  retrieving revision 1.16
  retrieving revision 1.17
  diff -u -r1.16 -r1.17
  --- proxy_connect.c	2000/11/14 23:58:54	1.16
  +++ proxy_connect.c	2000/11/18 17:13:29	1.17
  @@ -110,7 +110,7 @@
   }
   
   
  -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;
  
  
  
  1.24      +4 -26     apache-2.0/src/modules/proxy/proxy_http.c
  
  Index: proxy_http.c
  ===================================================================
  RCS file: /home/cvs/apache-2.0/src/modules/proxy/proxy_http.c,v
  retrieving revision 1.23
  retrieving revision 1.24
  diff -u -r1.23 -r1.24
  --- proxy_http.c	2000/11/18 03:17:21	1.23
  +++ proxy_http.c	2000/11/18 17:13:29	1.24
  @@ -169,7 +169,7 @@
    * 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 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 @@
       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 @@
           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 @@
   	    } 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 @@
    * 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 @@
           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 @@
           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 @@
       }
   
       apr_close_socket(sock);
  -    if(c) ap_proxy_cache_update(c);
       return OK;
   }
  
  
  

Mime
View raw message