summary refs log tree commit diff
diff options
context:
space:
mode:
authorJune McEnroe <june@causal.agency>2021-09-24 10:00:36 -0400
committerJune McEnroe <june@causal.agency>2021-09-24 10:00:36 -0400
commite1efaaec75603f4d3cb53cedc106d18abccc81af (patch)
treeac22b4cda93a3f0b544ce235de225711637f5363
parentScroll by single lines in xterm (diff)
downloadsrc-e1efaaec75603f4d3cb53cedc106d18abccc81af.tar.gz
src-e1efaaec75603f4d3cb53cedc106d18abccc81af.zip
Set only HTTP_HOST
And only because kcgi expects it. This is what I wrote originally,
because every HTTP_ variable should be unset between each request,
but this doesn't track them.
-rw-r--r--bin/quick.c10
1 files changed, 2 insertions, 8 deletions
diff --git a/bin/quick.c b/bin/quick.c
index b5b4aa3d..9e916ff0 100644
--- a/bin/quick.c
+++ b/bin/quick.c
@@ -15,7 +15,6 @@
  */
 
 #include <arpa/inet.h>
-#include <ctype.h>
 #include <err.h>
 #include <fcntl.h>
 #include <netdb.h>
@@ -70,13 +69,8 @@ static void request(int sock, char *argv[]) {
 		} else if (!strcasecmp(header, "Content-Length")) {
 			bodyLen = strtoull(value, NULL, 10);
 			setenv("CONTENT_LENGTH", value, 1);
-		} else {
-			char buf[256];
-			for (char *ch = header; *ch; ++ch) {
-				*ch = (*ch == '-' ? '_' : toupper(*ch));
-			}
-			snprintf(buf, sizeof(buf), "HTTP_%s", header);
-			setenv(buf, value, 1);
+		} else if (!strcasecmp(header, "Host")) {
+			setenv("HTTP_HOST", value, 1);
 		}
 	}