cmd/stdiscosrv: Don't abuse wrong header (#6749)

This commit is contained in:
Audrius Butkevicius 2020-06-16 09:58:25 +01:00 committed by GitHub
parent df83b84aa1
commit f310bbaaac
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -139,7 +139,7 @@ func (s *apiSrv) handler(w http.ResponseWriter, req *http.Request) {
if s.useHTTP { if s.useHTTP {
remoteAddr.IP = net.ParseIP(req.Header.Get("X-Forwarded-For")) remoteAddr.IP = net.ParseIP(req.Header.Get("X-Forwarded-For"))
if parsedPort, err := strconv.ParseInt(req.Header.Get("X-Forwarded-Port"), 10, 0); err == nil { if parsedPort, err := strconv.ParseInt(req.Header.Get("X-Client-Port"), 10, 0); err == nil {
remoteAddr.Port = int(parsedPort) remoteAddr.Port = int(parsedPort)
} }
} else { } else {