Re: URL's (was Re: Perl 5 LWP Design)
Tim Bunce (Tim.Bunce@ig.co.uk)
Tue, 7 Mar 1995 13:55:48 +0000
> From: Jack Shirazi - BIU <js@bison.lif.icnet.uk>
>
>
> > > I've been wondering about URL's and proxies actually. I don't like
> > > $url->proxify really, because routing a specific URL through a proxy
> > > is not actually a different location, so after ->proxify, is it really
> > > still a URL?. It becomes a problem when creating the request: for
> > >
> > > http://web/index.html
> > >
> > > you want to create GET /index.html HTTP/1.0
> > >
> > > whereas for http://cache/http://web/index.html
> > >
> > > you want to create GET http://web/index.html HTTP1.0
> > >
> > > ie without the leading slash. But how do you know when to give/hide
> > > the leading slash?
> > >
> > > You could either have $url->proxify store a variable IveBeenProxied,
> > > but I wondered about atually using the URL class, and subclass a
> > > specific ProxyURL from it:
> > >
> > > $url = new WWW::URL http://web/index.html
> > > $proxy = new WWW::ProxyURL $url, 'cache.com', '8001'
> > >
> > > or
> > > $proxy = new WWW::URL 'http://cache:8001';
> > > $url = new WWW::URL 'http://web/index.html'
> > >
> > > if ($proxy) {
> > > $url = new WWW::ProxyURL $proxy, $url;
> > > }
> > > [...]
> > > Alternatively you could do it completeley outside the URL class, but
> > > that breaks quite a lot of the cleanliness of the internal interface.
> > >
> > Which would be a shame.
>
> I would argue that 'Proxiness' is almost completely outside the URL class - it
> should be contained ONLY in a socket/communication/connection class.
Or an HTTP::Client class, I guess.
> The URL
> should not care whether it is a proxy or not. If proxies are in use, then the
> socket connections should all just go to the proxy host. The only difference
> for the URL is whether to include the hostname when passed to the server -
> and that should depend on the whether this is a 'proxy' session.
>
That all sounds very reasonable.
(I'm coming into WWW/HTML/HTTP late and my understanding of the domain
is not really good enough to have strong opinions on the best object
modeling - but I'm learning fast... :-)
Regards,
Tim.