mirror of
https://github.com/outbackdingo/ports.git
synced 2026-03-19 17:13:32 +00:00
47 lines
2.1 KiB
Diff
47 lines
2.1 KiB
Diff
From 5c58cb0212bcf63cce33a974906bf9905948b4bb Mon Sep 17 00:00:00 2001
|
|
From: Stefan Eissing <stefan@eissing.org>
|
|
Date: Wed, 24 May 2023 18:48:16 +0200
|
|
Subject: [PATCH] http2: fix EOF handling on uploads with auth negotiation
|
|
|
|
- doing a POST with `--digest` does an override on the initial request
|
|
with `Content-Length: 0`, but the http2 filter was unaware of that
|
|
and expected the originally request body. It did therefore not
|
|
send a final DATA frame with EOF flag to the server.
|
|
- The fix overrides any initial notion of post size when the `done_send`
|
|
event is triggered by the transfer loop, leading to the EOF that
|
|
is necessary.
|
|
- refs #11194. The fault did not happen in testing, as Apache httpd
|
|
never tries to read the request body of the initial request,
|
|
sends the 401 reply and closes the stream. The server used in the
|
|
reported issue however tried to read the EOF and timed out on the
|
|
request.
|
|
|
|
Reported-by: Aleksander Mazur
|
|
Fixes #11194
|
|
Cloes #11200
|
|
---
|
|
lib/http2.c | 6 +--
|
|
tests/http/test_07_upload.py | 20 +++++++++
|
|
tests/http/test_14_auth.py | 81 ++++++++++++++++++++++++++++++++++++
|
|
tests/http/testenv/httpd.py | 49 +++++++++++++++-------
|
|
4 files changed, 138 insertions(+), 18 deletions(-)
|
|
create mode 100644 tests/http/test_14_auth.py
|
|
|
|
diff --git a/lib/http2.c b/lib/http2.c
|
|
index 224424bf62b3c..191d8cd3359e4 100644
|
|
--- a/lib/http2.c
|
|
+++ b/lib/http2.c
|
|
@@ -1527,10 +1527,8 @@ static CURLcode http2_data_done_send(struct Curl_cfilter *cf,
|
|
if(!stream->send_closed) {
|
|
stream->send_closed = TRUE;
|
|
if(stream->upload_left) {
|
|
- /* If we operated with unknown length, we now know that everything
|
|
- * that is buffered is all we have to send. */
|
|
- if(stream->upload_left == -1)
|
|
- stream->upload_left = Curl_bufq_len(&stream->sendbuf);
|
|
+ /* we now know that everything that is buffered is all there is. */
|
|
+ stream->upload_left = Curl_bufq_len(&stream->sendbuf);
|
|
/* resume sending here to trigger the callback to get called again so
|
|
that it can signal EOF to nghttp2 */
|
|
(void)nghttp2_session_resume_data(ctx->h2, stream->id);
|