summaryrefslogtreecommitdiff
path: root/libsoup/soup-converter-wrapper.c
diff options
context:
space:
mode:
authorDan Winship <danw@gnome.org>2012-07-17 17:00:07 -0400
committerDan Winship <danw@gnome.org>2012-07-17 17:22:15 -0400
commit97d2b4dc9cbf4f0098bd21e71beabfeba9f62f81 (patch)
tree1b68691c98d731c880c473d536fe0a41a58b576c /libsoup/soup-converter-wrapper.c
parenta5c449b83a401bcd509f858fd5a6caaf0acad089 (diff)
downloadlibsoup-97d2b4dc9cbf4f0098bd21e71beabfeba9f62f81.tar.gz
SoupConverterWrapper: handle empty "compressed" responses
If a server sends an empty response but includes a Content-Encoding header (in particular, in a HEAD or 304 response), suppress the PARTIAL_INPUT error from the GZlibDecompressor and just return 0. https://bugzilla.gnome.org/show_bug.cgi?id=679527 (?)
Diffstat (limited to 'libsoup/soup-converter-wrapper.c')
-rw-r--r--libsoup/soup-converter-wrapper.c9
1 files changed, 9 insertions, 0 deletions
diff --git a/libsoup/soup-converter-wrapper.c b/libsoup/soup-converter-wrapper.c
index 45d34a3f..8aa000b9 100644
--- a/libsoup/soup-converter-wrapper.c
+++ b/libsoup/soup-converter-wrapper.c
@@ -270,6 +270,15 @@ soup_converter_wrapper_real_convert (GConverter *converter,
return result;
}
+ if (g_error_matches (my_error, G_IO_ERROR, G_IO_ERROR_PARTIAL_INPUT) &&
+ !priv->started && inbuf_size == 0 &&
+ (flags & G_CONVERTER_INPUT_AT_END)) {
+ /* Server claimed compression but there was no message body. */
+ g_error_free (my_error);
+ *bytes_written = 0;
+ return G_CONVERTER_FINISHED;
+ }
+
if (!g_error_matches (my_error, G_IO_ERROR, G_IO_ERROR_INVALID_DATA) ||
priv->started) {
g_propagate_error (error, my_error);