One of the things done when a web application is done is collect the HTTP information contained in the request. I did some things in PHP5 and there was (and is) an environment variables named ‘$_SERVER’ which contained information collected by the web server about the request.
In rails, there is the array named ‘request.env’ which contains a lot of items with the http request information, for instance if you want to get the client ip address or the browser used you can use the sentences ‘client_ip = request.env["REMOTE_ADDR"]‘ and ‘client_browser = request.env["HTTP_USER_AGENT"]‘.
A list of what is retrievable is :
- SERVER_NAME
- PATH_INFO
- REMOTE_HOST
- HTTP_ACCEPT_ENCODING
- HTTP_USER_AGENT
- SERVER_PROTOCOL
- HTTP_CACHE_CONTROL
- HTTP_ACCEPT_LANGUAGE
- HTTP_HOST
- REMOTE_ADDR
- SERVER_SOFTWARE
- HTTP_KEEP_ALIVE
- HTTP_REFERER
- HTTP_COOKIE
- HTTP_ACCEPT_CHARSET
- REQUEST_URI
- SERVER_PORT
- GATEWAY_INTERFACE
- QUERY_STRING
- REMOTE_USER
- HTTP_ACCEPT
- REQUEST_METHOD
- HTTP_CONNECTION
Something simple, as everything contained in RoR