aboutsummaryrefslogtreecommitdiff
path: root/src/microhttpd/response.c
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2019-10-25 14:40:02 +0200
committerChristian Grothoff <christian@grothoff.org>2019-10-25 14:43:36 +0200
commit185f740e0684a8758cbf381fe5c44b3ed72d4a40 (patch)
tree854e7f65dede4766b179bf875b68e4aeeb453a9e /src/microhttpd/response.c
parent3e2ba2b1ced0b4c9d13961e89e43c3932399f6d6 (diff)
downloadlibmicrohttpd-185f740e0684a8758cbf381fe5c44b3ed72d4a40.tar.gz
libmicrohttpd-185f740e0684a8758cbf381fe5c44b3ed72d4a40.zip
allow clients to override sanity check for content-length header
Diffstat (limited to 'src/microhttpd/response.c')
-rw-r--r--src/microhttpd/response.c32
1 files changed, 20 insertions, 12 deletions
diff --git a/src/microhttpd/response.c b/src/microhttpd/response.c
index 112a622a..968fc8c9 100644
--- a/src/microhttpd/response.c
+++ b/src/microhttpd/response.c
@@ -147,8 +147,10 @@ MHD_add_response_header (struct MHD_Response *response,
147 /* NOTE: for compressed bodies, use the "Content-encoding" header */ 147 /* NOTE: for compressed bodies, use the "Content-encoding" header */
148 return MHD_NO; 148 return MHD_NO;
149 } 149 }
150 if (MHD_str_equal_caseless_ (header, 150 if ( (0 == (MHD_RF_INSANITY_HEADER_CONTENT_LENGTH
151 MHD_HTTP_HEADER_CONTENT_LENGTH)) 151 & response->flags)) &&
152 (MHD_str_equal_caseless_ (header,
153 MHD_HTTP_HEADER_CONTENT_LENGTH)) )
152 { 154 {
153 /* MHD will set Content-length if allowed and possible, 155 /* MHD will set Content-length if allowed and possible,
154 reject attempt by application */ 156 reject attempt by application */
@@ -838,17 +840,20 @@ MHD_upgrade_action (struct MHD_UpgradeResponseHandle *urh,
838 return MHD_YES; 840 return MHD_YES;
839 } 841 }
840 else 842 else
841#else 843#endif
842 { 844 {
843 if (0 == 845 if (0 ==
844 MHD_socket_cork_ (connection->socket_fd, 846 MHD_socket_cork_ (connection->socket_fd,
845 true)) 847 true))
848 {
846 connection->sk_cork_on = true; 849 connection->sk_cork_on = true;
847 }
848#endif
849 case MHD_UPGRADE_ACTION_CORK_OFF:
850 if (! connection->sk_cork_on)
851 return MHD_YES; 850 return MHD_YES;
851 }
852 return MHD_NO;
853 }
854 case MHD_UPGRADE_ACTION_CORK_OFF:
855 if (! connection->sk_cork_on)
856 return MHD_YES;
852#ifdef HTTPS_SUPPORT 857#ifdef HTTPS_SUPPORT
853 if (0 != (daemon->options & MHD_USE_TLS) ) 858 if (0 != (daemon->options & MHD_USE_TLS) )
854 { 859 {
@@ -857,17 +862,20 @@ MHD_upgrade_action (struct MHD_UpgradeResponseHandle *urh,
857 return MHD_YES; 862 return MHD_YES;
858 } 863 }
859 else 864 else
860#else 865#endif
861 { 866 {
862 if (0 == 867 if (0 ==
863 MHD_socket_cork_ (connection->socket_fd, 868 MHD_socket_cork_ (connection->socket_fd,
864 false)) 869 false))
870 {
865 connection->sk_cork_on = false; 871 connection->sk_cork_on = false;
866 } 872 return MHD_YES;
867#endif 873 }
868 default:
869 /* we don't understand this one */
870 return MHD_NO; 874 return MHD_NO;
875 }
876 default:
877 /* we don't understand this one */
878 return MHD_NO;
871 } 879 }
872} 880}
873 881