When making GET requests that use the "Range:" header, I encounter
the following problem as indicated by the stack trace below. The GET
request is being sent to Tomcat 4.0 running Slide 1.0.15. This problem may
be due to a bug in Tomcat. Has anyone encountered this problem before?
HTTPClient version: 0.3-2 (http://www.innovation.ch/java/HTTPClient/)
JDK version: 1.3.1, Windows 2000
Code sample:
String RANGE_HEADER_NAME = "Range";
File localFile = new File(localFilePath);
// Construct range header for retrieving remainder of localFile
long localFileLength = localFile.length();
String rangeHeaderValue = "bytes=" + "0" + "-";
HTTPConnection httpCon = new
HTTPConnection(currentDAVConnection.getProtocol(),
currentDAVConnection.getHost(), currentDAVConnection.getPort());
NVPair headerNVPair = new NVPair(RANGE_HEADER_NAME,
rangeHeaderValue);
NVPair[] headerArray = {headerNVPair};
byte[] httpRespData;
try {
HTTPResponse httpResp = httpCon.Get(resourceURI, new String(),
headerArray);
if (httpResp.getStatusCode() >= 300) {
System.err.println("Received Error: " +
httpResp.getReasonLine());
// System.err.println(httpResp.getText());
}
httpRespData = httpResp.getData();
}
Stack trace:
HTTPClient.ParseException: Didn't find valid chunk length: %PDF-1.3
at HTTPClient.Codecs.getChunkLength(Codecs.java:1483)
at HTTPClient.StreamDemultiplexor.read(StreamDemultiplexor.java:276)
at HTTPClient.RespInputStream.read(RespInputStream.java:140)
at HTTPClient.HTTPResponse.readResponseData(HTTPResponse.java:834)
at HTTPClient.HTTPResponse.getData(HTTPResponse.java:478)
at com.hp.vdpcore.webdav.DAVReader.readURIResume(DAVReader.java:149)
at
com.hp.vdpcore.webdav.test.DAVReaderTest.testReadURIResume(DAVReaderTest.jav
a:152)
at java.lang.reflect.Method.invoke(Native Method)
at junit.framework.TestCase.runTest(TestCase.java:156)
at junit.framework.TestCase.runBare(TestCase.java:130)
at junit.framework.TestResult$1.protect(TestResult.java:106)
at junit.framework.TestResult.runProtected(TestResult.java:124)
at junit.framework.TestResult.run(TestResult.java:109)
at junit.framework.TestCase.run(TestCase.java:121)
at junit.framework.TestSuite.runTest(TestSuite.java:157)
at junit.framework.TestSuite.run(TestSuite.java:152)
at junit.textui.TestRunner.doRun(TestRunner.java:74)
at junit.textui.TestRunner.run(TestRunner.java:201)
at
com.hp.vdpcore.webdav.test.DAVReaderTest.main(DAVReaderTest.java:70)
java.io.IOException: HTTPClient.ParseException: Didn't find valid chunk
length: %PDF-1.3
at HTTPClient.StreamDemultiplexor.read(StreamDemultiplexor.java:355)
at HTTPClient.RespInputStream.read(RespInputStream.java:140)
at HTTPClient.HTTPResponse.readResponseData(HTTPResponse.java:834)
at HTTPClient.HTTPResponse.getData(HTTPResponse.java:478)
at com.hp.vdpcore.webdav.DAVReader.readURIResume(DAVReader.java:149)
at
com.hp.vdpcore.webdav.test.DAVReaderTest.testReadURIResume(DAVReaderTest.jav
a:152)
at java.lang.reflect.Method.invoke(Native Method)
at junit.framework.TestCase.runTest(TestCase.java:156)
at junit.framework.TestCase.runBare(TestCase.java:130)
at junit.framework.TestResult$1.protect(TestResult.java:106)
at junit.framework.TestResult.runProtected(TestResult.java:124)
at junit.framework.TestResult.run(TestResult.java:109)
at junit.framework.TestCase.run(TestCase.java:121)
at junit.framework.TestSuite.runTest(TestSuite.java:157)
at junit.framework.TestSuite.run(TestSuite.java:152)
at junit.textui.TestRunner.doRun(TestRunner.java:74)
at junit.textui.TestRunner.run(TestRunner.java:201)
at
com.hp.vdpcore.webdav.test.DAVReaderTest.main(DAVReaderTest.java:70)
---> Mike Gartrell <--- ---> [EMAIL PROTECTED] <---
---> phone: (541) 715-0008 <---
--
To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>