Commit 9ed9b81e authored by Kirill Smelkov's avatar Kirill Smelkov

.

parent 9dedc0ce
......@@ -60,7 +60,7 @@ type AuthCacheKey struct {
// Authorization reply cache
// {} AuthCacheKey -> *AuthCacheEntry
type AuthCache struct {
u *upstream // for which upstream we cache auth
u *upstream // for which upstream we cache auth
mu sync.RWMutex // guards .cached
cached map[AuthCacheKey]*AuthCacheEntry
......@@ -174,7 +174,7 @@ func (c *AuthCache) askAuthBackend(key AuthCacheKey) AuthReply {
panic(err)
}
header := make(http.Header)
for k,v := range hv {
for k, v := range hv {
header[k] = v
}
......@@ -194,17 +194,17 @@ func askAuthBackend(u *upstream, project, query string, header *http.Header) Aut
// side this supports only basic auth, not private token.
// - that's why we auth backend to authenticate as if it was request to
// get repo archive and propagate request query and header.
// url := project+".git/info/refs?service=git-upload-pack"
url := project+"/repository/archive.zip"
// url := project + ".git/info/refs?service=git-upload-pack"
url := project + "/repository/archive.zip"
if query != "" {
url += "?"+query
url += "?" + query
}
reqDownloadAccess, err := http.NewRequest("GET", url, nil)
if err != nil {
fail500(authReply.RawReply, fmt.Errorf("GET git-upload-pack: %v", err))
return authReply
}
for k,v := range *header {
for k, v := range *header {
reqDownloadAccess.Header[k] = v
}
......
......@@ -466,7 +466,7 @@ func download(t *testing.T, url string, h http.Header) (*http.Response, []byte)
t.Fatal(err)
}
// copy header to request
for k,v := range h {
for k, v := range h {
req.Header[k] = v
}
client := &http.Client{}
......@@ -484,9 +484,9 @@ func download(t *testing.T, url string, h http.Header) (*http.Response, []byte)
// Context for downloading & verifying paths under URL prefix
type DownloadContext struct {
t *testing.T
t *testing.T
urlPrefix string
Header http.Header
Header http.Header
}
func DownloadContextNew(t *testing.T, urlPrefix string) *DownloadContext {
......@@ -495,7 +495,7 @@ func DownloadContextNew(t *testing.T, urlPrefix string) *DownloadContext {
}
func (dl DownloadContext) downloadRaw(path string) (*http.Response, []byte) {
return download(dl.t, dl.urlPrefix + path, dl.Header)
return download(dl.t, dl.urlPrefix+path, dl.Header)
}
// download `path` and expect content sha1 to be `expectSha1`
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment