Git fetch fails via dumb-https protocol
Nobody has claimed this yet.
- Dominant language
- Rust
- Stars
- 15.5k
- Forks
- 3k
- Avg merge
- 23h 30m
- Merged PRs (30d)
- 51
Description
Problem
I am setting up a self-hosted git repository. git itself has no problem accessing it but using it as a cargo dependency fails due to the server not sending a Content-Type header:
e@msi:~/Workbench/rust/tylisp$ cargo build
Updating git repository `https://2-71828.com/git/typenum-uuid`
warning: spurious network error (2 tries remaining): no content-type header in response; class=Http (34)
warning: spurious network error (1 tries remaining): no content-type header in response; class=Http (34)
error: failed to get `typenum-uuid` as a dependency of package `tylisp v0.1.0 (/home/e/Workbench/rust/tylisp)`
Caused by:
failed to load source for dependency `typenum-uuid`
Caused by:
Unable to update https://2-71828.com/git/typenum-uuid
Caused by:
failed to clone into: /home/e/.cargo/git/db/typenum-uuid-2731038279e3575f
Caused by:
network failure seems to have happened
if a proxy or similar is necessary `net.git-fetch-with-cli` may help here
https://doc.rust-lang.org/cargo/reference/config.html#netgit-fetch-with-cli
Caused by:
no content-type header in response; class=Http (34)
Steps
- In a temporary directory, observe that
git clone https://2-71828.com/git/typenum-uuidexecutes successfully. - Add the following dependencies to
Cargo.tomlin a test project:
[dependencies]
typenum = "1.12.0"
typenum-uuid = { git = "https://2-71828.com/git/typenum-uuid" }
- Attempt to build the project
Notes
-
Output of
cargo version:cargo 1.47.0 (f3c7e066a 2020-08-28) -
The suggested
net.git-fetch-with-cliconfiguration option is a valid workaround, but is necessary for any project that wishes to use this crate. -
The relevant specifications are the
gitprotocol specification:
Clients MUST NOT attempt to validate the returned Content-Type.
and the HTTP 1.1 specification:
If a Content-Type header field is not present, the recipient MAY either assume a media type of
application/octet-stream(RFC2046, Section 4.5.1) or examine the data to determine its type.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by reproducing the failure with git clone and cargo build using the dependency and server URL from the report. Read Cargo's git-fetch handling and compare its Content-Type behavior with the cited Git and HTTP specifications. Done means the dependency fetch succeeds without requiring net.git-fetch-with-cli when the server omits that header.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- rust
- Domain
- tooling
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 38/100