diff options
Diffstat (limited to 'libwaitress/src')
-rw-r--r-- | libwaitress/src/waitress.c | 4 | ||||
-rw-r--r-- | libwaitress/src/waitress.h | 5 |
2 files changed, 7 insertions, 2 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; diff --git a/libwaitress/src/waitress.h b/libwaitress/src/waitress.h index 5c266ae..5fa1874 100644 --- a/libwaitress/src/waitress.h +++ b/libwaitress/src/waitress.h @@ -55,8 +55,9 @@ typedef enum {WAITRESS_RET_ERR = 0, WAITRESS_RET_OK, WAITRESS_RET_STATUS_UNKNOWN WAITRESS_RET_NOTFOUND, WAITRESS_RET_FORBIDDEN, WAITRESS_RET_CONNECT_REFUSED, WAITRESS_RET_SOCK_ERR, WAITRESS_RET_GETADDR_ERR, WAITRESS_RET_CB_ABORT, WAITRESS_RET_HDR_OVERFLOW, - WAITRESS_RET_PARTIAL_FILE, WAITRESS_RET_TIMEOUT, WAITRESS_RET_READ_ERR} - WaitressReturn_t; + WAITRESS_RET_PARTIAL_FILE, WAITRESS_RET_TIMEOUT, WAITRESS_RET_READ_ERR, + WAITRESS_RET_CONNECTION_CLOSED +} WaitressReturn_t; void WaitressInit (WaitressHandle_t *); void WaitressFree (WaitressHandle_t *); |