From: "Carlos Martín Nieto" <cmn@dwim.me>
To: git@vger.kernel.org
Cc: "Carlos Martín Nieto" <cmn@dwim.me>
Subject: [PATCH 0/4] Report rejections over HTTP when the remote rejects during the transfer
Date: Wed, 12 Jun 2024 13:50:24 +0200 [thread overview]
Message-ID: <20240612115028.1169183-1-cmn@dwim.me> (raw)
Hello git list,
While investigating a difference between HTTP and SSH when rejecting a push due
to it being too large, I noticed that rejecting a push without receiving the
entire packfile causes git to print out the error message "pack exceeds maximum
allowed size" but it also shows "Everything up-to-date" instead of the rejection
of every ref update like the server has specified.
This is the result of two issues in git, of which I aim to fix one here, namely
1) when the server sends the response and closes the connection, remote-curl
sees that as an error and stops processing the send-pack output, combined with
2) git does not remember what it asked the remote helper to push so it cannot
distinguish whether an empty report means "I had an error and did nothing" or
"everything was up to date and I didn't have to do anything".
The latter issue is more complex so here I'm concentrating on the former, which
has a simple solution but a complex test. The solution is to read in to the end
of what send-pack is telling us (it's creating the whole packfile that we're
throwing away anyway) so we can report back to the user.
The testing however proved a bit complicated as this bug requires the server to
cut off the connection while git is uploading the packfile. The existing HTTP
tests use CGI and as far as I've been able to test, httpd buffers too much for
us to be able to replicate the situation.
This is why there's a python Git server in this patch series that doesn't rely
on CGI but streams the data both ways so it can close the stream as soon as
receive-pack exits. There's already some python tooling in the project and I'm
much more familiar with it than e.g. perl, so I hope that's fine. I tried to
make it as simple as possible while still being able to stream bidirectionally.
Cheers,
cmn
Carlos Martín Nieto (4):
t/lib-http: add serve-git.py
t/lib-http.sh: add functions related to serve-git.py
t5541: add test for rejecting a push due to packfile size
remote-curl: read in the push report even if we fail to finish sending
data
remote-curl.c | 24 ++-
t/lib-httpd.sh | 20 +++
t/lib-httpd/serve-git.py | 353 ++++++++++++++++++++++++++++++++++++++
t/t5546-receive-limits.sh | 24 +++
4 files changed, 414 insertions(+), 7 deletions(-)
create mode 100755 t/lib-httpd/serve-git.py
--
2.43.0
next reply other threads:[~2024-06-12 11:50 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-06-12 11:50 Carlos Martín Nieto [this message]
2024-06-12 11:50 ` [PATCH 1/4] t/lib-http: add serve-git.py Carlos Martín Nieto
2024-06-12 21:51 ` Junio C Hamano
2024-06-12 11:50 ` [PATCH 2/4] t/lib-http.sh: add functions related to serve-git.py Carlos Martín Nieto
2024-06-13 9:19 ` Jeff King
2024-06-12 11:50 ` [PATCH 3/4] t5541: add test for rejecting a push due to packfile size Carlos Martín Nieto
2024-06-12 21:49 ` Taylor Blau
2024-06-13 9:21 ` Jeff King
2024-06-13 10:07 ` Jeff King
2024-06-12 11:50 ` [PATCH 4/4] remote-curl: read in the push report even if we fail to finish sending data Carlos Martín Nieto
2024-06-13 9:55 ` Jeff King
2024-07-23 15:07 ` Carlos Martín Nieto
2024-06-13 9:11 ` [PATCH 0/4] Report rejections over HTTP when the remote rejects during the transfer Jeff King
2024-07-23 13:46 ` Carlos Martín Nieto
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20240612115028.1169183-1-cmn@dwim.me \
--to=cmn@dwim.me \
--cc=git@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).