From b0c03a60fa6438f10e8cf74cac482243a7938990 Mon Sep 17 00:00:00 2001 From: Lars-Dominik Braun Date: Mon, 19 Sep 2011 21:04:55 +0200 Subject: waitress: fix chunked handler return values --- src/libwaitress/waitress.c | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) (limited to 'src') diff --git a/src/libwaitress/waitress.c b/src/libwaitress/waitress.c index 705d8dc..2101e2a 100644 --- a/src/libwaitress/waitress.c +++ b/src/libwaitress/waitress.c @@ -535,12 +535,18 @@ static WaitressHandlerReturn_t WaitressHandleChunked (WaitressHandle_t *waith, size_t remaining = size-(content-buf); if (remaining >= waith->request.chunkSize) { - WaitressHandleIdentity (waith, content, waith->request.chunkSize); + if (WaitressHandleIdentity (waith, content, + waith->request.chunkSize) == WAITRESS_HANDLER_ABORTED) { + return WAITRESS_HANDLER_ABORTED; + } /* FIXME: skip trailing \r\n */ content += waith->request.chunkSize+2; waith->request.chunkSize = 0; } else { - WaitressHandleIdentity (waith, content, remaining); + if (WaitressHandleIdentity (waith, content, remaining) == + WAITRESS_HANDLER_ABORTED) { + return WAITRESS_HANDLER_ABORTED; + } waith->request.chunkSize -= remaining; return WAITRESS_HANDLER_CONTINUE; } @@ -557,11 +563,12 @@ static WaitressHandlerReturn_t WaitressHandleChunked (WaitressHandle_t *waith, content = nextContent; } } else { - return WAITRESS_HANDLER_CONTINUE; + return WAITRESS_HANDLER_ERR; } } - return WAITRESS_HANDLER_CONTINUE; + assert (0); + return WAITRESS_HANDLER_ERR; } /* handle http header -- cgit v1.2.3