da1f5e4eabc0b9d8d515a7912195a665812bdf49
diff --git a/libsoup/soup-gnutls.c b/libsoup/soup-gnutls.c
index 3ca9de5..bdde821 100644
--- a/libsoup/soup-gnutls.c
+++ b/libsoup/soup-gnutls.c
@@ -206,6 +206,10 @@ again:
 			goto again;
 	}
 
+	if (result == GNUTLS_E_UNEXPECTED_PACKET_LENGTH) {
+		return G_IO_STATUS_EOF;
+	}
+
 	if (result < 0) {
 		g_set_error (err, G_IO_CHANNEL_ERROR,
 			     G_IO_CHANNEL_ERROR_FAILED,
