[libsoup] SoupBodyInputStream: fix hang reading empty chunked response



commit a5c449b83a401bcd509f858fd5a6caaf0acad089
Author: Dan Winship <danw gnome org>
Date:   Tue Jul 17 16:58:55 2012 -0400

    SoupBodyInputStream: fix hang reading empty chunked response
    
    Set the eof flag immediately after reading the last chunk, rather than
    waiting for the next read, since if the caller calls is_readable() or
    create_source() instead, we need to know to not wait for the
    base_stream to become readable.

 libsoup/soup-body-input-stream.c |    4 +++-
 1 files changed, 3 insertions(+), 1 deletions(-)
---
diff --git a/libsoup/soup-body-input-stream.c b/libsoup/soup-body-input-stream.c
index a38955f..ba4ce6a 100644
--- a/libsoup/soup-body-input-stream.c
+++ b/libsoup/soup-body-input-stream.c
@@ -211,8 +211,10 @@ again:
 		if (nread <= 0)
 			return nread;
 
-		if (strncmp (buffer, "\r\n", nread) || strncmp (buffer, "\n", nread))
+		if (strncmp (buffer, "\r\n", nread) || strncmp (buffer, "\n", nread)) {
 			bistream->priv->chunked_state = SOUP_BODY_INPUT_STREAM_STATE_DONE;
+			bistream->priv->eof = TRUE;
+		}
 		break;
 
 	case SOUP_BODY_INPUT_STREAM_STATE_DONE:



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]