aa7ac8f011
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.
21 lines
449 B
Go
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)
|
|
}
|