Commit c50986b7 authored by Carlos Garcia Campos's avatar Carlos Garcia Campos
Browse files

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.
parent 34a2d114
Pipeline #284939 failed with stages
in 5 minutes and 7 seconds
......@@ -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"));
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment