matz / netlab.co.jp (Yukihiro Matsumoto) writes:

> In message "[ruby-talk:03149] Retrieving the hostname and port in net/http"
>     on 00/06/07, Roland Jesse <jesse / cs.uni-magdeburg.de> writes:
> 
> |I have an URL I want to access in a ruby program with the addition of
> |posting some form data to it afterwards. The problem, though, is that
> |I have to post the form data to the new URL that I get refered to when
> |opening the one mentioned above. Like this:
> 
> Net::HTTPResponse does not have `base' method (yet).
> 
> You can retrieve base url by...
>  resp, data = host.get( cgiURL, nil) # (1)
>  uri = resp['Content-Base'] || resp['Content-Location'] || resp['Base']

Matz:

One of the problems is that HTTP#get throws an exception on a 301, so
there's no resp structure to interrogate.

In general, I think some of the Net:: classes throw exceptions when
they really should return status. This is one of those cases.


Regards


Dave