httpd-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Dean Gaudet <dgau...@hyperreal.org>
Subject cvs commit: apachen/src/modules/proxy proxy_cache.c proxy_ftp.c proxy_http.c proxy_util.c
Date Thu, 18 Sep 1997 00:20:27 GMT
dgaudet     97/09/17 17:20:25

  Modified:    src/modules/proxy proxy_cache.c proxy_ftp.c proxy_http.c
                        proxy_util.c
  Log:
  mod_proxy uses "char *p" and "pool *pool" a whole bunch ... which is not
  exactly the style we use elsewhere in the code.  Clean this up.
  
  I'm not sure, but proxy_cache.c had some interesting -Wshadow warnings
  involving a global "time_t now" and local "time_t now"s... I changed the
  name of the global to "garbage_now".
  
  Other similar fixes.  This is just syntactic sugar similar to the indent
  changes.  I avoided fixing obvious segfault bugs I saw while doing this.
  
  The entire server should now pass gcc -Wshadow, which makes me a bit
  happier.
  
  Revision  Changes    Path
  1.28      +13 -13    apachen/src/modules/proxy/proxy_cache.c
  
  Index: proxy_cache.c
  ===================================================================
  RCS file: /export/home/cvs/apachen/src/modules/proxy/proxy_cache.c,v
  retrieving revision 1.27
  retrieving revision 1.28
  diff -u -r1.27 -r1.28
  --- proxy_cache.c	1997/09/16 00:59:39	1.27
  +++ proxy_cache.c	1997/09/18 00:20:18	1.28
  @@ -90,7 +90,7 @@
   
   static int curbytes, cachesize, every;
   static unsigned long int curblocks;
  -static time_t now, expire;
  +static time_t garbage_now, garbage_expire;
   static char *filename;
   static mutex *garbage_mutex = NULL;
   
  @@ -148,8 +148,8 @@
   
       if (cachedir == NULL || every == -1)
   	return;
  -    now = time(NULL);
  -    if (now != -1 && lastcheck != BAD_DATE && now < lastcheck + every)
  +    garbage_now = time(NULL);
  +    if (garbage_now != -1 && lastcheck != BAD_DATE && garbage_now <
lastcheck + every)
   	return;
   
       block_alarms();		/* avoid SIGALRM on big cache cleanup */
  @@ -167,7 +167,7 @@
   	    if (errno != EEXIST)
   		proxy_log_uerror("creat", filename, NULL, r->server);
   	    else
  -		lastcheck = abs(now);	/* someone else got in there */
  +		lastcheck = abs(garbage_now);	/* someone else got in there */
   	    unblock_alarms();
   	    return;
   	}
  @@ -175,7 +175,7 @@
       }
       else {
   	lastcheck = buf.st_mtime;	/* save the time */
  -	if (now < lastcheck + every) {
  +	if (garbage_now < lastcheck + every) {
   	    unblock_alarms();
   	    return;
   	}
  @@ -199,7 +199,7 @@
       for (i = 0; i < files->nelts; i++) {
   	fent = elts[i];
   	sprintf(filename, "%s%s", cachedir, fent->file);
  -	Explain3("GC Unlinking %s (expiry %ld, now %ld)", filename, fent->expire, now);
  +	Explain3("GC Unlinking %s (expiry %ld, garbage_now %ld)", filename, fent->garbage_expire,
garbage_now);
   #if TESTING
   	fprintf(stderr, "Would unlink %s\n", filename);
   #else
  @@ -259,8 +259,8 @@
   		if (errno != ENOENT)
   		    proxy_log_uerror("stat", filename, NULL, r->server);
   	    }
  -	    else if (now != -1 && buf.st_atime < now - SEC_ONE_DAY &&
  -		     buf.st_mtime < now - SEC_ONE_DAY) {
  +	    else if (garbage_now != -1 && buf.st_atime < garbage_now - SEC_ONE_DAY
&&
  +		     buf.st_mtime < garbage_now - SEC_ONE_DAY) {
   		Explain1("GC unlink %s", filename);
   #if TESTING
   		fprintf(stderr, "Would unlink %s\n", filename);
  @@ -314,12 +314,12 @@
   	}
   	close(fd);
   	line[i] = '\0';
  -	expire = proxy_hex2sec(line + 18);
  +	garbage_expire = proxy_hex2sec(line + 18);
   	if (!checkmask(line, "&&&&&&&& &&&&&&&&
&&&&&&&&") ||
  -	    expire == BAD_DATE) {
  +	    garbage_expire == BAD_DATE) {
   	    /* bad file */
  -	    if (now != -1 && buf.st_atime > now + SEC_ONE_DAY &&
  -		buf.st_mtime > now + SEC_ONE_DAY) {
  +	    if (garbage_now != -1 && buf.st_atime > garbage_now + SEC_ONE_DAY &&
  +		buf.st_mtime > garbage_now + SEC_ONE_DAY) {
   		log_error("proxy: deleting bad cache file", r->server);
   #if TESTING
   		fprintf(stderr, "Would unlink bad file %s\n", filename);
  @@ -340,7 +340,7 @@
   	 */
   	fent = palloc(r->pool, sizeof(struct gc_ent));
   	fent->len = buf.st_size;
  -	fent->expire = expire;
  +	fent->expire = garbage_expire;
   	strcpy(fent->file, cachesubdir);
   	strcat(fent->file, ent->d_name);
   	*(struct gc_ent **) push_array(files) = fent;
  
  
  
  1.39      +58 -59    apachen/src/modules/proxy/proxy_ftp.c
  
  Index: proxy_ftp.c
  ===================================================================
  RCS file: /export/home/cvs/apachen/src/modules/proxy/proxy_ftp.c,v
  retrieving revision 1.38
  retrieving revision 1.39
  diff -u -r1.38 -r1.39
  --- proxy_ftp.c	1997/09/16 00:59:40	1.38
  +++ proxy_ftp.c	1997/09/18 00:20:19	1.39
  @@ -105,13 +105,13 @@
    */
   int proxy_ftp_canon(request_rec *r, char *url)
   {
  -    char *user, *password, *host, *path, *parms, *p, sport[7];
  -    pool *pool = r->pool;
  +    char *user, *password, *host, *path, *parms, *strp, sport[7];
  +    pool *p = r->pool;
       const char *err;
       int port;
   
       port = DEFAULT_FTP_PORT;
  -    err = proxy_canon_netloc(pool, &url, &user, &password, &host, &port);
  +    err = proxy_canon_netloc(p, &url, &user, &password, &host, &port);
       if (err)
   	return BAD_REQUEST;
       if (user != NULL && !ftp_check_string(user))
  @@ -125,34 +125,34 @@
    * This gives rise to the problem of a ; being decoded into the
    * path.
    */
  -    p = strchr(url, ';');
  -    if (p != NULL) {
  -	*(p++) = '\0';
  -	parms = proxy_canonenc(pool, p, strlen(p), enc_parm, r->proxyreq);
  +    strp = strchr(url, ';');
  +    if (strp != NULL) {
  +	*(strp++) = '\0';
  +	parms = proxy_canonenc(p, strp, strlen(strp), enc_parm, r->proxyreq);
   	if (parms == NULL)
   	    return BAD_REQUEST;
       }
       else
   	parms = "";
   
  -    path = proxy_canonenc(pool, url, strlen(url), enc_path, r->proxyreq);
  +    path = proxy_canonenc(p, url, strlen(url), enc_path, r->proxyreq);
       if (path == NULL)
   	return BAD_REQUEST;
       if (!ftp_check_string(path))
   	return BAD_REQUEST;
   
       if (!r->proxyreq && r->args != NULL) {
  -	if (p != NULL) {
  -	    p = proxy_canonenc(pool, r->args, strlen(r->args), enc_parm, 1);
  -	    if (p == NULL)
  +	if (strp != NULL) {
  +	    strp = proxy_canonenc(p, r->args, strlen(r->args), enc_parm, 1);
  +	    if (strp == NULL)
   		return BAD_REQUEST;
  -	    parms = pstrcat(pool, parms, "?", p, NULL);
  +	    parms = pstrcat(p, parms, "?", strp, NULL);
   	}
   	else {
  -	    p = proxy_canonenc(pool, r->args, strlen(r->args), enc_fpath, 1);
  -	    if (p == NULL)
  +	    strp = proxy_canonenc(p, r->args, strlen(r->args), enc_fpath, 1);
  +	    if (strp == NULL)
   		return BAD_REQUEST;
  -	    path = pstrcat(pool, path, "?", p, NULL);
  +	    path = pstrcat(p, path, "?", strp, NULL);
   	}
   	r->args = NULL;
       }
  @@ -164,7 +164,7 @@
       else
   	sport[0] = '\0';
   
  -    r->filename = pstrcat(pool, "proxy:ftp://", (user != NULL) ? user : "",
  +    r->filename = pstrcat(p, "proxy:ftp://", (user != NULL) ? user : "",
   			       (password != NULL) ? ":" : "",
   			       (password != NULL) ? password : "",
   		          (user != NULL) ? "@" : "", host, sport, "/", path,
  @@ -216,12 +216,11 @@
   static char *
        encode_space(request_rec *r, char *path)
   {
  -    pool *pool = r->pool;
       char *newpath;
       int i, j, len;
   
       len = strlen(path);
  -    newpath = palloc(pool, 3 * len + 1);
  +    newpath = palloc(r->pool, 3 * len + 1);
       for (i = 0, j = 0; i < len; i++, j++) {
   	if (path[i] != ' ')
   	    newpath[j] = path[i];
  @@ -271,17 +270,17 @@
   	if (n == 0)
   	    break;		/* EOF */
   	if (buf[0] == 'l') {
  -	    char *link;
  +	    char *link_ptr;
   
  -	    link = strstr(buf, " -> ");
  -	    filename = link;
  +	    link_ptr = strstr(buf, " -> ");
  +	    filename = link_ptr;
   	    do
   		filename--;
   	    while (filename[0] != ' ');
   	    *(filename++) = 0;
  -	    *(link++) = 0;
  +	    *(link_ptr++) = 0;
   	    ap_snprintf(urlptr, sizeof(urlptr), "%s%s%s", url, (url[strlen(url) - 1] == '/' ?
"" : "/"), filename);
  -	    ap_snprintf(buf2, sizeof(urlptr), "%s <A HREF=\"%s\">%s %s</A>\015\012",
buf, urlptr, filename, link);
  +	    ap_snprintf(buf2, sizeof(urlptr), "%s <A HREF=\"%s\">%s %s</A>\015\012",
buf, urlptr, filename, link_ptr);
   	    strncpy(buf, buf2, sizeof(buf) - 1);
   	    buf[sizeof(buf) - 1] = '\0';
   	    n = strlen(buf);
  @@ -394,7 +393,7 @@
    */
   int proxy_ftp_handler(request_rec *r, struct cache_req *c, char *url)
   {
  -    char *host, *path, *p, *user, *password, *parms;
  +    char *host, *path, *strp, *user, *password, *parms;
       const char *err;
       int port, userlen, i, j, len, sock, dsock, rc, nocache;
       int passlen = 0;
  @@ -406,7 +405,7 @@
       array_header *resp_hdrs;
       BUFF *f, *cache;
       BUFF *data = NULL;
  -    pool *pool = r->pool;
  +    pool *p = r->pool;
       int one = 1;
       const long int zero = 0L;
       NET_SIZE_T clen;
  @@ -433,7 +432,7 @@
   
   /* We break the URL into host, port, path-search */
   
  -    host = pstrdup(pool, url + 6);
  +    host = pstrdup(p, url + 6);
       port = DEFAULT_FTP_PORT;
       path = strchr(host, '/');
       if (path == NULL)
  @@ -443,16 +442,16 @@
   
       user = password = NULL;
       nocache = 0;
  -    p = strchr(host, '@');
  -    if (p != NULL) {
  -	(*p++) = '\0';
  +    strp = strchr(host, '@');
  +    if (strp != NULL) {
  +	(*strp++) = '\0';
   	user = host;
  -	host = p;
  +	host = strp;
   /* find password */
  -	p = strchr(user, ':');
  -	if (p != NULL) {
  -	    *(p++) = '\0';
  -	    password = p;
  +	strp = strchr(user, ':');
  +	if (strp != NULL) {
  +	    *(strp++) = '\0';
  +	    password = strp;
   	    passlen = decodeenc(password);
   	}
   	userlen = decodeenc(user);
  @@ -466,11 +465,11 @@
   	passlen = strlen(password);
       }
   
  -    p = strchr(host, ':');
  -    if (p != NULL) {
  -	*(p++) = '\0';
  -	if (isdigit(*p))
  -	    port = atoi(p);
  +    strp = strchr(host, ':');
  +    if (strp != NULL) {
  +	*(strp++) = '\0';
  +	if (isdigit(*strp))
  +	    port = atoi(strp);
       }
   
   /* check if ProxyBlock directive on this host */
  @@ -494,7 +493,7 @@
       if (err != NULL)
   	return proxyerror(r, err);	/* give up */
   
  -    sock = psocket(pool, PF_INET, SOCK_STREAM, IPPROTO_TCP);
  +    sock = psocket(p, PF_INET, SOCK_STREAM, IPPROTO_TCP);
       if (sock == -1) {
   	proxy_log_uerror("socket", NULL, "proxy: error creating socket",
   			 r->server);
  @@ -515,7 +514,7 @@
   		   sizeof(one)) == -1) {
   	proxy_log_uerror("setsockopt", NULL,
   			 "proxy: error setting reuseaddr option", r->server);
  -	pclosesocket(pool, sock);
  +	pclosesocket(p, sock);
   	return SERVER_ERROR;
       }
   
  @@ -542,11 +541,11 @@
       }
   #endif
       if (i == -1) {
  -	pclosesocket(pool, sock);
  +	pclosesocket(p, sock);
   	return proxyerror(r, "Could not connect to remote machine");
       }
   
  -    f = bcreate(pool, B_RDWR | B_SOCKET);
  +    f = bcreate(p, B_RDWR | B_SOCKET);
       bpushfd(f, sock, sock);
   /* shouldn't we implement telnet control options here? */
   
  @@ -622,10 +621,10 @@
    * machine
    */
       for (;;) {
  -	p = strchr(path, '/');
  -	if (p == NULL)
  +	strp = strchr(path, '/');
  +	if (strp == NULL)
   	    break;
  -	*p = '\0';
  +	*strp = '\0';
   
   	len = decodeenc(path);
   	bputs("CWD ", f);
  @@ -650,7 +649,7 @@
   	    return BAD_GATEWAY;
   	}
   
  -	path = p + 1;
  +	path = strp + 1;
       }
   
       if (parms != NULL && strncmp(parms, "type=", 5) == 0) {
  @@ -688,7 +687,7 @@
       }
   
   /* try to set up PASV data connection first */
  -    dsock = psocket(pool, PF_INET, SOCK_STREAM, IPPROTO_TCP);
  +    dsock = psocket(p, PF_INET, SOCK_STREAM, IPPROTO_TCP);
       if (dsock == -1) {
   	proxy_log_uerror("socket", NULL, "proxy: error creating PASV socket",
   			 r->server);
  @@ -714,7 +713,7 @@
       if (i == -1) {
   	proxy_log_uerror("command", NULL, "PASV: control connection is toast",
   			 r->server);
  -	pclosesocket(pool, dsock);
  +	pclosesocket(p, dsock);
   	bclose(f);
   	kill_timeout(r);
   	return SERVER_ERROR;
  @@ -754,7 +753,7 @@
   	    }
   	}
   	else
  -	    pclosesocket(pool, dsock);	/* and try the regular way */
  +	    pclosesocket(p, dsock);	/* and try the regular way */
       }
   
       if (!pasvmode) {		/* set up data connection */
  @@ -767,7 +766,7 @@
   	    return SERVER_ERROR;
   	}
   
  -	dsock = psocket(pool, PF_INET, SOCK_STREAM, IPPROTO_TCP);
  +	dsock = psocket(p, PF_INET, SOCK_STREAM, IPPROTO_TCP);
   	if (dsock == -1) {
   	    proxy_log_uerror("socket", NULL, "proxy: error creating socket",
   			     r->server);
  @@ -780,7 +779,7 @@
   		       sizeof(one)) == -1) {
   	    proxy_log_uerror("setsockopt", NULL,
   			"proxy: error setting reuseaddr option", r->server);
  -	    pclosesocket(pool, dsock);
  +	    pclosesocket(p, dsock);
   	    bclose(f);
   	    kill_timeout(r);
   	    return SERVER_ERROR;
  @@ -794,7 +793,7 @@
   	    proxy_log_uerror("bind", buff,
   		      "proxy: error binding to ftp data socket", r->server);
   	    bclose(f);
  -	    pclosesocket(pool, dsock);
  +	    pclosesocket(p, dsock);
   	    return SERVER_ERROR;
   	}
   	listen(dsock, 2);	/* only need a short queue */
  @@ -905,7 +904,7 @@
       r->status = 200;
       r->status_line = "200 OK";
   
  -    resp_hdrs = make_array(pool, 2, sizeof(struct hdr_entry));
  +    resp_hdrs = make_array(p, 2, sizeof(struct hdr_entry));
       if (parms[0] == 'd')
   	proxy_add_header(resp_hdrs, "Content-Type", "text/html", HDR_REP);
       else {
  @@ -930,7 +929,7 @@
       i = proxy_cache_update(c, resp_hdrs, 0, nocache);
   
       if (i != DECLINED) {
  -	pclosesocket(pool, dsock);
  +	pclosesocket(p, dsock);
   	bclose(f);
   	return i;
       }
  @@ -945,19 +944,19 @@
   	if (csd == -1) {
   	    proxy_log_uerror("accept", NULL,
   		      "proxy: failed to accept data connection", r->server);
  -	    pclosesocket(pool, dsock);
  +	    pclosesocket(p, dsock);
   	    bclose(f);
   	    kill_timeout(r);
   	    proxy_cache_error(c);
   	    return BAD_GATEWAY;
   	}
  -	note_cleanups_for_socket(pool, csd);
  -	data = bcreate(pool, B_RDWR | B_SOCKET);
  +	note_cleanups_for_socket(p, csd);
  +	data = bcreate(p, B_RDWR | B_SOCKET);
   	bpushfd(data, csd, -1);
   	kill_timeout(r);
       }
       else {
  -	data = bcreate(pool, B_RDWR | B_SOCKET);
  +	data = bcreate(p, B_RDWR | B_SOCKET);
   	bpushfd(data, dsock, dsock);
       }
   
  
  
  
  1.34      +25 -25    apachen/src/modules/proxy/proxy_http.c
  
  Index: proxy_http.c
  ===================================================================
  RCS file: /export/home/cvs/apachen/src/modules/proxy/proxy_http.c,v
  retrieving revision 1.33
  retrieving revision 1.34
  diff -u -r1.33 -r1.34
  --- proxy_http.c	1997/09/16 00:59:40	1.33
  +++ proxy_http.c	1997/09/18 00:20:19	1.34
  @@ -147,7 +147,7 @@
   int proxy_http_handler(request_rec *r, struct cache_req *c, char *url,
   		       const char *proxyhost, int proxyport)
   {
  -    char *p;
  +    char *strp;
       const char *err, *desthost;
       int i, j, sock, len, backasswards;
       array_header *reqhdrs_arr, *resp_hdrs;
  @@ -158,7 +158,7 @@
       BUFF *f, *cache;
       struct hdr_entry *hdr;
       char buffer[HUGE_STRING_LEN];
  -    pool *pool = r->pool;
  +    pool *p = r->pool;
       const long int zero = 0L;
       int destport = 0;
       char *destportstr = NULL;
  @@ -181,25 +181,25 @@
   	return BAD_REQUEST;
       urlptr += 3;
       destport = DEFAULT_PORT;
  -    p = strchr(urlptr, '/');
  -    if (p == NULL) {
  -	desthost = pstrdup(pool, urlptr);
  +    strp = strchr(urlptr, '/');
  +    if (strp == NULL) {
  +	desthost = pstrdup(p, urlptr);
   	urlptr = "/";
       }
       else {
  -	char *q = palloc(pool, p - urlptr + 1);
  -	memcpy(q, urlptr, p - urlptr);
  -	q[p - urlptr] = '\0';
  -	urlptr = p;
  +	char *q = palloc(p, strp - urlptr + 1);
  +	memcpy(q, urlptr, strp - urlptr);
  +	q[strp - urlptr] = '\0';
  +	urlptr = strp;
   	desthost = q;
       }
   
  -    p = strchr(desthost, ':');
  -    if (p != NULL) {
  -	*(p++) = '\0';
  -	if (isdigit(*p)) {
  -	    destport = atoi(p);
  -	    destportstr = p;
  +    strp = strchr(desthost, ':');
  +    if (strp != NULL) {
  +	*(strp++) = '\0';
  +	if (isdigit(*strp)) {
  +	    destport = atoi(strp);
  +	    destportstr = strp;
   	}
       }
   
  @@ -224,7 +224,7 @@
   	    return proxyerror(r, err);	/* give up */
       }
   
  -    sock = psocket(pool, PF_INET, SOCK_STREAM, IPPROTO_TCP);
  +    sock = psocket(p, PF_INET, SOCK_STREAM, IPPROTO_TCP);
       if (sock == -1) {
   	aplog_error(APLOG_MARK, APLOG_ERR, r->server,
   		    "proxy: error creating socket");
  @@ -272,7 +272,7 @@
   
       clear_connection(r->headers_in);	/* Strip connection-based headers */
   
  -    f = bcreate(pool, B_RDWR | B_SOCKET);
  +    f = bcreate(p, B_RDWR | B_SOCKET);
       bpushfd(f, sock, sock);
   
       hard_timeout("proxy send", r);
  @@ -328,13 +328,13 @@
   	buffer[12] = '\0';
   	r->status = atoi(&buffer[9]);
   	buffer[12] = ' ';
  -	r->status_line = pstrdup(pool, &buffer[9]);
  +	r->status_line = pstrdup(p, &buffer[9]);
   
   /* read the headers. */
   /* N.B. for HTTP/1.0 clients, we have to fold line-wrapped headers */
   /* Also, take care with headers with multiple occurences. */
   
  -	resp_hdrs = proxy_read_headers(pool, buffer, HUGE_STRING_LEN, f);
  +	resp_hdrs = proxy_read_headers(p, buffer, HUGE_STRING_LEN, f);
   
   	clear_connection((table *) resp_hdrs);	/* Strip Connection hdrs */
       }
  @@ -345,7 +345,7 @@
   	r->status_line = "200 OK";
   
   /* no headers */
  -	resp_hdrs = make_array(pool, 2, sizeof(struct hdr_entry));
  +	resp_hdrs = make_array(p, 2, sizeof(struct hdr_entry));
       }
   
       kill_timeout(r);
  @@ -359,11 +359,11 @@
       for (i = 0; i < resp_hdrs->nelts; i++) {
   	if (hdr[i].value[0] == '\0')
   	    continue;
  -	p = hdr[i].field;
  -	if (strcasecmp(p, "Date") == 0 ||
  -	    strcasecmp(p, "Last-Modified") == 0 ||
  -	    strcasecmp(p, "Expires") == 0)
  -	    hdr[i].value = proxy_date_canon(pool, hdr[i].value);
  +	strp = hdr[i].field;
  +	if (strcasecmp(strp, "Date") == 0 ||
  +	    strcasecmp(strp, "Last-Modified") == 0 ||
  +	    strcasecmp(strp, "Expires") == 0)
  +	    hdr[i].value = proxy_date_canon(p, hdr[i].value);
       }
   
   /* check if NoCache directive on this host */
  
  
  
  1.32      +52 -52    apachen/src/modules/proxy/proxy_util.c
  
  Index: proxy_util.c
  ===================================================================
  RCS file: /export/home/cvs/apachen/src/modules/proxy/proxy_util.c,v
  retrieving revision 1.31
  retrieving revision 1.32
  diff -u -r1.31 -r1.32
  --- proxy_util.c	1997/09/16 00:59:41	1.31
  +++ proxy_util.c	1997/09/18 00:20:20	1.32
  @@ -192,11 +192,11 @@
    * Returns an error string.
    */
   char *
  -     proxy_canon_netloc(pool *pool, char **const urlp, char **userp,
  +     proxy_canon_netloc(pool *p, char **const urlp, char **userp,
   			char **passwordp, char **hostp, int *port)
   {
       int i;
  -    char *p, *host, *url = *urlp;
  +    char *strp, *host, *url = *urlp;
   
       if (url[0] != '/' || url[1] != '/')
   	return "Malformed URL";
  @@ -209,23 +209,23 @@
   
       if (userp != NULL) {
   	char *user = NULL, *password = NULL;
  -	p = strchr(host, '@');
  +	strp = strchr(host, '@');
   
  -	if (p != NULL) {
  -	    *p = '\0';
  +	if (strp != NULL) {
  +	    *strp = '\0';
   	    user = host;
  -	    host = p + 1;
  +	    host = strp + 1;
   
   /* find password */
  -	    p = strchr(user, ':');
  -	    if (p != NULL) {
  -		*p = '\0';
  -		password = proxy_canonenc(pool, p + 1, strlen(p + 1), enc_user, 1);
  +	    strp = strchr(user, ':');
  +	    if (strp != NULL) {
  +		*strp = '\0';
  +		password = proxy_canonenc(p, strp + 1, strlen(strp + 1), enc_user, 1);
   		if (password == NULL)
   		    return "Bad %-escape in URL (password)";
   	    }
   
  -	    user = proxy_canonenc(pool, user, strlen(user), enc_user, 1);
  +	    user = proxy_canonenc(p, user, strlen(user), enc_user, 1);
   	    if (user == NULL)
   		return "Bad %-escape in URL (username)";
   	}
  @@ -233,17 +233,17 @@
   	*passwordp = password;
       }
   
  -    p = strchr(host, ':');
  -    if (p != NULL) {
  -	*(p++) = '\0';
  +    strp = strchr(host, ':');
  +    if (strp != NULL) {
  +	*(strp++) = '\0';
   
  -	for (i = 0; p[i] != '\0'; i++)
  -	    if (!isdigit(p[i]))
  +	for (i = 0; strp[i] != '\0'; i++)
  +	    if (!isdigit(strp[i]))
   		break;
   
  -	if (i == 0 || p[i] != '\0')
  +	if (i == 0 || strp[i] != '\0')
   	    return "Bad port number in URL";
  -	*port = atoi(p);
  +	*port = atoi(strp);
   	if (*port > 65535)
   	    return "Port number in URL > 65535";
       }
  @@ -265,7 +265,7 @@
       }
   
   /*    if (strchr(host,'.') == NULL && domain != NULL)
  -   host = pstrcat(pool, host, domain, NULL);
  +   host = pstrcat(p, host, domain, NULL);
    */
       *urlp = url;
       *hostp = host;
  @@ -349,14 +349,14 @@
    * Returns NULL on file error
    */
   array_header *
  -             proxy_read_headers(pool *pool, char *buffer, int size, BUFF *f)
  +             proxy_read_headers(pool *p, char *buffer, int size, BUFF *f)
   {
       int gotcr, len, i, j;
       array_header *resp_hdrs;
       struct hdr_entry *hdr;
  -    char *p;
  +    char *strp;
   
  -    resp_hdrs = make_array(pool, 10, sizeof(struct hdr_entry));
  +    resp_hdrs = make_array(p, 10, sizeof(struct hdr_entry));
       hdr = NULL;
   
       gotcr = 1;
  @@ -385,13 +385,13 @@
   		gotcr = 1;
   		continue;
   	    }
  -	    hdr->value = pstrcat(pool, hdr->value, buffer, NULL);
  +	    hdr->value = pstrcat(p, hdr->value, buffer, NULL);
   	}
   	else if (gotcr && len == 0)
   	    break;
   	else {
  -	    p = strchr(buffer, ':');
  -	    if (p == NULL) {
  +	    strp = strchr(buffer, ':');
  +	    if (strp == NULL) {
   		/* error!! */
   		if (!gotcr) {
   		    i = bskiplf(f);
  @@ -403,22 +403,22 @@
   		continue;
   	    }
   	    hdr = push_array(resp_hdrs);
  -	    *(p++) = '\0';
  -	    hdr->field = pstrdup(pool, buffer);
  -	    while (*p == ' ' || *p == '\t')
  -		p++;
  -	    hdr->value = pstrdup(pool, p);
  +	    *(strp++) = '\0';
  +	    hdr->field = pstrdup(p, buffer);
  +	    while (*strp == ' ' || *strp == '\t')
  +		strp++;
  +	    hdr->value = pstrdup(p, strp);
   	    gotcr = i;
   	}
       }
   
       hdr = (struct hdr_entry *) resp_hdrs->elts;
       for (i = 0; i < resp_hdrs->nelts; i++) {
  -	p = hdr[i].value;
  -	j = strlen(p);
  -	while (j > 0 && (p[j - 1] == ' ' || p[j - 1] == '\t'))
  +	strp = hdr[i].value;
  +	j = strlen(strp);
  +	while (j > 0 && (strp[j - 1] == ' ' || strp[j - 1] == '\t'))
   	    j--;
  -	p[j] = '\0';
  +	strp[j] = '\0';
       }
   
       return resp_hdrs;
  @@ -609,7 +609,7 @@
       char tmp[26];
       int i, k, d;
       unsigned int x;
  -    static const char table[32] = "abcdefghijklmnopqrstuvwxyz012345";
  +    static const char enc_table[32] = "abcdefghijklmnopqrstuvwxyz012345";
   
       MD5Init(&context);
       MD5Update(&context, (const unsigned char *) it, strlen(it));
  @@ -621,20 +621,20 @@
    */
       for (i = 0, k = 0; i < 15; i += 5) {
   	x = (digest[i] << 24) | (digest[i + 1] << 16) | (digest[i + 2] << 8)
| digest[i + 3];
  -	tmp[k++] = table[x >> 27];
  -	tmp[k++] = table[(x >> 22) & 0x1f];
  -	tmp[k++] = table[(x >> 17) & 0x1f];
  -	tmp[k++] = table[(x >> 12) & 0x1f];
  -	tmp[k++] = table[(x >> 7) & 0x1f];
  -	tmp[k++] = table[(x >> 2) & 0x1f];
  +	tmp[k++] = enc_table[x >> 27];
  +	tmp[k++] = enc_table[(x >> 22) & 0x1f];
  +	tmp[k++] = enc_table[(x >> 17) & 0x1f];
  +	tmp[k++] = enc_table[(x >> 12) & 0x1f];
  +	tmp[k++] = enc_table[(x >> 7) & 0x1f];
  +	tmp[k++] = enc_table[(x >> 2) & 0x1f];
   	x = ((x & 0x3) << 8) | digest[i + 4];
  -	tmp[k++] = table[x >> 5];
  -	tmp[k++] = table[x & 0x1f];
  +	tmp[k++] = enc_table[x >> 5];
  +	tmp[k++] = enc_table[x & 0x1f];
       }
   /* one byte left */
       x = digest[15];
  -    tmp[k++] = table[x >> 3];	/* use up 5 bits */
  -    tmp[k++] = table[x & 0x7];
  +    tmp[k++] = enc_table[x >> 3];	/* use up 5 bits */
  +    tmp[k++] = enc_table[x & 0x7];
       /* now split into directory levels */
   
       for (i = k = d = 0; d < ndepth; ++d) {
  @@ -656,7 +656,7 @@
       char tmp[22];
       int i, k, d;
       unsigned int x;
  -    static const char table[64] =
  +    static const char enc_table[64] =
       "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789_@";
   
       MD5Init(&context);
  @@ -669,15 +669,15 @@
    */
       for (i = 0, k = 0; i < 15; i += 3) {
   	x = (digest[i] << 16) | (digest[i + 1] << 8) | digest[i + 2];
  -	tmp[k++] = table[x >> 18];
  -	tmp[k++] = table[(x >> 12) & 0x3f];
  -	tmp[k++] = table[(x >> 6) & 0x3f];
  -	tmp[k++] = table[x & 0x3f];
  +	tmp[k++] = enc_table[x >> 18];
  +	tmp[k++] = enc_table[(x >> 12) & 0x3f];
  +	tmp[k++] = enc_table[(x >> 6) & 0x3f];
  +	tmp[k++] = enc_table[x & 0x3f];
       }
   /* one byte left */
       x = digest[15];
  -    tmp[k++] = table[x >> 2];	/* use up 6 bits */
  -    tmp[k++] = table[(x << 4) & 0x3f];
  +    tmp[k++] = enc_table[x >> 2];	/* use up 6 bits */
  +    tmp[k++] = enc_table[(x << 4) & 0x3f];
       /* now split into directory levels */
   
       for (i = k = d = 0; d < ndepth; ++d) {
  
  
  

Mime
View raw message