Open
Description
libgit2 seems to hang when cloning a URL that has a redirect with an empty body.
Reproduction steps
Try to clone the URL https://gitlab.com/ehuss/test
Expected behavior
Should be able to clone with a redirect.
Actual behavior
libgit2 hangs when cloning that URL. From my investigation, this is roughly what I see:
- gitlab responds to the initial request with a redirect to
https://gitlab.com/ehuss/test.git/info/refs?service=git-upload-pack
- Notice that it added
.git
to the URL - That response has a
Content-Type: text/html; charset=utf-8
header andContent-Length: 0
- Notice that it added
on_headers_complete
detects theContent-Type
header and setsclient->state
toREADING_BODY
- The loop in
http_stream_read
goes again, generating a new request with the new URL git_http_client_send_request
is called, and at the very top it detectsREADING_BODY
and callscomplete_response_body
which tries to read more data from the server, but this hangs indefinitely since there is no body coming.
I'm not familiar enough with this code to make a real suggestion (maybe it should check for content_length==0 somewhere? or maybe it shouldn't set READING_BODY if content_length==0
?).
Version of libgit2 (release number or SHA1)
Operating system(s) tested
Any
Metadata
Metadata
Assignees
Labels
No labels