From fe54d1fe9dd3e36c22faf12206ac823d2d212d71 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Stefan=20B=C3=BChler?= Date: Fri, 17 Jul 2009 12:18:28 +0200 Subject: [PATCH] Send 400 if header parsing failed --- src/main/connection.c | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/src/main/connection.c b/src/main/connection.c index 265728d..59bd918 100644 --- a/src/main/connection.c +++ b/src/main/connection.c @@ -162,8 +162,16 @@ static gboolean connection_handle_read(liConnection *con) { case LI_HANDLER_ERROR: case LI_HANDLER_COMEBACK: /* unexpected */ /* unparsable header */ - li_connection_error(con); - return FALSE; + if (CORE_OPTION(LI_CORE_OPTION_DEBUG_REQUEST_HANDLING).boolean) { + VR_DEBUG(vr, "%s", "parsing header failed"); + } + con->keep_alive = FALSE; + con->mainvr->response.http_status = 400; + li_vrequest_handle_direct(con->mainvr); + con->state = LI_CON_STATE_WRITE; + con->in->is_closed = TRUE; + forward_response_body(con); + return TRUE; } con->wrk->stats.requests++;