]> source.dussan.org Git - rspamd.git/commitdiff
[Minor] Deal with HTTP requests without content length
authorVsevolod Stakhov <vsevolod@highsecure.ru>
Sun, 5 Feb 2017 14:24:52 +0000 (15:24 +0100)
committerVsevolod Stakhov <vsevolod@highsecure.ru>
Sun, 5 Feb 2017 14:24:52 +0000 (15:24 +0100)
src/libutil/http.c

index 47c1836d3f3961ae4281101a8390a3ab3300dcb6..649cebeb22d2097106da17dba950737045821ca7 100644 (file)
@@ -1197,17 +1197,21 @@ rspamd_http_event_handler (int fd, short what, gpointer ud)
                        }
                }
                else if (r == 0) {
-                       if (!conn->finished) {
-                               err = g_error_new (HTTP_ERROR,
-                                               errno,
-                                               "IO read error: unexpected EOF");
-                               conn->error_handler (conn, err);
-                               g_error_free (err);
-                       }
-                       REF_RELEASE (pbuf);
-                       rspamd_http_connection_unref (conn);
+                       /* We can still call http parser */
+                       if (http_parser_execute (&priv->parser, &priv->parser_cb, d, r)
+                                       != (size_t)r) {
+                               if (!conn->finished) {
+                                       err = g_error_new (HTTP_ERROR,
+                                                       errno,
+                                                       "IO read error: unexpected EOF");
+                                       conn->error_handler (conn, err);
+                                       g_error_free (err);
+                               }
+                               REF_RELEASE (pbuf);
+                               rspamd_http_connection_unref (conn);
 
-                       return;
+                               return;
+                       }
                }
                else {
                        if (!priv->ssl) {