Merge pull request #429 from yashpal1995/canonicalize_real-ip-header
frontend/http: canonicalize http real_ip_header
This commit is contained in:
commit
dcd8e8ea86
1 changed files with 2 additions and 2 deletions
|
@ -153,8 +153,8 @@ func requestedIP(r *http.Request, p bittorrent.Params, opts ParseOptions) (ip ne
|
|||
}
|
||||
|
||||
if opts.RealIPHeader != "" {
|
||||
if ips, ok := r.Header[opts.RealIPHeader]; ok && len(ips) > 0 {
|
||||
return net.ParseIP(ips[0]), false
|
||||
if ip := r.Header.Get(opts.RealIPHeader); ip != "" {
|
||||
return net.ParseIP(ip), false
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue