GNOME Bugzilla – Bug 577386
soup-message-io needs to set an error if the response body is truncated
Last modified: 2018-09-21 16:02:25 UTC
Diegoe found this while using Epiphany/WebKit. The problem happens with the following site: https://webaloe.ulima.edu.pe/portalUL/ Here's the relevant WebKit bug: https://bugs.webkit.org/show_bug.cgi?id=24954 The problem seems to happen because the server gives us a 302, and sends back a Connection: close, but sends a fair amount of \r\n's as a body, which confuses libsoup. I'm going to attach a small test case reproducing the problem.
Created attachment 131741 [details] small test case
soup_gnutls_read() is getting GNUTLS_E_UNEXPECTED_PACKET_LENGTH at the end of the response, so it returns G_IO_STATUS_ERROR, so soup-message-io.c ends up bailing out, so got-body never gets emitted (so the redirect doesn't get processed), but then that code path is broken and it doesn't change the message in any way to indicate that an error occurred. So, the web server is doing something broken in terms of how it ends its response, but I guess if other web browsers deal with it we should too.
Created attachment 131963 [details] [review] [PATCH] Consider corrupted or truncated data as EOF Emitting G_IO_STATUS_ERROR instead was causing HTTPS redirects fail in WebKit. This fixes bug #577386. --- libsoup/soup-gnutls.c | 4 ++++ 1 files changed, 4 insertions(+), 0 deletions(-)
committed the fix. will be in 2.26.1 You can close the downstream bug, but I'm leaving this one open to deal with the other problem I mentioned on IRC; in the event of an actual SSL error (or possibly certain other network I/O errors), soup-message-io doesn't set the message status to indicate that the response is truncated. That still needs to be fixed.
Hi, It seems that the issue I am seeing is related to the last comment: gnutls_handshake() fails, and therefore returns an error. io_error sets the correct error, but it gets cleared in soup_message_io_finished() by a call to soup_message_io_cleanup(). The listener to the restarted signal is not informed of the error. As a consequence, Webkit indefinitely queries the same message over and over.
[mass-moving all "UNCONFIRMED" libsoup bugs to "NEW" after disabling the "UNCONFIRMED" status for this product now that bugzilla.gnome.org allows that. bugspam-libsoup-20150210]
-- GitLab Migration Automatic Message -- This bug has been migrated to GNOME's GitLab instance and has been closed from further activity. You can subscribe and participate further through the new bug through this link to our GitLab instance: https://gitlab.gnome.org/GNOME/libsoup/issues/22.