summaryrefslogtreecommitdiffstats
path: root/usr.sbin/httpd/server_http.c
diff options
context:
space:
mode:
authorreyk <reyk@openbsd.org>2015-07-18 06:00:43 +0000
committerreyk <reyk@openbsd.org>2015-07-18 06:00:43 +0000
commitd24f6b1ee32aebb1a8ac74ce07c0b86a2f00a39d (patch)
tree3594611f1ca24fd417a118a97646277bc904f74e /usr.sbin/httpd/server_http.c
parentInsist that manual page file name extensions must begin with a digit, (diff)
downloadwireguard-openbsd-d24f6b1ee32aebb1a8ac74ce07c0b86a2f00a39d.tar.xz
wireguard-openbsd-d24f6b1ee32aebb1a8ac74ce07c0b86a2f00a39d.zip
Allow to change the default media type globally or per-location,
eg. default type text/html. OK florian@
Diffstat (limited to 'usr.sbin/httpd/server_http.c')
-rw-r--r--usr.sbin/httpd/server_http.c9
1 files changed, 4 insertions, 5 deletions
diff --git a/usr.sbin/httpd/server_http.c b/usr.sbin/httpd/server_http.c
index 75cecc74257..d51359f609b 100644
--- a/usr.sbin/httpd/server_http.c
+++ b/usr.sbin/httpd/server_http.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: server_http.c,v 1.90 2015/07/18 05:41:19 florian Exp $ */
+/* $OpenBSD: server_http.c,v 1.91 2015/07/18 06:00:43 reyk Exp $ */
/*
* Copyright (c) 2006 - 2015 Reyk Floeter <reyk@openbsd.org>
@@ -1227,7 +1227,8 @@ server_response_http(struct client *clt, u_int code,
struct kv *ct, *cl;
char tmbuf[32];
- if (desc == NULL || (error = server_httperror_byid(code)) == NULL)
+ if (desc == NULL || media == NULL ||
+ (error = server_httperror_byid(code)) == NULL)
return (-1);
if (server_log_http(clt, code, size) == -1)
@@ -1252,9 +1253,7 @@ server_response_http(struct client *clt, u_int code,
/* Set media type */
if ((ct = kv_add(&resp->http_headers, "Content-Type", NULL)) == NULL ||
- kv_set(ct, "%s/%s",
- media == NULL ? "application" : media->media_type,
- media == NULL ? "octet-stream" : media->media_subtype) == -1)
+ kv_set(ct, "%s/%s", media->media_type, media->media_subtype) == -1)
return (-1);
/* Set content length, if specified */