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...
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@986699
13f79535-47bb-0310-9956-
ffa450edef68
* 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" */
#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
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
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);
* 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")));
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")));
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;
+}