Index: [Article Count Order] [Thread]

Date: Thu, 23 May 2002 20:30:54 +0900
From: GOTO Kentaro <gotoken@notwork.org>
Subject: [webricken:100] Re: Full Request URL?
To: webricken@notwork.org
Message-Id: <200205231130.g4NBUtrF068371@miso.k.notwork.org>
In-Reply-To: <20020523101218.GA22193@peta.cs.auc.dk>
References: <20020522104939.GA27266@peta.cs.auc.dk>	<200205221134.g4MBYlrF065627@miso.k.notwork.org>	<20020523101218.GA22193@peta.cs.auc.dk>
X-Mail-Count: 00100

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