[Borges-users] Putting CGI environment into session

Kaspar Schiess eule at space.ch
Tue Apr 27 19:21:30 EDT 2004


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Hello all,

As a follow up to the thread 'controller and delegate', I have thought
about how to be able to access the CGI vars in Borges. I have come up
with the following:

session.request  # current request
session.request.cgi_env  # CGI 1.1 Environment for CGI/WEBrick

I have working code of this here. The cgi_env method returns a hash like
the following:

{"HTTP_MAX_FORWARDS"=>"10",
~ "SERVER_NAME"=>"localhost",
~ "HTTP_X_FORWARDED_HOST"=>"localhost",
~ "HTTP_USER_AGENT"=>
~  "...",
~ "HTTP_ACCEPT_ENCODING"=>"gzip,deflate",
~ "REMOTE_HOST"=>"localhost",
~ "PATH_INFO"=>"/env/@IRYqTsfhxhaivHcC/JiJLVIkF",
~ "HTTP_HOST"=>"localhost:7000",
~ "HTTP_ACCEPT_LANGUAGE"=>"de-ch,de;q=0.8,en-us;q=0.5,en;q=0.3",
~ "HTTP_CACHE_CONTROL"=>"max-age=0",
~ "SERVER_PROTOCOL"=>"HTTP/1.1",
~ "SCRIPT_NAME"=>"/borges",
~ "SERVER_SOFTWARE"=>"WEBrick/1.3.1 (Ruby/1.8.1/2004-01-27)",
~ "REMOTE_ADDR"=>"127.0.0.1",
~ "HTTP_ACCEPT_CHARSET"=>"ISO-8859-1,utf-8;q=0.7,*;q=0.7",
~ "HTTP_X_FORWARDED_SERVER"=>"...",
~
"REQUEST_URI"=>"http://localhost:7000/borges/env/@IRYqTsfhxhaivHcC/JiJLVIkF",
~ "SERVER_PORT"=>"7000",
~ "REMOTE_USER"=>nil,
~ "QUERY_STRING"=>"",
~ "GATEWAY_INTERFACE"=>"CGI/1.1",
~ "HTTP_ACCEPT"=>

"application/x-shockwave-flash,text/xml,application/xml,application/xhtml+xml,text/html;q=0.9,text/plain;q=0.8,video/x-mng,image/png,image/jpeg,image/gif;q=0.2,*/*;q=0.1",
~ "HTTP_X_FORWARDED_FOR"=>"127.0.0.1",
~ "REQUEST_METHOD"=>"GET"}

To get this working, Borges::Request gets the cgi_env accessor, and has
a parameter for this in initialize. Then all the integration methods
MUST provide CGI 1.1 interface variables to that initializer.

Should I push this feature and make it to a patch ? Anyone interested in
having this in Borges ?

(Thank you Andreas Cahen for providing me with the pointer on where to
find CGI vars in WEBrick.)

- --
kaspar

code manufacture
www.tua.ch/ruby
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.4 (MingW32)
Comment: Using GnuPG with Thunderbird - http://enigmail.mozdev.org

iD8DBQFAjur5Fifl4CA0ImQRAoNoAJ0R+A9X8zbkKsMb34Cr8FtSsSYMMACfZHqO
+irG9WqhNZGG7jwqAfScP3w=
=sEKh
-----END PGP SIGNATURE-----


More information about the Borges-users mailing list