go-git / go-git

A highly extensible Git implementation in pure Go.
https://pkg.go.dev/github.com/go-git/go-git/v5
Apache License 2.0
5.89k stars 734 forks source link

When accessing cloudlab git server over https invalid pkt-len found #641

Open gcstang opened 1 year ago

gcstang commented 1 year ago

When I'm trying use PlainClone over https on a cloudlab server I'm seeing 'invalid pkt-len found' This uses a token for authentication in the form of https://user:token@host.com

From my command line this works with git just not go-git.

blmayer commented 1 year ago

I was getting this same error, the issue here was getting the body gziped so the packp parser failed, so I solved it by uncompressing the gziped body before decoding the upload-pack request. Check if this is your case as well.

mleku commented 4 months ago
    if err = upr.Decode(r.Body); chk.E(err) {
        var rdr io.Reader
        if rdr, err = gzip.NewReader(r.Body); !chk.E(err) {
            if err = upr.Decode(rdr); chk.E(err) {
                http.Error(w, err.Error(), 400)
                return
            }
        }
        http.Error(w, err.Error(), 400)
        return
    }

fixes the problem