You are viewing a plain text version of this content. The canonical link for it is here.
Posted to cvs@httpd.apache.org by ma...@apache.org on 2001/02/09 13:40:29 UTC

cvs commit: apache-1.3/src/modules/proxy proxy_ftp.c proxy_http.c

martin      01/02/09 04:40:29

  Modified:    src/modules/proxy proxy_ftp.c proxy_http.c
  Log:
  Order the checks for NoProxy and ProxyBlock in the order
  "fastest to slowest" (as was already partially done in proxy_http.c).
  Minor speed improvement.
  
  Revision  Changes    Path
  1.86      +15 -8     apache-1.3/src/modules/proxy/proxy_ftp.c
  
  Index: proxy_ftp.c
  ===================================================================
  RCS file: /home/cvs/apache-1.3/src/modules/proxy/proxy_ftp.c,v
  retrieving revision 1.85
  retrieving revision 1.86
  diff -u -u -r1.85 -r1.86
  --- proxy_ftp.c	2001/01/15 17:05:29	1.85
  +++ proxy_ftp.c	2001/02/09 12:40:27	1.86
  @@ -536,10 +536,11 @@
   /* check if ProxyBlock directive on this host */
       destaddr.s_addr = ap_inet_addr(host);
       for (i = 0; i < conf->noproxies->nelts; i++) {
  -	if ((npent[i].name != NULL && strstr(host, npent[i].name) != NULL)
  -	    || destaddr.s_addr == npent[i].addr.s_addr || npent[i].name[0] == '*')
  -	    return ap_proxyerror(r, HTTP_FORBIDDEN,
  -				 "Connect to remote machine blocked");
  +        if (destaddr.s_addr == npent[i].addr.s_addr ||
  +            (npent[i].name != NULL &&
  +              (npent[i].name[0] == '*' || strstr(host, npent[i].name) != NULL)))
  +            return ap_proxyerror(r, HTTP_FORBIDDEN,
  +                                 "Connect to remote machine blocked");
       }
   
       Explain2("FTP: connect to %s:%d", host, port);
  @@ -1158,10 +1159,16 @@
       }
   
   /* check if NoCache directive on this host */
  -    for (i = 0; i < conf->nocaches->nelts; i++) {
  -	if ((ncent[i].name != NULL && strstr(host, ncent[i].name) != NULL)
  -	    || destaddr.s_addr == ncent[i].addr.s_addr || ncent[i].name[0] == '*')
  -	    nocache = 1;
  +    if (nocache == 0) {
  +	for (i = 0; i < conf->nocaches->nelts; i++) {
  +	    if (destaddr.s_addr == ncent[i].addr.s_addr ||
  +	        (ncent[i].name != NULL &&
  +		  (ncent[i].name[0] == '*' ||
  +		   strstr(host, ncent[i].name) != NULL))) {
  +	       nocache = 1;
  +	       break;
  +	    }
  +	}
       }
   
       i = ap_proxy_cache_update(c, resp_hdrs, 0, nocache);
  
  
  
  1.73      +5 -4      apache-1.3/src/modules/proxy/proxy_http.c
  
  Index: proxy_http.c
  ===================================================================
  RCS file: /home/cvs/apache-1.3/src/modules/proxy/proxy_http.c,v
  retrieving revision 1.72
  retrieving revision 1.73
  diff -u -u -r1.72 -r1.73
  --- proxy_http.c	2001/01/15 17:05:30	1.72
  +++ proxy_http.c	2001/02/09 12:40:27	1.73
  @@ -233,10 +233,11 @@
   /* check if ProxyBlock directive on this host */
       destaddr.s_addr = ap_inet_addr(desthost);
       for (i = 0; i < conf->noproxies->nelts; i++) {
  -	if ((npent[i].name != NULL && strstr(desthost, npent[i].name) != NULL)
  -	    || destaddr.s_addr == npent[i].addr.s_addr || npent[i].name[0] == '*')
  -	    return ap_proxyerror(r, HTTP_FORBIDDEN,
  -				 "Connect to remote machine blocked");
  +        if (destaddr.s_addr == npent[i].addr.s_addr ||
  +            (npent[i].name != NULL &&
  +              (npent[i].name[0] == '*' || strstr(desthost, npent[i].name) != NULL)))
  +            return ap_proxyerror(r, HTTP_FORBIDDEN,
  +                                 "Connect to remote machine blocked");
       }
   
       if (proxyhost != NULL) {