Project

General

Profile

Actions

Bug #1976

closed

geoip env + lua

Added by IrPr over 15 years ago. Updated over 3 years ago.

Status:
Invalid
Priority:
Normal
Category:
mod_magnet
Target version:
ASK QUESTIONS IN Forums:
No

Description

Hi there

mod_geoip environments are not recognized in lua scripts using mod_magnet

lighttpd.conf:

@server.modules += ( "mod_geoip" )

geoip.db-filename = "/etc/GeoIP.dat"

server.modules += ( "mod_magnet" )

magnet.attract-physical-path-to = ( "/etc/lighttpd/mooz.lua" )@

mooz.lua:

lighty.header["Location"] = "http://woot?" .. lighty.env["GEOIP_COUNTRY_CODE"]
return 302

error log:

2009-05-07 10:00:14: (mod_magnet.c.765) lua_pcall(): /etc/lighttpd/mooz.lua:5: attempt to concatenate field 'GEOIP_COUNTRY_CODE' (a nil value)

As you see mod_geoip is loaded before mod_magnet, but mod_geoip is not setting the env variables properly, or maybe mod_magnet couldn't use them


Related issues 1 (0 open1 closed)

Related to Feature #1546: Enhancements for mod_geoipFixedActions
Actions #1

Updated by IrPr over 15 years ago

  • Target version changed from 1.4.x to 1.5.0
Actions #2

Updated by stbuehler over 15 years ago

  • Status changed from New to Invalid

I still don't see a mod_geoip upstream. and lighty.env is not the environment (it should be renamed "lighty.req-data" or something like that).

Actions #3

Updated by natethelen over 15 years ago

I am also seeing this using fast-cgi and flup (python). I have traced it back to the raw socket read and none of the GEOIP_* FCGI_PARAMS are being sent through. What is weird is that they are passed through to PHP when run via fast-cgi with all else equal on the same box

Actions #4

Updated by gstrauss about 8 years ago

Actions #5

Updated by gstrauss about 8 years ago

mod_geoip currently hooks subrequest_start, where the geoip info is then available to dynamic handlers such as mod_cgi, mod_fastcgi, mod_scgi.

mod_geoip in the subrequest_start hook runs after mod_magnet, which runs in earlier hooks in the request.

See #1546 for further explanation.

Actions #6

Updated by gstrauss over 3 years ago

  • ASK QUESTIONS IN Forums set to No

FYI: since lighttpd 1.4.45 (Jan 2017), lighttpd populates the request env on demand for dynamic modules, including mod_magnet, so info from mod_maxminddb (successor to mod_geoip) is available in mod_magnet

Actions

Also available in: Atom