You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by ma...@apache.org on 2011/06/05 12:21:25 UTC

svn commit: r1132367 - in /tomcat/trunk: java/org/apache/coyote/http11/Http11AprProcessor.java webapps/docs/changelog.xml

Author: markt
Date: Sun Jun  5 10:21:25 2011
New Revision: 1132367

URL: http://svn.apache.org/viewvc?rev=1132367&view=rev
Log:
Correctly handle range requests when using sendfile and the APR/native HTTP connector.

Modified:
    tomcat/trunk/java/org/apache/coyote/http11/Http11AprProcessor.java
    tomcat/trunk/webapps/docs/changelog.xml

Modified: tomcat/trunk/java/org/apache/coyote/http11/Http11AprProcessor.java
URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/coyote/http11/Http11AprProcessor.java?rev=1132367&r1=1132366&r2=1132367&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/coyote/http11/Http11AprProcessor.java (original)
+++ tomcat/trunk/java/org/apache/coyote/http11/Http11AprProcessor.java Sun Jun  5 10:21:25 2011
@@ -831,7 +831,7 @@ public class Http11AprProcessor extends 
             sendfileData.start = ((Long) request.getAttribute(
                     "org.apache.tomcat.sendfile.start")).longValue();
             sendfileData.end = ((Long) request.getAttribute(
-                    "org.apache.tomcat.sendfile.end")).longValue();
+                    "org.apache.tomcat.sendfile.end")).longValue() - sendfileData.pos;
             return true;
         }
         return false;

Modified: tomcat/trunk/webapps/docs/changelog.xml
URL: http://svn.apache.org/viewvc/tomcat/trunk/webapps/docs/changelog.xml?rev=1132367&r1=1132366&r2=1132367&view=diff
==============================================================================
--- tomcat/trunk/webapps/docs/changelog.xml (original)
+++ tomcat/trunk/webapps/docs/changelog.xml Sun Jun  5 10:21:25 2011
@@ -42,6 +42,16 @@
   General, Catalina, Coyote, Jasper, Cluster, Web applications, Extras, Tribes,
   Other
 -->
+<section name="Tomcat 7.0.16 (markt)">
+  <subsection name="Coyote">
+    <changelog>
+      <fix>
+        Correctly handle range requests when using sendfile and the APR/native
+        HTTP connector. (markt)
+      </fix>
+    </changelog>
+  </subsection>
+</section>
 <section name="Tomcat 7.0.15 (markt)">
   <subsection name="Catalina">
     <changelog>



---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org


Re: svn commit: r1132367 - in /tomcat/trunk: java/org/apache/coyote/http11/Http11AprProcessor.java webapps/docs/changelog.xml

Posted by Remy Maucherat <re...@apache.org>.
On Mon, 2011-06-06 at 19:15 +0100, Mark Thomas wrote:
> Doh. Got it. We do need to modify the length to handle range requests,
> but not like that.

What's the issue exactly ? When actually sending data, "pos" is set to
"start" and the length is used as the usual "end - pos".

Rémy



---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org


Re: svn commit: r1132367 - in /tomcat/trunk: java/org/apache/coyote/http11/Http11AprProcessor.java webapps/docs/changelog.xml

Posted by Mark Thomas <ma...@apache.org>.
On 06/06/2011 19:15, Mark Thomas wrote:
> On 06/06/2011 18:43, Caldarale, Charles R wrote:
>>> From: Mark Thomas [mailto:markt@apache.org] 
>>> Subject: Re: svn commit: r1132367 - in /tomcat/trunk: 
>>> java/org/apache/coyote/http11/Http11AprProcessor.java 
>>> webapps/docs/changelog.xml
>>
>>> On 06/06/2011 09:01, Remy Maucherat wrote:
>>>> I don't understand, the code reads:
>>>> sendfileData = new AprEndpoint.SendfileData();
>>>> sendfileData.fileName = fileName;
>>>> sendfileData.start = ((Long) request.getAttribute(
>>>>  	"org.apache.tomcat.sendfile.start")).longValue();
>>>> sendfileData.end = ((Long) request.getAttribute(
>>>> 	"org.apache.tomcat.sendfile.end")).longValue() - sendfileData.pos; 
>>>>
>>>> So how can sendfileData.pos not be 0 here ?
>>
>>> Because when the DefaultServlet handles a range request start may be
>>> non-zero. (line 1658 in trunk)
>>
>> That's not the issue; the question is how could sendFileData.pos be non-zero in an object that was just instantiated from a class that has no explicit constructor?
> 
> Doh. Got it. We do need to modify the length to handle range requests,
> but not like that.

I got confused between the APR SendfileData and the NIO SendfileData.
APR is fine - I'll revert this change and the changelog entry. Both are
currently working.

I will be making some further changes to align the two so I can reduce
the duplication.

Mark

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org


Re: svn commit: r1132367 - in /tomcat/trunk: java/org/apache/coyote/http11/Http11AprProcessor.java webapps/docs/changelog.xml

Posted by Mark Thomas <ma...@apache.org>.
On 06/06/2011 18:43, Caldarale, Charles R wrote:
>> From: Mark Thomas [mailto:markt@apache.org] 
>> Subject: Re: svn commit: r1132367 - in /tomcat/trunk: 
>> java/org/apache/coyote/http11/Http11AprProcessor.java 
>> webapps/docs/changelog.xml
> 
>> On 06/06/2011 09:01, Remy Maucherat wrote:
>>> I don't understand, the code reads:
>>> sendfileData = new AprEndpoint.SendfileData();
>>> sendfileData.fileName = fileName;
>>> sendfileData.start = ((Long) request.getAttribute(
>>>  	"org.apache.tomcat.sendfile.start")).longValue();
>>> sendfileData.end = ((Long) request.getAttribute(
>>> 	"org.apache.tomcat.sendfile.end")).longValue() - sendfileData.pos; 
>>>
>>> So how can sendfileData.pos not be 0 here ?
> 
>> Because when the DefaultServlet handles a range request start may be
>> non-zero. (line 1658 in trunk)
> 
> That's not the issue; the question is how could sendFileData.pos be non-zero in an object that was just instantiated from a class that has no explicit constructor?

Doh. Got it. We do need to modify the length to handle range requests,
but not like that.

Mark



---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org


RE: svn commit: r1132367 - in /tomcat/trunk: java/org/apache/coyote/http11/Http11AprProcessor.java webapps/docs/changelog.xml

Posted by "Caldarale, Charles R" <Ch...@unisys.com>.
> From: Mark Thomas [mailto:markt@apache.org] 
> Subject: Re: svn commit: r1132367 - in /tomcat/trunk: 
> java/org/apache/coyote/http11/Http11AprProcessor.java 
> webapps/docs/changelog.xml

> On 06/06/2011 09:01, Remy Maucherat wrote:
> > I don't understand, the code reads:
> > sendfileData = new AprEndpoint.SendfileData();
> > sendfileData.fileName = fileName;
> > sendfileData.start = ((Long) request.getAttribute(
> >  	"org.apache.tomcat.sendfile.start")).longValue();
> > sendfileData.end = ((Long) request.getAttribute(
> > 	"org.apache.tomcat.sendfile.end")).longValue() - sendfileData.pos; 
> > 
> > So how can sendfileData.pos not be 0 here ?

> Because when the DefaultServlet handles a range request start may be
> non-zero. (line 1658 in trunk)

That's not the issue; the question is how could sendFileData.pos be non-zero in an object that was just instantiated from a class that has no explicit constructor?

 - Chuck


THIS COMMUNICATION MAY CONTAIN CONFIDENTIAL AND/OR OTHERWISE PROPRIETARY MATERIAL and is thus for use only by the intended recipient. If you received this in error, please contact the sender and delete the e-mail and its attachments from all computers.


Re: svn commit: r1132367 - in /tomcat/trunk: java/org/apache/coyote/http11/Http11AprProcessor.java webapps/docs/changelog.xml

Posted by Mark Thomas <ma...@apache.org>.
On 06/06/2011 09:01, Remy Maucherat wrote:
> On Sun, 2011-06-05 at 10:21 +0000, markt@apache.org wrote:
>> Author: markt
>> Date: Sun Jun  5 10:21:25 2011
>> New Revision: 1132367
>>
>> URL: http://svn.apache.org/viewvc?rev=1132367&view=rev
>> Log:
>> Correctly handle range requests when using sendfile and the APR/native HTTP connector.
>> -                    "org.apache.tomcat.sendfile.end")).longValue();
>> +                    "org.apache.tomcat.sendfile.end")).longValue() - sendfileData.pos;
> 
> I don't understand, the code reads:
> sendfileData = new AprEndpoint.SendfileData();
> sendfileData.fileName = fileName;
> sendfileData.start = ((Long) request.getAttribute(
>  	"org.apache.tomcat.sendfile.start")).longValue();
> sendfileData.end = ((Long) request.getAttribute(
> 	"org.apache.tomcat.sendfile.end")).longValue() - sendfileData.pos; 
> 
> So how can sendfileData.pos not be 0 here ?

Because when the DefaultServlet handles a range request start may be
non-zero. (line 1658 in trunk)

Mark



---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org


Re: svn commit: r1132367 - in /tomcat/trunk: java/org/apache/coyote/http11/Http11AprProcessor.java webapps/docs/changelog.xml

Posted by Remy Maucherat <re...@apache.org>.
On Sun, 2011-06-05 at 10:21 +0000, markt@apache.org wrote:
> Author: markt
> Date: Sun Jun  5 10:21:25 2011
> New Revision: 1132367
> 
> URL: http://svn.apache.org/viewvc?rev=1132367&view=rev
> Log:
> Correctly handle range requests when using sendfile and the APR/native HTTP connector.
> -                    "org.apache.tomcat.sendfile.end")).longValue();
> +                    "org.apache.tomcat.sendfile.end")).longValue() - sendfileData.pos;

I don't understand, the code reads:
sendfileData = new AprEndpoint.SendfileData();
sendfileData.fileName = fileName;
sendfileData.start = ((Long) request.getAttribute(
 	"org.apache.tomcat.sendfile.start")).longValue();
sendfileData.end = ((Long) request.getAttribute(
	"org.apache.tomcat.sendfile.end")).longValue() - sendfileData.pos; 

So how can sendfileData.pos not be 0 here ?

Rémy



---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org