git-lfs/lfshttp/cookies.go
Rafal Kupka aa7ac8f011 Let git-lfs HTTP transport send cookies
This allows Git LFS to use the same cookies as configured for Git
(http.cookieFile). Those cookies may be needed for e.g. Gcloud Identity-Aware
Proxy.
2019-09-28 19:02:20 +01:00

21 lines
449 B
Go

package lfshttp
import (
"fmt"
"net/http"
"github.com/google/slothfs/cookie"
)
func isCookieJarEnabledForHost(c *Client, host string) bool {
_, cookieFileOk := c.uc.Get("http", fmt.Sprintf("https://%v", host), "cookieFile")
return cookieFileOk
}
func getCookieJarForHost(c *Client, host string) (http.CookieJar, error) {
cookieFile, _ := c.uc.Get("http", fmt.Sprintf("https://%v", host), "cookieFile")
return cookie.NewJar(cookieFile)
}