[libsoup] http2: fix http authentication
- From: Carlos Garcia Campos <carlosgc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [libsoup] http2: fix http authentication
- Date: Fri, 21 May 2021 14:01:36 +0000 (UTC)
commit c50986b74161db7dd00d74e7680caba80b950d0d
Author: Carlos Garcia Campos <cgarcia igalia com>
Date: Fri May 21 15:18:41 2021 +0200
http2: fix http authentication
Problem is that io_run_until_read can finish early while paused, because
getting the response and first data frames can happen in the same
nghttp2_session_mem_recv() call, so when the message is paused we have
already progressed to reading state. Returning NGHTTP2_ERR_PAUSE from
callbacks might be problematic too, because it will block other streams
not paused. Since we will read the body in any case when unpaused,
it's ok to let the read continue while paused, but without finishing
io_run_until_read() until it's unpaused.
libsoup/http2/soup-client-message-io-http2.c | 10 +---------
1 file changed, 1 insertion(+), 9 deletions(-)
---
diff --git a/libsoup/http2/soup-client-message-io-http2.c b/libsoup/http2/soup-client-message-io-http2.c
index 31d29d29..ddd399cb 100644
--- a/libsoup/http2/soup-client-message-io-http2.c
+++ b/libsoup/http2/soup-client-message-io-http2.c
@@ -454,9 +454,6 @@ on_data_chunk_recv_callback (nghttp2_session *session,
h2_debug (io, msgdata, "[DATA] Recieved chunk, len=%zu, flags=%u, paused=%d", len, flags,
msgdata->paused);
- if (msgdata->paused)
- return NGHTTP2_ERR_PAUSE;
-
g_assert (msgdata->body_istream != NULL);
soup_body_input_stream_http2_add_data (SOUP_BODY_INPUT_STREAM_HTTP2 (msgdata->body_istream), data,
len);
@@ -627,11 +624,6 @@ on_data_source_read_callback (nghttp2_session *session,
SoupHTTP2MessageData *data = nghttp2_session_get_stream_user_data (session, stream_id);
SoupClientMessageIOHTTP2 *io = get_io_data (data->msg);
- if (data->paused) {
- h2_debug (io, data, "[SEND_BODY] Paused");
- return NGHTTP2_ERR_PAUSE;
- }
-
/* This cancellable is only used for async data source operations,
* only exists while reading is happening, and will be cancelled
* at any point if the data is freed.
@@ -1221,7 +1213,7 @@ io_run_until (SoupClientMessageIOHTTP2 *io,
done = data->state >= state;
- if (!blocking && !done) {
+ if (data->paused || (!blocking && !done)) {
g_set_error_literal (error, G_IO_ERROR,
G_IO_ERROR_WOULD_BLOCK,
_("Operation would block"));
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]