mirror of
https://git.phreedom.club/localhost_frssoft/compy.git
synced 2024-11-27 02:21:34 +00:00
Check HTTP auth before allowing CONNECT
This commit is contained in:
parent
defbc287f1
commit
703cb4adaf
|
@ -82,10 +82,6 @@ func (p *Proxy) checkHttpBasicAuth(auth string) bool {
|
|||
}
|
||||
|
||||
func (p *Proxy) handle(w http.ResponseWriter, r *http.Request) error {
|
||||
if r.Method == "CONNECT" {
|
||||
return p.handleConnect(w, r)
|
||||
}
|
||||
|
||||
// TODO: only HTTPS?
|
||||
if p.user != "" {
|
||||
if !p.checkHttpBasicAuth(r.Header.Get("Proxy-Authorization")) {
|
||||
|
@ -95,6 +91,10 @@ func (p *Proxy) handle(w http.ResponseWriter, r *http.Request) error {
|
|||
}
|
||||
}
|
||||
|
||||
if r.Method == "CONNECT" {
|
||||
return p.handleConnect(w, r)
|
||||
}
|
||||
|
||||
resp, err := forward(r)
|
||||
if err != nil {
|
||||
w.WriteHeader(http.StatusInternalServerError)
|
||||
|
|
Loading…
Reference in a new issue