summaryrefslogtreecommitdiff
path: root/libwaitress/src/waitress.c
diff options
context:
space:
mode:
Diffstat (limited to 'libwaitress/src/waitress.c')
-rw-r--r--libwaitress/src/waitress.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/libwaitress/src/waitress.c b/libwaitress/src/waitress.c
index 26ed493..70a1547 100644
--- a/libwaitress/src/waitress.c
+++ b/libwaitress/src/waitress.c
@@ -394,6 +394,10 @@ WaitressReturn_t WaitressFetchCall (WaitressHandle_t *waith) {
nextLine = recvBuf;
while (hdrParseMode != HDRM_FINISHED) {
READ_RET (recvBuf+bufFilled, sizeof (recvBuf)-1 - bufFilled, &recvSize);
+ if (recvSize == 0) {
+ /* connection closed too early */
+ CLOSE_RET (WAITRESS_RET_CONNECTION_CLOSED);
+ }
bufFilled += recvSize;
memset (recvBuf+bufFilled, 0, sizeof (recvBuf) - bufFilled);
thisLine = recvBuf;