chiark / gitweb /
Testing: Fix up $url management
authorIan Jackson <ian.jackson@eu.citrix.com>
Tue, 27 Oct 2015 18:51:03 +0000 (18:51 +0000)
committerIan Jackson <Ian.Jackson@eu.citrix.com>
Tue, 27 Oct 2015 18:51:03 +0000 (18:51 +0000)
commit71abfbffcb5c784a85589aaff02f9ab7ef4c93bc
tree030f2c36b61a731f0312e67946b7ef12d04814eb
parentd8f2e2818a90ea2fa2ce60985f613875b5e52f7c
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>
tests/cgi
tests/wrap