summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDan Winship <danw@gnome.org>2013-08-25 10:29:41 -0400
committerDan Winship <danw@gnome.org>2013-08-25 17:06:16 -0400
commita7ce33ef264e0794fa1e406a879607018cfc6597 (patch)
tree00255657504559af3c4de1f26ef492b633e7d6f1
parent74b6fc3525a04432495cb2db5d6ce62c5a90c5a6 (diff)
downloadlibsoup-a7ce33ef264e0794fa1e406a879607018cfc6597.tar.gz
soup-body-output-stream: fix closing of chunked stream
When closing a chunked stream, we need to write the final 0-length chunk. However, we can only do that if we successfully wrote the previous chunk. https://bugzilla.gnome.org/show_bug.cgi?id=703297
-rw-r--r--libsoup/soup-body-output-stream.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/libsoup/soup-body-output-stream.c b/libsoup/soup-body-output-stream.c
index a1419754..03353ef5 100644
--- a/libsoup/soup-body-output-stream.c
+++ b/libsoup/soup-body-output-stream.c
@@ -231,7 +231,8 @@ soup_body_output_stream_close_fn (GOutputStream *stream,
{
SoupBodyOutputStream *bostream = SOUP_BODY_OUTPUT_STREAM (stream);
- if (bostream->priv->encoding == SOUP_ENCODING_CHUNKED) {
+ if (bostream->priv->encoding == SOUP_ENCODING_CHUNKED &&
+ bostream->priv->chunked_state == SOUP_BODY_OUTPUT_STREAM_STATE_CHUNK_SIZE) {
if (soup_body_output_stream_write_chunked (bostream, NULL, 0, TRUE, cancellable, error) == -1)
return FALSE;
}