mirror of https://github.com/perkeep/perkeep.git
This commit is contained in:
parent
2567346b70
commit
c22e941b8a
|
@ -42,6 +42,7 @@ func IsAuthorized(req *http.Request) bool {
|
|||
func RequireAuth(handler func(conn http.ResponseWriter, req *http.Request)) func (conn http.ResponseWriter, req *http.Request) {
|
||||
return func (conn http.ResponseWriter, req *http.Request) {
|
||||
if !IsAuthorized(req) {
|
||||
req.Body.Close() // http://code.google.com/p/go/issues/detail?id=1306
|
||||
conn.SetHeader("WWW-Authenticate", "Basic realm=\"camlistored\"")
|
||||
conn.WriteHeader(http.StatusUnauthorized)
|
||||
fmt.Fprintf(conn, "Authentication required.\n")
|
||||
|
|
Loading…
Reference in New Issue