Authored by jie

去除ip 中的空白字符

@@ -4,6 +4,7 @@ @@ -4,6 +4,7 @@
4 4
5 local realIp = ngx.req.get_headers()["X-YOHO-IP"] 5 local realIp = ngx.req.get_headers()["X-YOHO-IP"]
6 if realIp and (string.find(ngx.var.http_host,"yohoops%.org") or string.find(ngx.var.http_host,"yohops%.com")) then 6 if realIp and (string.find(ngx.var.http_host,"yohoops%.org") or string.find(ngx.var.http_host,"yohops%.com")) then
  7 + realIp=string.gsub(realIp,"%s","")
7 return realIp 8 return realIp
8 end 9 end
9 10
@@ -28,4 +29,8 @@ if realIp == nil then @@ -28,4 +29,8 @@ if realIp == nil then
28 realIp = ngx.var.remote_addr; 29 realIp = ngx.var.remote_addr;
29 end 30 end
30 31
  32 +if realIp then
  33 + realIp=string.gsub(realIp,"%s","")
  34 +end
  35 +
31 return realIp; 36 return realIp;