if ((zoption = get_option(&curl->options.cache, options, ZEND_STRS("connecttimeout"), IS_DOUBLE))) {
curl_easy_setopt(ch, CURLOPT_CONNECTTIMEOUT_MS, (long)(Z_DVAL_P(zoption)*1000));
}
+
+#if PHP_HTTP_CURL_VERSION(7,25,0)
+ /* tcp */
+ if ((zoption = get_option(&curl->options.cache, options, ZEND_STRS("tcp_keepalive"), IS_BOOL))) {
+ curl_easy_setopt(ch, CURLOPT_TCP_KEEPALIVE, (long)Z_BVAL_P(zoption));
+ }
+ if ((zoption = get_option(&curl->options.cache, options, ZEND_STRS("tcp_keepidle"), IS_LONG))) {
+ curl_easy_setopt(ch, CURLOPT_TCP_KEEPIDLE, Z_LVAL_P(zoption));
+ }
+ if ((zoption = get_option(&curl->options.cache, options, ZEND_STRS("tcp_keepintvl"), IS_LONG))) {
+ curl_easy_setopt(ch, CURLOPT_TCP_KEEPINTVL, Z_LVAL_P(zoption));
+ }
+#endif
/* ssl */
if ((zoption = get_option(&curl->options.cache, options, ZEND_STRS("ssl"), IS_ARRAY))) {
curl_easy_setopt(ch, CURLOPT_TIMECONDITION, 0L);
curl_easy_setopt(ch, CURLOPT_TIMEVALUE, 0L);
curl_easy_setopt(ch, CURLOPT_TIMEOUT, 0L);
- curl_easy_setopt(ch, CURLOPT_CONNECTTIMEOUT, 3);
+ curl_easy_setopt(ch, CURLOPT_CONNECTTIMEOUT, 3L);
+#if PHP_HTTP_CURL_VERSION(7,25,0)
+ curl_easy_setopt(ch, CURLOPT_TCP_KEEPALIVE, 0L);
+ curl_easy_setopt(ch, CURLOPT_TCP_KEEPIDLE, 60L);
+ curl_easy_setopt(ch, CURLOPT_TCP_KEEPINTVL, 60L);
+#endif
curl_easy_setopt(ch, CURLOPT_SSLCERT, NULL);
curl_easy_setopt(ch, CURLOPT_SSLCERTTYPE, NULL);
curl_easy_setopt(ch, CURLOPT_SSLCERTPASSWD, NULL);
o = ecalloc(1, sizeof(php_http_client_object_t));
zend_object_std_init((zend_object *) o, ce TSRMLS_CC);
-#if PHP_VERSION_ID < 50339
- zend_hash_copy(((zend_object *) o)->properties, &(ce->default_properties), (copy_ctor_func_t) zval_add_ref, NULL, sizeof(zval*));
-#else
object_properties_init((zend_object *) o, ce);
-#endif
if (!(o->client = r)) {
o->client = php_http_client_init(NULL, &php_http_curl_client_ops, NULL, NULL TSRMLS_CC);