chiark / gitweb /
Testing: Fix up $url management
We need to handle the incoming URL more subtly in tests/cgi so that
the tail of the path is preserved; the existing approach squashes it
for the purposes of the CAF get_url callback, but fails to sanitise
the URL at all for the purposes of tests/cgi's form generation.
It would be best if there were a way in the CGI specification for w3m
to tell the script that its own url is actually file:///something, so
that CGI(3pm)'s url method would DTRT. But there isn't.
In the absence of any useful information provided by w3m, CGI makes up
`http://localhost', which is fair enough. We can simply replace that
with our own URL prefix.
So we replace the CAFTEST_URL variable with CAFTEST_URLBASE, which
contains the start of the URL (not including the path part, which
tests/cgi can get out of $q->url, and which we would have difficulty
dismantling and reassembling anyway).
In tests/cgi, we apply this to $url if CAFTEST_URLBASE is set, and
then we can unconditionally supply a get_url hook (which hook is
equivalent to the default one if $url wasn't modified).
Adjusting $url in tests/cgi makes the form field come out with the
right URL. And the new adjustment scheme means that invocations with
a nonempty PATH_INFO do not lose the PATH_INFO.
Signed-off-by: Ian Jackson <Ian.Jackson@eu.citrix.com>