diff options
Diffstat (limited to 'src/microhttpd/response.c')
-rw-r--r-- | src/microhttpd/response.c | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/src/microhttpd/response.c b/src/microhttpd/response.c index 9de4843d..d7835c20 100644 --- a/src/microhttpd/response.c +++ b/src/microhttpd/response.c | |||
@@ -119,6 +119,27 @@ MHD_add_response_header (struct MHD_Response *response, | |||
119 | const char *header, | 119 | const char *header, |
120 | const char *content) | 120 | const char *content) |
121 | { | 121 | { |
122 | if ( (MHD_str_equal_caseless_ (header, | ||
123 | MHD_HTTP_HEADER_TRANSFER_ENCODING)) && | ||
124 | (! MHD_str_equal_caseless_ (content, | ||
125 | "identity")) && | ||
126 | (! MHD_str_equal_caseless_ (content, | ||
127 | "chunked")) ) | ||
128 | { | ||
129 | /* Setting transfer encodings other than "identity" or | ||
130 | "chunked" is not allowed. Note that MHD will set the | ||
131 | correct transfer encoding if required automatically. */ | ||
132 | /* NOTE: for compressed bodies, use the "Content-encoding" header */ | ||
133 | return MHD_NO; | ||
134 | } | ||
135 | if (MHD_str_equal_caseless_ (header, | ||
136 | MHD_HTTP_HEADER_CONTENT_LENGTH)) | ||
137 | { | ||
138 | /* MHD will set Content-length if allowed and possible, | ||
139 | reject attempt by application */ | ||
140 | return MHD_NO; | ||
141 | } | ||
142 | |||
122 | return add_response_entry (response, | 143 | return add_response_entry (response, |
123 | MHD_HEADER_KIND, | 144 | MHD_HEADER_KIND, |
124 | header, | 145 | header, |