From e749c9c6c9b2f3db640021d09d66d953137ab70e Mon Sep 17 00:00:00 2001 From: Yashpal Choudhary Date: Sat, 20 Oct 2018 03:07:22 +0530 Subject: [PATCH] frontend/http: canonicalize http real_ip_header Fixes #428 --- frontend/http/parser.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/frontend/http/parser.go b/frontend/http/parser.go index 3053d82..1d276cb 100644 --- a/frontend/http/parser.go +++ b/frontend/http/parser.go @@ -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 } }