-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
On Wed, 22 May 2002 23:34, GOTO Kentaro wrote:
> At Wed, 22 May 2002 12:49:39 +0200,
>
> Lars Christensen wrote:
> > Is there a way to get the full URL of the requested document / resource?
> > My server has multiple domain names, and i'd like the full URL with the
> > hostname that the client requested the resource on.
>
> HOST request header includes that information in HTTP/1.1.
> Try access to http://your.domain:2002/foo/bar?baz=quux
>
> require 'webrick'
>
> s = WEBrick::HTTPServer.new(:Port => 2002)
> s.mount_proc("/"){|req, res|
> res.body = "http://#{req['host']}#{req.request_uri}"
> }
> s.start
>
> -- Gotoken
Interesting I was using req.path to get a similar value, which is preferred
and why?
Remember that if you want to use just the string representation of the URI
make sure to do a req.request_uri.to_str and do not use req.request_uri.to_s
because it yields a different result.
- --
Signed,
Holden Glova
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.0.6 (GNU/Linux)
Comment: For info see http://www.gnupg.org
iD8DBQE87MJd+mF116Lw2cQRArflAJ4yQFKZdNOJw7tJhBrHK8VZfcd9egCfbrCI
aq0iRYPI65jzhD85xtgxszo=
=67/G
-----END PGP SIGNATURE-----