Commit 451b74af authored by Kirill Smelkov's avatar Kirill Smelkov

.

parent e2d44377
...@@ -284,8 +284,7 @@ func emitBlob(w http.ResponseWriter, repopath string, refpath string) { ...@@ -284,8 +284,7 @@ func emitBlob(w http.ResponseWriter, repopath string, refpath string) {
// Blob not found -> 404 // Blob not found -> 404
if sha1 == "" { if sha1 == "" {
// XXX -> 404 http.Error(w, fmt.Sprintf("Blob for %v not found", refpath), http.StatusNotFound)
fail400(w, fmt.Sprintf("Blob for %v not found", refpath), nil)
return return
} }
...@@ -295,12 +294,12 @@ func emitBlob(w http.ResponseWriter, repopath string, refpath string) { ...@@ -295,12 +294,12 @@ func emitBlob(w http.ResponseWriter, repopath string, refpath string) {
w.Header().Set("Content-Length", fmt.Sprintf("%d", size)) w.Header().Set("Content-Length", fmt.Sprintf("%d", size))
w.Header().Set("X-Content-Type-Options", "nosniff") w.Header().Set("X-Content-Type-Options", "nosniff")
// net/http sniffs stream and and automatically detects and sets // net/http sniffs stream and and automatically detects and sets
// Content-Type header. We do not have to do it ourselves // Content-Type header. We do not have to do it ourselves.
w.Header().Set("Cache-Control", "private") // Rails sets this for IE compatibility w.Header().Set("Cache-Control", "private") // Rails sets this for IE compatibility
w.Header().Set("ETag", fmt.Sprintf(`"%s"`, sha1)) w.Header().Set("ETag", fmt.Sprintf(`"%s"`, sha1))
w.WriteHeader(200) // Don't bother with HTTP 500 from this point on, just return w.WriteHeader(http.StatusOK) // Don't bother with HTTP 500 from this point on, just return
// XXX better use queryStdout instead of queryReader, but we could be // XXX better use queryStdout instead of queryReader, but we could be
// holding some tail bytes in queryReader after chat phase // holding some tail bytes in queryReader after chat phase
_, err = io.CopyN(w, queryReader, size) _, err = io.CopyN(w, queryReader, size)
......
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