remm 00/11/14 17:08:24
Modified: catalina/src/share/org/apache/catalina/servlets
DefaultServlet.java
Log:
- DefaultServlet won't do anything on a POST.
- Noticed a check was missing in If-None-Match header handling (* wildcard).
Revision Changes Path
1.15 +29 -30
jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/servlets/DefaultServlet.java
Index: DefaultServlet.java
===================================================================
RCS file:
/home/cvs/jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/servlets/DefaultServlet.java,v
retrieving revision 1.14
retrieving revision 1.15
diff -u -r1.14 -r1.15
--- DefaultServlet.java 2000/11/10 18:33:48 1.14
+++ DefaultServlet.java 2000/11/15 01:08:23 1.15
@@ -1,7 +1,7 @@
/*
- * $Header:
/home/cvs/jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/servlets/DefaultServlet.java,v
1.14 2000/11/10 18:33:48 remm Exp $
- * $Revision: 1.14 $
- * $Date: 2000/11/10 18:33:48 $
+ * $Header:
/home/cvs/jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/servlets/DefaultServlet.java,v
1.15 2000/11/15 01:08:23 remm Exp $
+ * $Revision: 1.15 $
+ * $Date: 2000/11/15 01:08:23 $
*
* ====================================================================
*
@@ -112,7 +112,7 @@
*
* @author Craig R. McClanahan
* @author Remy Maucherat
- * @version $Revision: 1.14 $ $Date: 2000/11/10 18:33:48 $
+ * @version $Revision: 1.15 $ $Date: 2000/11/15 01:08:23 $
*/
public class DefaultServlet
@@ -452,9 +452,6 @@
protected void doPost(HttpServletRequest request,
HttpServletResponse response)
throws IOException, ServletException {
-
- doPut(request, response);
-
}
@@ -627,10 +624,12 @@
// Checking If-None-Match
headerValue = request.getHeader("If-None-Match");
if (headerValue != null) {
- if (headerValue.indexOf("*") == -1) {
+
+ boolean conditionSatisfied = false;
+
+ if (!headerValue.equals("*")) {
commaTokenizer = new StringTokenizer(headerValue, ",");
- boolean conditionSatisfied = false;
while (!conditionSatisfied && commaTokenizer.hasMoreTokens()) {
String currentToken = commaTokenizer.nextToken();
@@ -638,29 +637,28 @@
conditionSatisfied = true;
}
- if (conditionSatisfied) {
-
- // For GET and HEAD, we should respond with
- // 304 Not Modified.
- // For every other method, 412 Precondition Failed is sent
- // back.
- if ( ("GET".equals(request.getMethod()))
- || ("HEAD".equals(request.getMethod())) ) {
- response.sendError
- (HttpServletResponse.SC_NOT_MODIFIED);
- return false;
- } else {
- response.sendError
- (HttpServletResponse.SC_PRECONDITION_FAILED);
- return false;
- }
- }
-
} else {
- if (resourceInfo.exists()) {
-
+ conditionSatisfied = true;
+ }
+
+ if (conditionSatisfied) {
+
+ // For GET and HEAD, we should respond with
+ // 304 Not Modified.
+ // For every other method, 412 Precondition Failed is sent
+ // back.
+ if ( ("GET".equals(request.getMethod()))
+ || ("HEAD".equals(request.getMethod())) ) {
+ response.sendError
+ (HttpServletResponse.SC_NOT_MODIFIED);
+ return false;
+ } else {
+ response.sendError
+ (HttpServletResponse.SC_PRECONDITION_FAILED);
+ return false;
}
}
+
}
// Checking If-Unmodified-Since
@@ -1280,8 +1278,9 @@
}
// Checking If headers
- if ( !checkIfHeaders(request, response, resourceInfo) )
+ if ( !checkIfHeaders(request, response, resourceInfo) ) {
return;
+ }
// Find content type.
String contentType =
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]