REQUEST_METHOD, QUERY_STRING y PATH_INFO

[~/local/src/ruby/sinatra/rack/rack-env]$ cat app.rb 
require 'rack'
require 'thin'

cgi_inspector = lambda do |env|
  [200, #status
    { 'Content-Type' => 'text/html' }, #headers
    ["<h1>
        Your request:<br>
       <ul>
         <li>http method is: #{env['REQUEST_METHOD']}
         <li>path is: #{env['PATH_INFO']}
         <li>Query string is: #{env['QUERY_STRING']}
       </ul>
      </h1>
     "
    ]
  ]
end

Rack::Handler::Thin.run cgi_inspector, :Port => 3000

Visite la página localhost:3000/camino?var=4.

Esta es la salida:

[~/local/src/ruby/sinatra/rack/rack-env]$ curl -v localhost:3000/camino?var=4
* About to connect() to localhost port 3000 (#0)
*   Trying ::1... Connection refused
*   Trying 127.0.0.1... connected
* Connected to localhost (127.0.0.1) port 3000 (#0)
> GET /camino?var=4 HTTP/1.1
> User-Agent: curl/7.21.4 (universal-apple-darwin11.0) libcurl/7.21.4 OpenSSL/0.9.8y zlib/1.2.5
> Host: localhost:3000
> Accept: */*
> 
< HTTP/1.1 200 OK
< Content-Type: text/html
< Connection: close
< Server: thin 1.5.1 codename Straight Razor
< 
<h1>
        Your request:<br>
       <ul>
         <li>http method is: GET
         <li>path is: /camino
         <li>Query string is: var=4
       </ul>
      </h1>
* Closing connection #0



Casiano Rodriguez León 2015-01-07