shithub: tcp80

Download patch

ref: 43181367955054ddaab1a11b248008e36b229cd2
parent: ff4aff5e2b7b0c46880430d89a1c44cb699d4838
author: grobe0ba <grobe0ba@tcp80.org>
date: Fri Mar 17 20:21:23 EDT 2023

minor cleanup of unused variables

--- a/tcp80.c
+++ b/tcp80.c
@@ -468,9 +468,7 @@
 redirerr(int status, Dir *d)
 {
 	static char buf[8192], tmp[1024], statbuf[32];
-	char *p, *s;
 	int i;
-	Pair *h;
 
 	for(i = 0; i < nelem(redir_errno); i++){
 		if(status == redir_errno[i]){
@@ -480,10 +478,6 @@
 
 			snprint(buf, sizeof(buf), "/%d%s", status, location);
 
-			h = findhdr(nil, "Host");
-			p = strchr(location, '?');
-			s = fullurl(h ? h->val : nil, urlenc(tmp, buf, sizeof(tmp)), "/",
-				    p ? p + 1 : nil);
 			print("Location: %s\r\n\r\n", buf);
 			return 1;
 		}
@@ -575,7 +569,7 @@
 
 			h = findhdr(nil, "Host");
 			p = strchr(location, '?');
-			s = fullurl(nil, urlenc(tmp, buf, sizeof(tmp)), "/", p ? p + 1 : nil);
+			s = fullurl(h ? h->val : nil, urlenc(tmp, buf, sizeof(tmp)), "/", p ? p + 1 : nil);
 			if(!nobody)
 				n = snprint(buf, sizeof(buf),
 					    "<html><head><title>%s</title></head>\n"