diff options
author | Evgeny Grin (Karlson2k) <k2k@narod.ru> | 2022-10-21 09:53:05 +0300 |
---|---|---|
committer | Evgeny Grin (Karlson2k) <k2k@narod.ru> | 2022-10-22 09:48:06 +0300 |
commit | 692e8c56553a4ec0a432704816b8340711b68aed (patch) | |
tree | 1da9d255ad3dd329508341bf8fd81f8a99bd5c53 | |
parent | dd7f9dfe91f01cd56db0d64fe01b05eecae6ee3a (diff) | |
download | libmicrohttpd-692e8c56553a4ec0a432704816b8340711b68aed.tar.gz libmicrohttpd-692e8c56553a4ec0a432704816b8340711b68aed.zip |
Do not send "100 Continue" if request does not have a body
-rw-r--r-- | src/microhttpd/connection.c | 32 |
1 files changed, 21 insertions, 11 deletions
diff --git a/src/microhttpd/connection.c b/src/microhttpd/connection.c index 9589a2d8..885557b5 100644 --- a/src/microhttpd/connection.c +++ b/src/microhttpd/connection.c | |||
@@ -765,17 +765,27 @@ need_100_continue (struct MHD_Connection *connection) | |||
765 | { | 765 | { |
766 | const char *expect; | 766 | const char *expect; |
767 | 767 | ||
768 | return (MHD_IS_HTTP_VER_1_1_COMPAT (connection->rq.http_ver) && | 768 | if (! MHD_IS_HTTP_VER_1_1_COMPAT (connection->rq.http_ver)) |
769 | (MHD_NO != | 769 | return false; |
770 | MHD_lookup_connection_value_n (connection, | 770 | |
771 | MHD_HEADER_KIND, | 771 | if (0 == connection->rq.remaining_upload_size) |
772 | MHD_HTTP_HEADER_EXPECT, | 772 | return false; |
773 | MHD_STATICSTR_LEN_ ( | 773 | |
774 | MHD_HTTP_HEADER_EXPECT), | 774 | if (MHD_NO == |
775 | &expect, | 775 | MHD_lookup_connection_value_n (connection, |
776 | NULL)) && | 776 | MHD_HEADER_KIND, |
777 | (MHD_str_equal_caseless_ (expect, | 777 | MHD_HTTP_HEADER_EXPECT, |
778 | "100-continue")) ); | 778 | MHD_STATICSTR_LEN_ ( \ |
779 | MHD_HTTP_HEADER_EXPECT), | ||
780 | &expect, | ||
781 | NULL)) | ||
782 | return false; | ||
783 | |||
784 | if (MHD_str_equal_caseless_ (expect, | ||
785 | "100-continue")) | ||
786 | return true; | ||
787 | |||
788 | return false; | ||
779 | } | 789 | } |
780 | 790 | ||
781 | 791 | ||