Merge pull request #429 from yashpal1995/canonicalize_real-ip-header

frontend/http: canonicalize http real_ip_header
This commit is contained in:
Jimmy Zelinskie 2018-10-24 14:28:21 -04:00 committed by GitHub
commit dcd8e8ea86
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -153,8 +153,8 @@ func requestedIP(r *http.Request, p bittorrent.Params, opts ParseOptions) (ip ne
} }
if opts.RealIPHeader != "" { if opts.RealIPHeader != "" {
if ips, ok := r.Header[opts.RealIPHeader]; ok && len(ips) > 0 { if ip := r.Header.Get(opts.RealIPHeader); ip != "" {
return net.ParseIP(ips[0]), false return net.ParseIP(ip), false
} }
} }