summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorflorian <florian@openbsd.org>2014-08-06 13:40:18 +0000
committerflorian <florian@openbsd.org>2014-08-06 13:40:18 +0000
commitaf746ff66261250f4fb62d74e7b1a460e2dddc79 (patch)
tree16cee15c409e2047c0f5fe0823bc02c503e80437
parentspacing (diff)
downloadwireguard-openbsd-af746ff66261250f4fb62d74e7b1a460e2dddc79.tar.xz
wireguard-openbsd-af746ff66261250f4fb62d74e7b1a460e2dddc79.zip
Content-Length and Content-Type are transmitted as CONTENT_LENGTH and
CONTENT_TYPE environment variables to cgi scripts, without the HTTP_ prefix. OK reyk@
-rw-r--r--usr.sbin/httpd/server_fcgi.c12
1 files changed, 9 insertions, 3 deletions
diff --git a/usr.sbin/httpd/server_fcgi.c b/usr.sbin/httpd/server_fcgi.c
index 1432646b352..d1c93552e5f 100644
--- a/usr.sbin/httpd/server_fcgi.c
+++ b/usr.sbin/httpd/server_fcgi.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: server_fcgi.c,v 1.21 2014/08/04 18:00:06 reyk Exp $ */
+/* $OpenBSD: server_fcgi.c,v 1.22 2014/08/06 13:40:18 florian Exp $ */
/*
* Copyright (c) 2014 Florian Obser <florian@openbsd.org>
@@ -541,8 +541,14 @@ server_fcgi_writeheader(struct client *clt, struct kv *hdr, void *arg)
val = hdr->kv_value;
- if (asprintf(&name, "HTTP_%s", key) == -1)
- return (-1);
+ if (strcasecmp(key, "Content-Length") == 0 ||
+ strcasecmp(key, "Content-Type") == 0) {
+ if ((name = strdup(key)) == NULL)
+ return (-1);
+ } else {
+ if (asprintf(&name, "HTTP_%s", key) == -1)
+ return (-1);
+ }
for (p = name; *p != '\0'; p++) {
if (isalpha((unsigned char)*p))