tomcat-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Reinhard Moosauer <reinh...@mib1.de>
Subject Re: Fwd: If-Range bug in DefaultServlet?
Date Thu, 13 Apr 2006 11:20:00 GMT
Hi Duncan,

could be that your problem is very rarely seen.
I would suggest fo file is as bug in bugzilla.
And please be patient.

Also consider looking into the sources for the DefaultServlet, if you need the 
fix very urgently. Maybe you find the bug and could correct it by yourself.
In any case you will understand the problem better and could write a even 
better bug report. (Which improves your chances of being heard)

Sorry I cannot test by myself, it's too far off my scope. 
Another tip: please give a real-life use case where your bug shows up. This 
gives the report more relevance. Also consider testing with/without the 
native apr library. 

R.

Am Donnerstag, 13. April 2006 12:03 schrieb Duncan McGregor:
> I've had no response to my last on this subject.
>
> I know we're all busy, but this one does seem to be pretty
> fundamental, and I did go to a bunch of trouble to write the testcase
> to show the problem ;-)
>
> I'd value some feedback -
>
> 	Am I completely wrong in thinking that this is a problem?
>
> 	Is there some issue in the way that I reported it?
>
> Duncan McGregor
>
> Begin forwarded message:
> > From: Duncan McGregor <duncan@oneeyedmen.com>
> > Date: 6 April 2006 00:39:57 BDT
> > To: dev@tomcat.apache.org
> > Subject: If-Range bug in DefaultServlet?
> >
> > Hi
> >
> > I've been making If-Range requests to Tomcat (5.5.16) and it seems
> > not to be sending back content when the request and current ETags
> > don't match.
> >
> > RFC 2616 section 14.27 says
> >
> > If the entity tag given in the If-Range header matches the current
> > entity tag for the entity, then the server SHOULD provide the
> > specified sub-range of the entity using a 206 (Partial content)
> > response. If the entity tag does not match, then the server SHOULD
> > return the entire entity using a 200 (OK) response.
> >
> > Am I doing something wrong, or is the servlet behaviour not as it
> > SHOULD be?
> >
> > Thanks in anticipation
> >
> > Duncan McGregor
>
> import java.io.IOException;
>
> import junit.framework.TestCase;
>
> import org.apache.commons.httpclient.Header;
> import org.apache.commons.httpclient.HttpClient;
> import org.apache.commons.httpclient.HttpException;
> import org.apache.commons.httpclient.HttpStatus;
> import org.apache.commons.httpclient.methods.GetMethod;
>
> import com.enterprisedt.net.ftp.FTPClient;
>
> public class TomcatIfRangeTest extends TestCase {
>
>      protected HttpClient httpClient;
>      protected GetMethod getMethod;
>      private FTPClient ftpClient;
>
>      @Override
>      public void setUp() throws Exception {
>          httpClient = new HttpClient();
>          ftpClient = new FTPClient();
>          ftpClient.setRemoteHost("localhost");
>          ftpClient.setControlPort(2122);
>          ftpClient.connect();
>          ftpClient.login("user", "user");
>      }
>
>      public void testIfRange() throws Exception {
>          upload("contents", "delme.txt");
>          assertEquals(HttpStatus.SC_OK, get("http://localhost:8080/
> zirisEdge/public/delme.txt"));
>          String etag = headerValue("ETag");
>          assertEquals("contents", responseBody());
>
>          assertEquals(HttpStatus.SC_PARTIAL_CONTENT,
>                  get("http://localhost:8080/zirisEdge/public/delme.txt",
>                          "If-Range", etag,
>                          "Range", "bytes=1-3"
>                  ));
>          assertEquals(etag, headerValue("ETag"));
>          assertEquals("ont", responseBody());
>
>          upload("new contents", "delme.txt");
>          assertEquals(HttpStatus.SC_OK,
>                  get("http://localhost:8080/zirisEdge/public/delme.txt",
>                          "If-Range", etag,
>                          "Range", "bytes=1-3"
>                  ));
>          assertFalse(etag.equals(headerValue("ETag")));
>          assertEquals("new contents", responseBody());
> 	  // FAILS as responseBody is ""
>      }
>
>      protected int get(String url, String...headerValues) throws
> HttpException, IOException {
>          getMethod = new GetMethod(url);
>          for (int i = 0; i < headerValues.length; i += 2) {
>              getMethod.addRequestHeader(headerValues[i], headerValues
> [i +1]);
>          }
>          return httpClient.executeMethod(getMethod);
>      }
>
>      protected String responseBody() throws IOException {
>          return getMethod.getResponseBodyAsString();
>      }
>
>      protected String headerValue(String headerName) {
>          Header header = getMethod.getResponseHeader(headerName);
>          return header != null ? header.getValue() : null;
>      }
>
>      protected void upload(String contents, String path) throws
> Exception {
>          ftpClient.put(contents.getBytes(), path);
>          Thread.sleep(5000); // TODO - is this a cache timeout?
>      }
>
>
> }
>
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
> For additional commands, e-mail: dev-help@tomcat.apache.org

-- 
Reinhard Moosauer
IT Beratung

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


Mime
View raw message