rust-lang / git2-rs

libgit2 bindings for Rust
https://docs.rs/git2
Apache License 2.0
1.69k stars 388 forks source link

Invalid content-type text/plain for HTTPS repo #942

Closed orzen closed 1 year ago

orzen commented 1 year ago

Hi,

I am experiencing the following error when I try to clone a repo over HTTPS using git2-rs 0.16.1.

'https://git.openembedded.org/meta-openembedded': invalid content-type: 'text/plain; charset=UTF-8'; class=Http (34)

git2-rs seems to be validating the content type and rejecting text/plain. text/plain from my understanding should be the default content-type, according to git-scm, for "dumb" servers (see https://www.git-scm.com/docs/http-protocol). It looks like git2-rs only accepts headers containing content-type application/x-git-* from what I can see in git2-curl/src/lib.rs:165.

This brings me to the question if git2-rs mainly supports "smart" protocol or if it's a bug?

I've been using a customized version of the official clone example for my testing, found here https://github.com/rust-lang/git2-rs/blob/master/examples/clone.rs and the modified version can be found here https://play.rust-lang.org/?version=stable&mode=debug&edition=2021&gist=b3cf6b2bf07b3e9b58935a4587adc841.

Thanks in advance

/orzen

ehuss commented 1 year ago

git2-rs is just a thin wrapper around the libgit2 library. This is probably an issue for their issue tracker at https://github.com/libgit2/libgit2/issues. Per this comment, I don't believe they will be supporting the dumb protocol.