087db1de70
Since we're about to do a v3.0.0 release, let's bump the version to v3. Make this change automatically with the following command to avoid any missed items: git grep -l github.com/git-lfs/git-lfs/v2 | \ xargs sed -i -e 's!github.com/git-lfs/git-lfs/v2!github.com/git-lfs/git-lfs/v3!g'
27 lines
613 B
Go
27 lines
613 B
Go
package lfshttp
|
|
|
|
import (
|
|
"fmt"
|
|
"net/http"
|
|
|
|
"github.com/git-lfs/git-lfs/v3/tools"
|
|
"github.com/ssgelm/cookiejarparser"
|
|
)
|
|
|
|
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")
|
|
|
|
cookieFilePath, err := tools.ExpandPath(cookieFile, false)
|
|
if err != nil {
|
|
return nil, err
|
|
}
|
|
|
|
return cookiejarparser.LoadCookieJarFile(cookieFilePath)
|
|
}
|