You are viewing a plain text version of this content. The canonical link for it is here.
Posted to slide-dev@jakarta.apache.org by Dirk Verbeeck <di...@pandora.be> on 2001/12/02 15:43:19 UTC
Re: Problem with GET requests using "Range:" header
If you can send us the eaquest and response headers then maybe we can
help you.
Dirk
"GARTRELL,MIKE (HP-Corvallis,ex1)" wrote:
>
> 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 <--- ---> mike_gartrell@hp.com <---
> ---> phone: (541) 715-0008 <---
>
> --
> To unsubscribe, e-mail: <ma...@jakarta.apache.org>
> For additional commands, e-mail: <ma...@jakarta.apache.org>
--
To unsubscribe, e-mail: <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>
Re: Problem with GET requests using "Range:" header
Posted by Remy Maucherat <re...@apache.org>.
> If you can send us the eaquest and response headers then maybe we can
> help you.
I tried with a telnet accessing the Slide WebdavServlet.
Request:
GET /files/Address.txt HTTP/1.1
Host: localhost
Range: bytes=0-
Response:
HTTP/1.1 206 Partial Content
Content-Type: text/plain
Content-Length: 49
Date: Mon, 03 Dec 2001 02:48:50 GMT
Server: Apache Tomcat/4.1-dev (HTTP/1.1 Connector)
Content-Range: bytes 0-48/49
Last-Modified: Mon, 03 Dec 2001 02:42:15 GMT
ETag: "49-1007347335000"
Set-Cookie: JSESSIONID=E294C26144B1C975F46085A2C839C8D7;Path=/
Followed by the unchunked content of the file.
I wonder why HTTPClient thinks the content is or should be chunked. That's
strange.
Tomcat 4 will return more or less the same thing to a ranged request.
Remy
> "GARTRELL,MIKE (HP-Corvallis,ex1)" wrote:
> >
> > 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 <--- ---> mike_gartrell@hp.com <---
> > ---> phone: (541) 715-0008 <---
> >
> > --
> > To unsubscribe, e-mail:
<ma...@jakarta.apache.org>
> > For additional commands, e-mail:
<ma...@jakarta.apache.org>
>
>
> --
> To unsubscribe, e-mail:
<ma...@jakarta.apache.org>
> For additional commands, e-mail:
<ma...@jakarta.apache.org>
>
--
To unsubscribe, e-mail: <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>