Re: lrequest() routine.. (Retrieves redirected documents)
bcutter@pdn.paradyne.com
Tue, 2 Aug 94 16:32:39 EDT
> Brooks said (speaking of the new www'lrequest() routine:
>
> > later I realized the interface should be like the following..
> >
> > local($method, *url, *headers, *content, $timeout) = @_;
> >
> > (passing url as a pointer rather than a url)..
> >
> > I didn't want to deviate from the &request interface, but if a URL is
> > redirected to a new URL, the program should know the new URL..
> >
> > Consider Mosaic - when it gets a location redirect, it prints the new
> > URL above the document... (this is why I need the new URL)..
>
> Yep, I have added it to www.pl with that interface. I also added an
> internal limit of 10 redirects so that an infinite loop won't occur
> within the library if someone messes up the redirect (or creates a
> black hole on purpose).
Adding it with the pointer interface is great... you need to change the
entry in the lrequest documentation... it currently reads:
# $respcode = &www'lrequest($method, *url, *headers, *content, $timeout);
...
# $url: A WWW Uniform Resource Locator in absolute form. If the request
# is redirected, $url will be changed to reflect the new URL.
and should read something like
# $respcode = &www'lrequest($method, *url, *headers, *content, $timeout);
...
# *url: A PERL Pointer to a WWW Uniform Resource Locator in absolute form.
# If the request is redirected, $url will be changed to reflect the new URL.
...After I sent the original letter, I was thinking - with perl I think you can
check to see if the argument is/isn't scalar before pulling it off @_ ... you could
define the interface to use $url if it's passed as scalar, *url if passed as a pointer..
but that would probably just confuse things..
> BTW, Mosaic will gleefully pursue a redirect black hole until the cows
> come home. In case you are wondering, a black hole can be created on
> an NCSA httpd server with the following SRM directive:
>
> Redirect /Test/black-hole.ps http://my.server/Test/black-hole.ps.gz
>
> (I know, because I tried to do that myself when I compressed some files
> to save my server's disk space).
Sounds like something I'd want to do - sorry to hear it can't be done yet..
At least that's one bug Mosaic has and my browser doesn't... but then I'm
still way ahead at this point when it comes to bugs.. 8)
-Brooks