Commit 5be33684 authored by Kirill Smelkov's avatar Kirill Smelkov

.

parent 238e32b9
......@@ -135,10 +135,10 @@ func verifyDownloadAccess(w http.ResponseWriter, u *upstream, project string) (A
auth, ok := authCache[project]
if ok {
auth.Nhit++
log.Printf("authReply for %v cached ago: %v (hits: %v)",
project,
time.Since(time.Unix(auth.Tauth, 0)),
auth.Nhit)
//log.Printf("authReply for %v cached ago: %v (hits: %v)",
// project,
// time.Since(time.Unix(auth.Tauth, 0)),
// auth.Nhit)
return auth.AuthReply, nil
}
......@@ -246,7 +246,7 @@ func emitBlob(w http.ResponseWriter, repopath string, refpath string) {
for i := len(refpathv); i > 0; i-- {
ref := strings.Join(refpathv[:i], "/")
path := strings.Join(refpathv[i:], "/")
log.Printf("Trying %v %v", ref, path)
//log.Printf("Trying %v %v", ref, path)
_, err := fmt.Fprintf(queryStdin, "%s:%s\n", ref, path)
if err != nil {
fail500(w, "git cat-file --batch; write", err)
......@@ -259,7 +259,7 @@ func emitBlob(w http.ResponseWriter, repopath string, refpath string) {
return
}
log.Printf("<- %s", reply)
//log.Printf("<- %s", reply)
// <object> SP missing LF
if strings.HasSuffix(reply, " missing\n") {
......@@ -290,6 +290,15 @@ func emitBlob(w http.ResponseWriter, repopath string, refpath string) {
}
// Blob found - start writing response
w.Header().Set("Content-Disposition", "inline")
w.Header().Set("Content-Transfer-Encoding", "binary")
w.Header().Set("Content-Length", fmt.Sprintf("%d", size))
w.Header().Set("X-Content-Type-Options", "nosniff")
//w.Header().Set("Content-Type", "...") TODO image/jpeg...
w.Header().Set("Cache-Control", "private") // Rails sets this for IE compatibility
w.Header().Set("ETag", fmt.Sprintf(`"%s"`, sha1))
//setRawHeaders(...) // TODO
w.WriteHeader(200) // Don't bother with HTTP 500 from this point on, just return
// XXX better use queryStdout instead of queryReader, but we could be
......
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