summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/libwaitress/waitress.c33
1 files changed, 8 insertions, 25 deletions
diff --git a/src/libwaitress/waitress.c b/src/libwaitress/waitress.c
index 1099252..8202a38 100644
--- a/src/libwaitress/waitress.c
+++ b/src/libwaitress/waitress.c
@@ -859,11 +859,11 @@ WaitressReturn_t WaitressFetchCall (WaitressHandle_t *waith) {
bufFilled -= (thisLine-buf);
} /* end while hdrParseMode */
- /* push remaining bytes */
- if (bufFilled > 0) {
+ recvSize = bufFilled;
+ do {
/* data must be \0-terminated for chunked handler */
- buf[bufFilled] = '\0';
- switch (waith->request.dataHandler (waith, buf, bufFilled)) {
+ buf[recvSize] = '\0';
+ switch (waith->request.dataHandler (waith, buf, recvSize)) {
case WAITRESS_HANDLER_DONE:
FINISH (WAITRESS_RET_OK);
break;
@@ -875,29 +875,12 @@ WaitressReturn_t WaitressFetchCall (WaitressHandle_t *waith) {
case WAITRESS_HANDLER_ABORTED:
FINISH (WAITRESS_RET_CB_ABORT);
break;
- }
- }
-
- /* receive content */
- do {
- READ_RET (buf, WAITRESS_BUFFER_SIZE-1, &recvSize);
- buf[recvSize] = '\0';
- if (recvSize > 0) {
- /* FIXME: Copy&waste */
- switch (waith->request.dataHandler (waith, buf, recvSize)) {
- case WAITRESS_HANDLER_DONE:
- FINISH (WAITRESS_RET_OK);
- break;
-
- case WAITRESS_HANDLER_ERR:
- FINISH (WAITRESS_RET_DECODING_ERR);
- break;
- case WAITRESS_HANDLER_ABORTED:
- FINISH (WAITRESS_RET_CB_ABORT);
- break;
- }
+ case WAITRESS_HANDLER_CONTINUE:
+ /* go on */
+ break;
}
+ READ_RET (buf, WAITRESS_BUFFER_SIZE-1, &recvSize);
} while (recvSize > 0);
finish: