add "Proxy-Authenticate" header for http2

This commit is contained in:
messyidea 2017-07-14 13:30:08 +08:00
parent aa075e6630
commit bd0f9869c7

View File

@ -211,6 +211,7 @@ func (s *Http2Server) HandleRequest(w http.ResponseWriter, req *http.Request) {
} }
if len(s.Base.Node.Users) > 0 && !valid { if len(s.Base.Node.Users) > 0 && !valid {
glog.V(LWARNING).Infof("[http2] %s <- %s : proxy authentication required", req.RemoteAddr, target) glog.V(LWARNING).Infof("[http2] %s <- %s : proxy authentication required", req.RemoteAddr, target)
w.Header().Set("Proxy-Authenticate", "Basic realm=\"gost\"")
w.WriteHeader(http.StatusProxyAuthRequired) w.WriteHeader(http.StatusProxyAuthRequired)
return return
} }