-----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-----