httpd-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From rpl...@apache.org
Subject svn commit: r627097 - /httpd/httpd/trunk/modules/proxy/mod_proxy_ajp.c
Date Tue, 12 Feb 2008 20:51:09 GMT
Author: rpluem
Date: Tue Feb 12 12:51:08 2008
New Revision: 627097

URL: http://svn.apache.org/viewvc?rev=627097&view=rev
Log:
* As per niq's comment, better destinct the types of idempotence.

Modified:
    httpd/httpd/trunk/modules/proxy/mod_proxy_ajp.c

Modified: httpd/httpd/trunk/modules/proxy/mod_proxy_ajp.c
URL: http://svn.apache.org/viewvc/httpd/httpd/trunk/modules/proxy/mod_proxy_ajp.c?rev=627097&r1=627096&r2=627097&view=diff
==============================================================================
--- httpd/httpd/trunk/modules/proxy/mod_proxy_ajp.c (original)
+++ httpd/httpd/trunk/modules/proxy/mod_proxy_ajp.c Tue Feb 12 12:51:08 2008
@@ -89,16 +89,13 @@
     return OK;
 }
 
+#define METHOD_NON_IDEMPOTENT       0
+#define METHOD_IDEMPOTENT           1
+#define METHOD_IDEMPOTENT_WITH_ARGS 2
+
 static int is_idempotent(request_rec *r)
 {
     /*
-     * If the request has arguments it might not be idempotent as it might have
-     * side-effects.
-     */
-    if (r->args) {
-        return 0;
-    }
-    /*
      * RFC2616 (9.1.2): GET, HEAD, PUT, DELETE, OPTIONS, TRACE are considered
      * idempotent. Hint: HEAD requests use M_GET as method number as well.
      */
@@ -108,10 +105,18 @@
         case M_PUT:
         case M_OPTIONS:
         case M_TRACE:
-            return 1;
+            /*
+             * If the request has arguments it might have side-effects and thus
+             * it might be undesirable to resent it to a backend again
+             * automatically.
+             */
+            if (r->args) {
+                return METHOD_IDEMPOTENT_WITH_ARGS;
+            }
+            return METHOD_IDEMPOTENT;
         /* Everything else is not considered idempotent. */
         default:
-            return 0;
+            return METHOD_NON_IDEMPOTENT;
     }
 }
 
@@ -193,7 +198,7 @@
              * case we can dare to retry it with a different worker if we are
              * a balancer member.
              */
-            if (is_idempotent(r)) {
+            if (is_idempotent(r) == METHOD_IDEMPOTENT) {
                 return HTTP_SERVICE_UNAVAILABLE;
             }
             return HTTP_INTERNAL_SERVER_ERROR;
@@ -294,7 +299,7 @@
          * again) and the method is idempotent. In this case we can dare to
          * retry it with a different worker if we are a balancer member.
          */
-        if ((bufsiz == 0) && is_idempotent(r)) {
+        if ((bufsiz == 0) && (is_idempotent(r) == METHOD_IDEMPOTENT)) {
             return HTTP_SERVICE_UNAVAILABLE;
         }
         return HTTP_INTERNAL_SERVER_ERROR;



Mime
View raw message