Last active
August 16, 2017 05:03
-
-
Save milkey-mouse/1d96e72a0af8c3e56736af42f922c6bc to your computer and use it in GitHub Desktop.
Set the charset of all text MIME-typed requests to utf-8 (hacky)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Index: server_http.c | |
=================================================================== | |
RCS file: /cvs/src/usr.sbin/httpd/server_http.c,v | |
retrieving revision 1.117 | |
diff -u -p -r1.117 server_http.c | |
--- server_http.c 15 May 2017 10:40:47 -0000 1.117 | |
+++ server_http.c 18 Jul 2017 02:51:19 -0000 | |
@@ -1388,7 +1388,8 @@ server_response_http(struct client *clt, | |
/* Set media type */ | |
if ((ct = kv_add(&resp->http_headers, "Content-Type", NULL)) == NULL || | |
- kv_set(ct, "%s/%s", media->media_type, media->media_subtype) == -1) | |
+ kv_set(ct, "%s/%s%s", media->media_type, media->media_subtype, | |
+ strcmp(media->media_type, "text") ? "" : "; charset=utf-8") == -1) | |
return (-1); | |
/* Set content length, if specified */ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment