At Thu, 23 May 2002 12:12:18 +0200,
Lars Christensen wrote:
> > s.mount_proc("/"){|req, res|
> > res.body = "http://#{req['host']}#{req.request_uri}"
> > }
> Thanks. This helped in the case of HTTP/1.1. However, in the case of HTTP/1.0
> (or others) it could be useful to have access to the return value of
> Socket#addr of the local. This following patch adds this to the httprequest
> class.
Thank you for patch. However, I'm sorry to say that looks having
problem because Socket#addr uses gethostname(2) simply. Generally
speaking, gethostname may differ from DNS record or /etc/hosts in the
LAN. So Socket#addr is not appropriate for the host part of URL.
I looked for a platform independent way to get host name automatically
too, but there seems not existing.
Then, I think default host part should be given manually by config or
something else.
-- Gotoken