[Webtest] Testing with a GZip Filter enabled
Raible, Matt
webtest@lists.canoo.com
Thu, 10 Jul 2003 18:07:56 -0600
Thanks Richard - you pointed me in the right direction. I ended up pulling
down httpunit 1.5.3 and changing the following method from:
protected void defineRawInputStream( InputStream inputStream ) throws
IOException {
if (_inputStream != null || _responseText != null) {
throw new IllegalStateException( "Must be called before response
text is defined." );
}
if (encodedUsingGZIP()) {
inputStream = new GZIPInputStream( inputStream );
} else {
_inputStream = inputStream;
}
}
TO:
protected void defineRawInputStream( InputStream inputStream ) throws
IOException {
if (_inputStream != null || _responseText != null) {
throw new IllegalStateException( "Must be called before response
text is defined." );
}
if (encodedUsingGZIP()) {
try {
_inputStream = new GZIPInputStream( inputStream );
} catch (EOFException eof) {
_inputStream = inputStream;
}
} else {
_inputStream = inputStream;
}
}
And it fixed the problem - thanks!
Matt
-----Original Message-----
From: Richard Hill [mailto:RHill@classmates.com]
Sent: Thursday, July 10, 2003 5:28 PM
To: 'webtest@gate.canoo.com'
Subject: RE: [Webtest] Testing with a GZip Filter enabled
Matt,
I was having the same problem a while back. I turns out that Java has a bug
(id 4040920) in there ZLIB input stream that throws a java.io.EOFException
while reading compressed files. HttpUnit's Webresponse uses this input
stream. I treated this as false error and added a method in Webresponse to
check for the unexpected end-of-file (-1) and used it to signal the input
stream to stop.
I'm using HttpUnit 1.4.1, so newer versions may be using different methods,
but I think you'll get the idea. So in Webresponse I did the following:
protected void loadResponseText() throws IOException {
.
.
.
do {
outputStream.write( buffer, 0, count );
count = checkCount(buffer, inputStream);
} while (count != -1);
.
.
.
}
protected int checkCount(byte[] buffer, InputStream inputStream) {
int count = -1;
try{
count = inputStream.read( buffer, 0, buffer.length );
} catch (IOException ioe) {
return (count = -1);
}
return count;
}
Hopes this helps,
Richard Hill
-----Original Message-----
From: Raible, Matt [mailto:Matt_Raible@cable.comcast.com]
Sent: Thursday, July 10, 2003 1:02 PM
To: 'webtest@lists.canoo.com'
Subject: [Webtest] Testing with a GZip Filter enabled
I have recently added a compression filter (http://tinyurl.com/f5o0) to my
application, and now I'm getting the following error on the step below.
I'm using build 265, JDK 1.4.2, Ant 1.5.3-1 and Tomcat 4.1.24.
Thanks,
Matt
<clickbutton label="Update" stepid="Click the Update button"/>
updatePassword:
[canoo] Rhino classes (js.jar) not found - Javascript disabled
[canoo] java.io.EOFException
[canoo] at
java.util.zip.GZIPInputStream.readUByte(GZIPInputStream.java:200)
[canoo] at
java.util.zip.GZIPInputStream.readUShort(GZIPInputStream.java:190)
[canoo] at
java.util.zip.GZIPInputStream.readHeader(GZIPInputStream.java:130)
[canoo] at
java.util.zip.GZIPInputStream.<init>(GZIPInputStream.java:58)
[canoo] at
java.util.zip.GZIPInputStream.<init>(GZIPInputStream.java:68)
[canoo] at
com.meterware.httpunit.WebResponse.defineRawInputStream(WebResponse.java:617
)
[canoo] at
com.meterware.httpunit.HttpWebResponse.<init>(HttpWebResponse.java:57)
[canoo] at
com.meterware.httpunit.WebConversation.newResponse(WebConversation.java:66)
[canoo] at
com.meterware.httpunit.WebClient.getResource(WebClient.java:101)
[canoo] at
com.meterware.httpunit.WebClient.getResponse(WebClient.java:82)
[canoo] at
com.canoo.webtest.steps.request.Target.getResponse(Target.java:272)
[canoo] at
com.canoo.webtest.steps.request.Target.gotoTarget(Target.java:216)
[canoo] at
com.canoo.webtest.steps.request.Target.gotoTarget(Target.java:172)
[canoo] at
com.canoo.webtest.steps.request.ClickButton.doExecute(ClickButton.java:92)
[canoo] at com.canoo.webtest.steps.Step.execute(Step.java:54)
[canoo] at
com.canoo.webtest.engine.Engine.executeSteps(Engine.java:32)
[canoo] at
com.canoo.webtest.ant.TestSpecificationTask.execute(TestSpecificationTask.ja
va:55)
[canoo] at org.apache.tools.ant.Task.perform(Task.java:341)
[canoo] at org.apache.tools.ant.Target.execute(Target.java:309)
[canoo] at org.apache.tools.ant.Target.performTasks(Target.java:336)
[canoo] at
org.apache.tools.ant.Project.executeTarget(Project.java:1339)
[canoo] at org.apache.tools.ant.taskdefs.Ant.execute(Ant.java:397)
[canoo] at org.apache.tools.ant.Task.perform(Task.java:341)
[canoo] at org.apache.tools.ant.Target.execute(Target.java:309)
[canoo] at org.apache.tools.ant.Target.performTasks(Target.java:336)
[canoo] at
org.apache.tools.ant.Project.executeTarget(Project.java:1339)
[canoo] at
org.apache.tools.ant.Project.executeTargets(Project.java:1255)
[canoo] at org.apache.tools.ant.Main.runBuild(Main.java:609)
[canoo] at org.apache.tools.ant.Main.start(Main.java:196)
[canoo] at org.apache.tools.ant.Main.main(Main.java:235)
_______________________________________________
WebTest mailing list
WebTest@lists.canoo.com
http://lists.canoo.com/mailman/listinfo/webtest
_______________________________________________
WebTest mailing list
WebTest@lists.canoo.com
http://lists.canoo.com/mailman/listinfo/webtest