In this chapter, we're looking into the content of env. When you access to the server on localhost, like http://localhost:4242/sns/member?id=3, the env would be like this.
(:request-method :GET :script-name "" :path-info "/sns/member" :query-string "id=3" :server-name "localhost" :server-port 4242 :request-uri "/sns/member?id=3" :server-protocol :HTTP/1.1 :http-user-agent "Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10_6_6; en-US) ..." :remote-addr "127.0.0.1" :remote-port 26077 :http-referer nil :http-host "localhost:4242" :http-cookies nil)
And here's the description of each values. Mostly you don't need to memorize all these things, except you're going to create a "Clack Handler" (This is something like an adapter between Clack and a Web server). Relax and read as just informations.
:request-method(Required, Keyword)- The HTTP request method, must be one of
:GET,:HEAD,:OPTIONS,:PUT,:POST, or:DELETE. :script-name(Required, String)- The initial portion of the request URL's path, corresponding to the application. This may be an empty string if the application corresponds to the server's root URI. If this key is not empty, it must start with a forward slash (
/). :path-info(Required, String)- The remainder of the request URL's path. This may be an empty string if the request URL targets the application root and does no have a trailing slash.
:query-string(Optional, String)- The portion of the request URL that follows the
?, if any. This key may be empty, but must always be present, even if empty. :server-name(Required, String)- The resolved server name, or the server IP address.
:server-port(Required, Integer)- The port on which the request is being handled.
:server-protocol(Required, Keyword)- The version of the protocol the client used to send the request. Typically this will be something like
:HTTP/1.0or:HTTP/1.1. :request-uri(Required, String)- The request URI. Must start with "/".
:server-protocol(Required, Keyword):raw-body(Optional, Stream):http-user-agent(Optional, String):http-referer(Optional, String):remote-addr(Required, String):remote-port(Required, Integer):http-server(Required, Keyword)- The name of Clack Handler, such as
:hunchentootor:apache.