mirror of
https://github.com/sot-tech/mochi.git
synced 2026-05-29 23:19:28 -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 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
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user