Skip to content

Commit

Permalink
Do not attempt to split GeoIP org field into ASN and ISP, return the …
Browse files Browse the repository at this point in the history
…raw organization string instead
  • Loading branch information
fcambus committed Nov 10, 2015
1 parent 55df0a6 commit 73beaf6
Showing 1 changed file with 2 additions and 15 deletions.
17 changes: 2 additions & 15 deletions telize
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
# http://www.telize.com #
# #
# Created: 2013/08/15 #
# Last Updated: 2015/10/27 #
# Last Updated: 2015/11/10 #
# #
# Telize is released under the BSD 3-Clause license. #
# See LICENSE file for details. #
Expand Down Expand Up @@ -95,13 +95,6 @@ server {
ngx.exit(ngx.HTTP_OK)
end

-- Splitting GeoIP organization string into ASN and ISP
if ngx.var.geoip_org then
index = string.find(ngx.var.geoip_org, "%s")
asn = string.sub(ngx.var.geoip_org, 0, index-1)
isp = string.sub(ngx.var.geoip_org, index+1)
end

local payload = {
ip = ngx.var.remote_addr,
country_code = ngx.var.geoip_city_country_code,
Expand All @@ -116,10 +109,9 @@ server {
longitude = ngx.var.geoip_longitude,
dma_code = ngx.var.geoip_dma_code,
area_code = ngx.var.geoip_area_code,
organization = ngx.var.geoip_org,
timezone = ngx.var.geoip_timezone,
offset = ngx.var.geoip_timezone_offset,
asn = asn,
isp = isp
}

local callback = ngx.var.arg_callback
Expand Down Expand Up @@ -147,11 +139,6 @@ server {
payload.region = cd:iconv(payload.region)
end

-- Convert ISP name to UTF-8 if it exists
if payload.isp ~= nil then
payload.isp = cd:iconv(payload.isp)
end

local json = cjson.encode(payload)

if callback ~= "" then
Expand Down

0 comments on commit 73beaf6

Please sign in to comment.