aboutsummaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorAndy Green <andy.green@linaro.org>2013-12-09 11:27:07 +0800
committerAndy Green <andy.green@linaro.org>2013-12-09 11:27:07 +0800
commitaa084920213d0f3bfc05a2868a2391c2f9a91dc4 (patch)
tree272bddf1d8bcbb7963768850a672cbe3fda5f630 /lib
parentca1533854552f073ce38172793c98772c88023e9 (diff)
downloadlibwebsockets-aa084920213d0f3bfc05a2868a2391c2f9a91dc4.tar.gz
solve broken partial file sends
We can't force the wsi state to HTTP_BODY without considering the callback may already have set the state to sending a file. This fixes the bug that we can get stalled in the test app at "choked before able to send whole file" Signed-off-by: Andy Green <andy.green@linaro.org>
Diffstat (limited to 'lib')
-rw-r--r--lib/handshake.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/lib/handshake.c b/lib/handshake.c
index 48b27672..69daf755 100644
--- a/lib/handshake.c
+++ b/lib/handshake.c
@@ -277,11 +277,13 @@ leave:
AWAITING_TIMEOUT);
/*
+ * (if callback didn't start sending a file)
* deal with anything else as body, whether
* there was a content-length or not
*/
- wsi->state = WSI_STATE_HTTP_BODY;
+ if (wsi->state != WSI_STATE_HTTP_ISSUING_FILE)
+ wsi->state = WSI_STATE_HTTP_BODY;
goto http_postbody;
}