Fix the handling of trailing junk with Content-Encoding
authorDan Winship <danw@gnome.org>
Thu, 24 May 2012 18:52:52 +0000 (14:52 -0400)
committerDan Winship <danw@gnome.org>
Thu, 24 May 2012 20:15:32 +0000 (16:15 -0400)
commitcdddef93f1c63fbe2a24aa8a2ccc95c083f3750f
treef1bbb4d8796fd4d05f47da9259a56e52516c4afe
parentfe71609c5deecad5583f3e4191d8d48c097a1787
Fix the handling of trailing junk with Content-Encoding

When a content-encoded response has trailing junk,
SoupConverterWrapper needs to make sure that all of that junk gets
read before returning G_CONVERTER_FINISHED, or else it will end up
becoming the start of the next response on that connection.

coding-test wasn't hitting this, because the trailing junk was always
small enough that it would have been read into GConverterInputStream's
internal buffer already at the point when the GZlibDecompresser
returned FINISHED. Switching coding-test to use chunked encoding
caused it to reliably hit the bug though, because the final 0-length
chunk (including its header) will always still be unread at that
point. So update it to use that.

Also add a SoupRequest-based test to coding-test, though it turns out
to not have been relevant to this bug, which affected the SoupMessage
API too.

https://bugzilla.gnome.org/show_bug.cgi?id=676477
libsoup/soup-converter-wrapper.c
tests/coding-test.c