This is a preliminary diff against 7.37.1 just to open discussion.
The point of this change is to give control to the library user as
to which HTTP methods may participate in pipelining rather than
assuming that GET is always and only compatible. With this multi
option enabled, any request given to the multi handle is presumed
safe. Other multi handles are unaffected and default behavior is
unchanged from previous releases.
Real diff will include doc and unit test changes.
m
--
Monty Brandenberg, Software Engineer MCB, Inc.
[email protected] P.O. Box 425292
[email protected] Cambridge, MA 02142-0006
617.864.6907
diff -x curlbuild.h -x Makefile -r -U5 curl-7.37.1.orig/include/curl/multi.h
curl-7.37.1/include/curl/multi.h
--- curl-7.37.1.orig/include/curl/multi.h 2014-06-11 17:52:29.000000000
+0000
+++ curl-7.37.1/include/curl/multi.h 2014-08-08 18:39:24.000000000 +0000
@@ -363,10 +363,13 @@
CINIT(PIPELINING_SERVER_BL, OBJECTPOINT, 12),
/* maximum number of open connections in total */
CINIT(MAX_TOTAL_CONNECTIONS, LONG, 13),
+ /* boolean that enables pipelining operations for any HTTP method */
+ CINIT(PIPELINING_HTTP_METHOD_ANY, LONG, 14),
+
CURLMOPT_LASTENTRY /* the last unused */
} CURLMoption;
/*
diff -x curlbuild.h -x Makefile -r -U5 curl-7.37.1.orig/lib/multi.c
curl-7.37.1/lib/multi.c
--- curl-7.37.1.orig/lib/multi.c 2014-07-02 21:54:52.000000000 +0000
+++ curl-7.37.1/lib/multi.c 2014-08-08 18:39:23.000000000 +0000
@@ -2360,10 +2360,13 @@
&multi->pipelining_server_bl);
break;
case CURLMOPT_MAX_TOTAL_CONNECTIONS:
multi->max_total_connections = va_arg(param, long);
break;
+ case CURLMOPT_PIPELINING_HTTP_METHOD_ANY:
+ multi->pipelining_http_method_any = (0 != va_arg(param, long)) ? TRUE :
FALSE;
+ break;
default:
res = CURLM_UNKNOWN_OPTION;
break;
}
va_end(param);
@@ -2704,10 +2707,15 @@
struct curl_llist *Curl_multi_pipelining_server_bl(struct Curl_multi *multi)
{
return multi->pipelining_server_bl;
}
+bool Curl_multi_pipelining_http_method_any(const struct Curl_multi* multi)
+{
+ return (multi && multi->pipelining_http_method_any) ? TRUE : FALSE;
+}
+
void Curl_multi_process_pending_handles(struct Curl_multi *multi)
{
struct SessionHandle *data;
data=multi->easyp;
diff -x curlbuild.h -x Makefile -r -U5 curl-7.37.1.orig/lib/multihandle.h
curl-7.37.1/lib/multihandle.h
--- curl-7.37.1.orig/lib/multihandle.h 2014-06-11 17:52:29.000000000 +0000
+++ curl-7.37.1/lib/multihandle.h 2014-08-08 18:39:23.000000000 +0000
@@ -126,10 +126,13 @@
from pipelining */
struct curl_llist *pipelining_server_bl; /* List of server types that are
blacklisted from pipelining */
+ bool pipelining_http_method_any; /* Any HTTP method is a candidate for
+ pipelined requests */
+
/* timer callback and user data pointer for the *socket() API */
curl_multi_timer_callback timer_cb;
void *timer_userp;
struct timeval timer_lastcall; /* the fixed time for the timeout for the
previous callback */
diff -x curlbuild.h -x Makefile -r -U5 curl-7.37.1.orig/lib/multiif.h
curl-7.37.1/lib/multiif.h
--- curl-7.37.1.orig/lib/multiif.h 2014-06-11 17:52:29.000000000 +0000
+++ curl-7.37.1/lib/multiif.h 2014-08-08 18:39:23.000000000 +0000
@@ -79,10 +79,13 @@
struct curl_llist *Curl_multi_pipelining_server_bl(struct Curl_multi *multi);
/* Return the value of the CURLMOPT_MAX_TOTAL_CONNECTIONS option */
size_t Curl_multi_max_total_connections(struct Curl_multi *multi);
+/* Return true if the multi handle is to pipeline any HTTP method */
+bool Curl_multi_pipelining_http_method_any(const struct Curl_multi* multi);
+
/*
* Curl_multi_closed()
*
* Used by the connect code to tell the multi_socket code that one of the
* sockets we were using have just been closed. This function will then
diff -x curlbuild.h -x Makefile -r -U5 curl-7.37.1.orig/lib/url.c
curl-7.37.1/lib/url.c
--- curl-7.37.1.orig/lib/url.c 2014-07-15 21:49:55.000000000 +0000
+++ curl-7.37.1/lib/url.c 2014-08-08 18:39:23.000000000 +0000
@@ -2712,11 +2712,12 @@
const struct connectdata *conn)
{
if((conn->handler->protocol & PROTO_FAMILY_HTTP) &&
Curl_multi_pipeline_enabled(handle->multi) &&
(handle->set.httpreq == HTTPREQ_GET ||
- handle->set.httpreq == HTTPREQ_HEAD) &&
+ handle->set.httpreq == HTTPREQ_HEAD ||
+ Curl_multi_pipelining_http_method_any(handle->multi)) &&
handle->set.httpversion != CURL_HTTP_VERSION_1_0)
return TRUE;
return FALSE;
}
-------------------------------------------------------------------
List admin: http://cool.haxx.se/list/listinfo/curl-library
Etiquette: http://curl.haxx.se/mail/etiquette.html