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