Index: [Article Count Order] [Thread]

Date: Fri, 24 May 2002 08:08:22 +1200
From: Holden Glova <dsafari@xtra.co.nz>
Subject: [webricken:103] Re: Full Request URL?
To: webricken@notwork.org
Message-Id: <20020523201134.YOQ10730.mta2-rme.xtra.co.nz@there>
In-Reply-To: <200205231203.g4NC3erF068438@miso.k.notwork.org>
References: <20020522104939.GA27266@peta.cs.auc.dk> <20020523102325.RJLC10730.mta2-rme.xtra.co.nz@there> <200205231203.g4NC3erF068438@miso.k.notwork.org>
X-Mail-Count: 00103

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

On Fri, 24 May 2002 00:03, GOTO Kentaro wrote:
> At Thu, 23 May 2002 22:20:13 +1200,
>
> Holden Glova wrote:
> > Interesting I was using req.path to get a similar value, which is
> > preferred and why?
>
> Hmm, That depends on purpose.  req.path doesn't include query part of
> the requested URI.  In case of httpproxy, request_uri also has host
> part.  req.path is identical to
> HTTPUtils::unescape(req.request_uri.path).

Thanks that is good to know seeing as i will be needing both, but only need 
the path ATM.

> > 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.
>
> Really?  WEBrick does "require 'uri'" and URI::Generic#to_s is defined
> as follows in uri/generic.rb:
>
>     def to_s
>       to_str
>     end
>

Perhaps I was a bit too hasty to say this, but maybe you can explain this?

when URI::Generic#to_s and #to_str they work just fine as you have already 
described. Now when i call it with just puts it does this on my WEBrick 
console window.
explicit call to request_uri.to_s
/demo/
explicit call to request_uri.to_str
/demo/
raw puts on request_uri
nil
nil
nil
nil
nil
/demo/
nil
nil
nil

I thought that was calling to_str - sorry for the hastey statement. What else 
could it be calling with a simple puts req.request_uri  ?


- -- 
Signed,
Holden Glova
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.0.6 (GNU/Linux)
Comment: For info see http://www.gnupg.org

iD8DBQE87Uw3+mF116Lw2cQRAgbpAJ4z+5nj6iVwfWHJj2JpUUMSdSLf3ACfUDZm
+D258rgIHFoBzsgA2uIfaaM=
=iFoE
-----END PGP SIGNATURE-----