A non-anonymous version of the above..
The enclosed test fails as below. The docs don't make it
clear enough for me to fix this and I've tried all sorts of
combinations of baseURL and url.
Help, because potentially this is just what I'm looking
for.
John Oakley
There was 1 error:
1) fetch::steps
(com.netriser.xmltestsuite.testcases.fetch)
com.meterware.httpunit.HttpException: Error on HTTP
request: 400 Bad Request [http://www.availability-
inc.com/index]
FAILURES!!!
Tests run: 2, Failures: 0, Errors: 1
========================================
<?xml version="1.0" ?>
<!DOCTYPE testSpec SYSTEM "..\lib\test.dtd">
<testSpec application="test1"
baseURL="http://www.availability-inc.com">
<steps>
<fetch url="http://www.availability-
inc.com/index"/>
<verifylinks/>
</steps>
</testSpec>
Logged In: YES
user_id=445780
The problem is in the httpunit.jar that is shipped with
xmltestsuite. I pulled the recent httpunit source from CVS,
but was still getting the same problem. Inspecting it I
found that the Host: header was setting the Port as -1, i.e,
it sets the Host header to Host: host:-1
Apply the following fix in getRequestURL() function in
WebConversation.java:
function getRequestURL(...) {
// ...
String hostName = request.getURL().getHost();
int port = request.getURL().getPort();
if (port < 1)
port = 80;
setHeaderField( "Host", hostName + ':' + port );
// ...
}
Run `ant jar'.
Copy the httpunit.jar from the lib directory to
xmltestsuite/lib.
There might be a better way to handle this, but I've just
surfaced Java only for this!