diff options
author | Gustavo Noronha Silva <gustavo.noronha@collabora.co.uk> | 2009-07-10 14:29:28 +0100 |
---|---|---|
committer | Gustavo Noronha Silva <gns@gnome.org> | 2009-07-10 15:47:11 +0100 |
commit | 2c0d924c6808b20540a76d0d2e9c266dc441b862 (patch) | |
tree | 9b80ed5a1df9bcbf94c201ee1fe81404590b6c7e /libsoup | |
parent | aad40ac467d12a188aed01e543aef5016aa4d3cb (diff) | |
download | libsoup-2c0d924c6808b20540a76d0d2e9c266dc441b862.tar.gz |
Actually test chunked encoding, and fix some hangs
The test was not really testing chunked encoding, because of incorrect
handling of the query string in the SoupURI, now it does. This has
exposed a couple hangs.
This change also avoids hanging on chunked encoding messages on the
sniffing test by calling soup_message_body_complete(), and by
sanitizing IO read state and read_length inconditionally when we reach
got_body, during message IO.
Diffstat (limited to 'libsoup')
-rw-r--r-- | libsoup/soup-message-io.c | 18 |
1 files changed, 8 insertions, 10 deletions
diff --git a/libsoup/soup-message-io.c b/libsoup/soup-message-io.c index 10657b7e..5951e989 100644 --- a/libsoup/soup-message-io.c +++ b/libsoup/soup-message-io.c @@ -866,6 +866,14 @@ io_read (SoupSocket *sock, SoupMessage *msg) return; got_body: + /* If we end up returning, read_state needs to be set + * to IO_STATE_BODY, and read_length must be 0; since + * we may be coming from STATE_TRAILERS, or may be + * doing a read-to-eof, we sanitize these here. + */ + io->read_state = SOUP_MESSAGE_IO_STATE_BODY; + io->read_length = 0; + /* A chunk of data may have been read and the emission * of got_chunk delayed because we wanted to wait for * more chunks to arrive, for doing content sniffing, @@ -885,16 +893,6 @@ io_read (SoupSocket *sock, SoupMessage *msg) soup_buffer_free (sniffed_buffer); soup_message_body_free (io->delayed_chunk_data); io->delayed_chunk_data = NULL; - - /* If we end up returning, read_state - * needs to be set to IO_STATE_BODY, - * and read_length must be 0; since we - * may be coming from STATE_TRAILERS, - * or may be doing a read-to-eof, we - * sanitize these here. - */ - io->read_state = SOUP_MESSAGE_IO_STATE_BODY; - io->read_length = 0; SOUP_MESSAGE_IO_RETURN_IF_CANCELLED_OR_PAUSED; } } |