httpd-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From j..@apache.org
Subject svn commit: r986699 - in /httpd/httpd/trunk: include/ap_mmn.h include/httpd.h modules/proxy/mod_proxy_http.c server/util.c
Date Wed, 18 Aug 2010 14:30:51 GMT
Author: jim
Date: Wed Aug 18 14:30:50 2010
New Revision: 986699

URL: http://svn.apache.org/viewvc?rev=986699&view=rev
Log:
Pull out "does request have a body" logic to a central
canon function and use that for the 100-Continue OK
check.

Should likely also start using this in the various
other places we do this "have body" check thruout
the codebase...

Modified:
    httpd/httpd/trunk/include/ap_mmn.h
    httpd/httpd/trunk/include/httpd.h
    httpd/httpd/trunk/modules/proxy/mod_proxy_http.c
    httpd/httpd/trunk/server/util.c

Modified: httpd/httpd/trunk/include/ap_mmn.h
URL: http://svn.apache.org/viewvc/httpd/httpd/trunk/include/ap_mmn.h?rev=986699&r1=986698&r2=986699&view=diff
==============================================================================
--- httpd/httpd/trunk/include/ap_mmn.h (original)
+++ httpd/httpd/trunk/include/ap_mmn.h Wed Aug 18 14:30:50 2010
@@ -243,6 +243,7 @@
  * 20100723.0 (2.3.7-dev)  Remove ct_output_filters from core rec
  * 20100723.1 (2.3.7-dev)  Added ap_proxy_hashfunc() and hash elements to
  *                         proxy worker structs
+ * 20100723.2 (2.3.7-dev)  Add ap_request_has_body()
  */
 
 #define MODULE_MAGIC_COOKIE 0x41503234UL /* "AP24" */
@@ -250,7 +251,7 @@
 #ifndef MODULE_MAGIC_NUMBER_MAJOR
 #define MODULE_MAGIC_NUMBER_MAJOR 20100723
 #endif
-#define MODULE_MAGIC_NUMBER_MINOR 1                     /* 0...n */
+#define MODULE_MAGIC_NUMBER_MINOR 2                     /* 0...n */
 
 /**
  * Determine if the server's current MODULE_MAGIC_NUMBER is at least a

Modified: httpd/httpd/trunk/include/httpd.h
URL: http://svn.apache.org/viewvc/httpd/httpd/trunk/include/httpd.h?rev=986699&r1=986698&r2=986699&view=diff
==============================================================================
--- httpd/httpd/trunk/include/httpd.h (original)
+++ httpd/httpd/trunk/include/httpd.h Wed Aug 18 14:30:50 2010
@@ -1806,6 +1806,14 @@ AP_DECLARE(apr_status_t) ap_timeout_para
                                                apr_interval_time_t *timeout,
                                                const char *default_time_unit);
 
+/**
+ * Determine if a request has a request body or not.
+ *
+ * @param r the request_rec of the request
+ * @return truth value
+ */
+AP_DECLARE(int) ap_request_has_body(request_rec *r);
+    
 /* Misc system hackery */
 /**
  * Given the name of an object in the file system determine if it is a directory

Modified: httpd/httpd/trunk/modules/proxy/mod_proxy_http.c
URL: http://svn.apache.org/viewvc/httpd/httpd/trunk/modules/proxy/mod_proxy_http.c?rev=986699&r1=986698&r2=986699&view=diff
==============================================================================
--- httpd/httpd/trunk/modules/proxy/mod_proxy_http.c (original)
+++ httpd/httpd/trunk/modules/proxy/mod_proxy_http.c Wed Aug 18 14:30:50 2010
@@ -696,7 +696,7 @@ int ap_proxy_http_request(apr_pool_t *p,
     proxy_dir_conf *dconf;
     conn_rec *origin = p_conn->connection;
     int do_100_continue;
-
+    
     dconf = ap_get_module_config(r->per_dir_config, &proxy_module);
     header_brigade = apr_brigade_create(p, origin->bucket_alloc);
 
@@ -709,10 +709,7 @@ int ap_proxy_http_request(apr_pool_t *p,
      * We also make sure we won't be talking HTTP/1.0 as well.
      */
     do_100_continue = (worker->ping_timeout_set
-                       && !r->header_only
-                       && (r->kept_body
-                          || apr_table_get(r->headers_in, "Content-Length")
-                          || apr_table_get(r->headers_in, "Transfer-Encoding"))
+                       && ap_request_has_body(r)
                        && (PROXYREQ_REVERSE == r->proxyreq)
                        && !(apr_table_get(r->subprocess_env, "force-proxy-request-1.0")));
     
@@ -1403,10 +1400,7 @@ apr_status_t ap_proxy_http_process_respo
     int do_100_continue;
     
     do_100_continue = (worker->ping_timeout_set
-                       && !r->header_only
-                       && (r->kept_body
-                          || apr_table_get(r->headers_in, "Content-Length")
-                          || apr_table_get(r->headers_in, "Transfer-Encoding"))
+                       && ap_request_has_body(r)
                        && (PROXYREQ_REVERSE == r->proxyreq)
                        && !(apr_table_get(r->subprocess_env, "force-proxy-request-1.0")));
     

Modified: httpd/httpd/trunk/server/util.c
URL: http://svn.apache.org/viewvc/httpd/httpd/trunk/server/util.c?rev=986699&r1=986698&r2=986699&view=diff
==============================================================================
--- httpd/httpd/trunk/server/util.c (original)
+++ httpd/httpd/trunk/server/util.c Wed Aug 18 14:30:50 2010
@@ -2221,3 +2221,27 @@ AP_DECLARE(apr_status_t) ap_timeout_para
     return APR_SUCCESS;
 }
 
+/**
+ * Determine if a request has a request body or not.
+ *
+ * @param r the request_rec of the request
+ * @return truth value
+ */
+AP_DECLARE(int) ap_request_has_body(request_rec *r)
+{
+    apr_off_t cl;
+    char *estr;
+    const char *cls;
+    int has_body;
+            
+    has_body = (!r->header_only
+                && (r->kept_body
+                    || apr_table_get(r->headers_in, "Transfer-Encoding")
+                    || ( (cls = apr_table_get(r->headers_in, "Content-Length"))
+                        && (apr_strtoff(&cl, cls, &estr, 10) == APR_SUCCESS)
+                        && (!*estr)
+                        && (cl > 0) )
+                    )
+                );
+    return has_body;
+}



Mime
View raw message