mirror of
https://github.com/sot-tech/mochi.git
synced 2026-06-03 03:33:36 -07:00
Merge pull request #429 from yashpal1995/canonicalize_real-ip-header
frontend/http: canonicalize http real_ip_header
This commit is contained in:
@@ -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
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user