tomcat-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bugzi...@apache.org
Subject DO NOT REPLY [Bug 50413] Tomcat returns 304 instead of 404 response for static custom 404 error file
Date Sat, 08 Jan 2011 21:13:25 GMT
https://issues.apache.org/bugzilla/show_bug.cgi?id=50413

--- Comment #6 from Konstantin Kolinko <knst.kolinko@gmail.com> 2011-01-08 16:13:19
EST ---
One minor glitch with the current fix for this issue:
(regards 7.0, 6.0 and proposed patch for 5.5)


In DefaultServlet#serveResource(..) there is the following condition:
        if ( (cacheEntry.context != null) 
                || ( ((ranges == null) || (ranges.isEmpty()))
                        && (request.getHeader("Range") == null) )
                || (ranges == FULL) ) {

Note the following part of it:
 (ranges == null || ranges.isEmpty()) && (request.getHeader("Range") == null)

With the current fix for this issue a "parseRange(request, response,
cacheEntry.attributes)" call is skipped and thus "ranges" remains to be null,
but request.getHeader("Range") still returns the original header.

==============================================================================
Using MyWebApp with a custom 404.html page, as described by OP, I now get:

In current 7.0.x (at rev.1056780)
-- Request:
GET /MyWebApp/AUrlToAFileWhichDoesNotExist.gif HTTP/1.1
Host: localhost
Keep-Alive: 115
Connection: keep-alive
Range: bytes=0-499
-- Response:
HTTP/1.1 404 Not Found
Server: Apache-Coyote/1.1
Transfer-Encoding: chunked
Date: Sat, 08 Jan 2011 20:49:46 GMT

0
-- Request: (without the "Range" header)
GET /MyWebApp/AUrlToAFileWhichDoesNotExist.gif HTTP/1.1
Host: localhost
Keep-Alive: 115
Connection: keep-alive
--
HTTP/1.1 404 Not Found
Server: Apache-Coyote/1.1
Content-Type: text/html
Content-Length: 17
Date: Sat, 08 Jan 2011 20:51:02 GMT

Error 404.html!
--

I.e., if "Range" header was specified, the custom error page is not used at
all.


It is not a show stopper, as it is still better than it was before, because
e.g. in 5.5.31 the response is the following:

-- Request:
GET /MyWebApp/AUrlToAFileWhichDoesNotExist.gif HTTP/1.1
Host: localhost
Keep-Alive: 115
Connection: keep-alive
Range: bytes=0-499
-- Response:
HTTP/1.1 206 Partial Content
Server: Apache-Coyote/1.1
Accept-Ranges: bytes
ETag: W/"17-1294518367875"
Last-Modified: Sat, 08 Jan 2011 20:26:07 GMT
Content-Range: bytes 0-16/17
Content-Type: text/html
Content-Length: 17
Date: Sat, 08 Jan 2011 21:01:35 GMT

Error 404.html!
--
which is wrong, because it is successful "206 Partial Content", while "404 Not
Found" was expected instead.

-- 
Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.

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


Mime
View raw message