git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 0/4] Report rejections over HTTP when the remote rejects during the transfer
@ 2024-06-12 11:50 Carlos Martín Nieto
  2024-06-12 11:50 ` [PATCH 1/4] t/lib-http: add serve-git.py Carlos Martín Nieto
                   ` (4 more replies)
  0 siblings, 5 replies; 14+ messages in thread
From: Carlos Martín Nieto @ 2024-06-12 11:50 UTC (permalink / raw)
  To: git; +Cc: Carlos Martín Nieto

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


^ permalink raw reply	[flat|nested] 14+ messages in thread

end of thread, other threads:[~2024-07-23 15:07 UTC | newest]

Thread overview: 14+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-06-12 11:50 [PATCH 0/4] Report rejections over HTTP when the remote rejects during the transfer Carlos Martín Nieto
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

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).