On Thu, 2010-07-15 at 14:45 -0300, Fabio Mascarenhas wrote:
> Hi, Ryan,
> 
> Use web.vars.HTTP_USER_AGENT.

Just to clarify, I was also searching how to retrieve headers from Orbit
or WSAPI/Xavante, and only after looking in the source I found this
piece in wsapi/xavante.lua:

  for n,v in pairs (req.headers) do
    req.cgivars ["HTTP_"..string.gsub (string.upper (n), "-", "_")] = v
  end

In other words, all headers are accessible by uppercasing the name,
translating "-" to "_", and prepending "HTTP_". For example, in order to
access the Accept-Language header, you need to access
web.vars.HTTP_ACCEPT_LANGUAGE in Orbit.

Is this translation documented somewhere (RFC or some manual)? My Google
skills have failed me this time, I only found references to some PHP
predefined variables, like HTTP_REFERER and HTTP_HOST.


_______________________________________________
Kepler-Project mailing list
Kepler-Project@lists.luaforge.net
http://lists.luaforge.net/cgi-bin/mailman/listinfo/kepler-project
http://www.keplerproject.org/

Reply via email to