char *c = NULL;
long l = 0;
double d = 0;
+ curl_off_t o = 0;
struct curl_slist *s = NULL, *p = NULL;
zval tmp;
zend_hash_str_update(info, "scheme", lenof("scheme"), &tmp);
}
#endif
+#if PHP_HTTP_CURL_VERSION(7,66,0)
+ if (CURLE_OK == curl_easy_getinfo(ch, CURLINFO_RETRY_AFTER, &o)) {
+ ZVAL_LONG(&tmp, o);
+ zend_hash_str_update(info, "retry_after", lenof("retry_after"), &tmp);
+ }
+#endif
#if PHP_HTTP_CURL_VERSION(7,72,0)
if (CURLE_OK == curl_easy_getinfo(ch, CURLINFO_EFFECTIVE_METHOD, &c)) {
ZVAL_STRING(&tmp, STR_PTR(c));
return SUCCESS;
}
+#if PHP_HTTP_CURL_VERSION(7,64,1)
+static ZEND_RESULT_CODE php_http_curle_option_set_altsvc_ctrl(php_http_option_t *opt, zval *val, void *userdata)
+{
+ php_http_client_curl_handler_t *curl = userdata;
+ CURL *ch = curl->handle;
+
+ if (Z_LVAL_P(val)) {
+ if (CURLE_OK != curl_easy_setopt(ch, CURLOPT_ALTSVC_CTRL, Z_LVAL_P(val))) {
+ return FAILURE;
+ }
+ }
+ return SUCCESS;
+}
+#endif
+
static ZEND_RESULT_CODE php_http_curle_option_set_compress(php_http_option_t *opt, zval *val, void *userdata)
{
php_http_client_curl_handler_t *curl = userdata;
*/
php_http_option_register(registry, ZEND_STRL("fresh_connect"), CURLOPT_FRESH_CONNECT, _IS_BOOL);
php_http_option_register(registry, ZEND_STRL("forbid_reuse"), CURLOPT_FORBID_REUSE, _IS_BOOL);
+#if PHP_HTTP_CURL_VERSION(7,65,0)
+ if ((opt = php_http_option_register(registry, ZEND_STRL("maxage_conn"), CURLOPT_MAXAGE_CONN, IS_LONG))) {
+ ZVAL_LONG(&opt->defval, 118);
+ }
+#endif
/* outgoing interface */
php_http_option_register(registry, ZEND_STRL("interface"), CURLOPT_INTERFACE, IS_STRING);
/* http protocol version */
php_http_option_register(registry, ZEND_STRL("protocol"), CURLOPT_HTTP_VERSION, IS_LONG);
+#if PHP_HTTP_CURL_VERSION(7,64,0)
+ php_http_option_register(registry, ZEND_STRL("http09_allowed"), CURLOPT_HTTP09_ALLOWED, _IS_BOOL);
+#endif
/* timeouts */
if ((opt = php_http_option_register(registry, ZEND_STRL("timeout"), CURLOPT_TIMEOUT_MS, IS_DOUBLE))) {
# endif
}
#endif
+ }
+#if PHP_HTTP_CURL_VERSION(7,64,1)
+ if ((opt = php_http_option_register(registry, ZEND_STRL("altsvc_ctrl"), CURLOPT_ALTSVC_CTRL, IS_LONG))) {
+ opt->setter = php_http_curle_option_set_altsvc_ctrl;
}
+ if ((opt = php_http_option_register(registry, ZEND_STRL("altsvc"), CURLOPT_ALTSVC, IS_STRING))) {
+ opt->flags |= PHP_HTTP_CURLE_OPTION_CHECK_BASEDIR;
+ }
+#endif
}
static zval *php_http_curle_get_option(php_http_option_t *opt, HashTable *options, void *userdata)
return rv;
}
-#if PHP_HTTP_CURL_VERSION(7,30,0)
+#if PHP_HTTP_CURL_VERSION(7,30,0) && !PHP_HTTP_CURL_VERSION(7,62,0)
static ZEND_RESULT_CODE php_http_curlm_option_set_pipelining_bl(php_http_option_t *opt, zval *value, void *userdata)
{
php_http_client_t *client = userdata;
/* set max number of connections to a single host */
#if PHP_HTTP_CURL_VERSION(7,30,0)
php_http_option_register(registry, ZEND_STRL("max_host_connections"), CURLMOPT_MAX_HOST_CONNECTIONS, IS_LONG);
-#endif
- /* maximum number of requests in a pipeline */
-#if PHP_HTTP_CURL_VERSION(7,30,0)
- if ((opt = php_http_option_register(registry, ZEND_STRL("max_pipeline_length"), CURLMOPT_MAX_PIPELINE_LENGTH, IS_LONG))) {
- ZVAL_LONG(&opt->defval, 5);
- }
#endif
/* max simultaneously open connections */
#if PHP_HTTP_CURL_VERSION(7,30,0)
php_http_option_register(registry, ZEND_STRL("max_total_connections"), CURLMOPT_MAX_TOTAL_CONNECTIONS, IS_LONG);
#endif
+#if !PHP_HTTP_CURL_VERSION(7,62,0)
/* enable/disable HTTP pipelining */
php_http_option_register(registry, ZEND_STRL("pipelining"), CURLMOPT_PIPELINING, _IS_BOOL);
+# if PHP_HTTP_CURL_VERSION(7,30,0)
+ /* maximum number of requests in a pipeline */
+ if ((opt = php_http_option_register(registry, ZEND_STRL("max_pipeline_length"), CURLMOPT_MAX_PIPELINE_LENGTH, IS_LONG))) {
+ ZVAL_LONG(&opt->defval, 5);
+ }
/* chunk length threshold for pipelining */
-#if PHP_HTTP_CURL_VERSION(7,30,0)
php_http_option_register(registry, ZEND_STRL("chunk_length_penalty_size"), CURLMOPT_CHUNK_LENGTH_PENALTY_SIZE, IS_LONG);
-#endif
/* size threshold for pipelining penalty */
-#if PHP_HTTP_CURL_VERSION(7,30,0)
php_http_option_register(registry, ZEND_STRL("content_length_penalty_size"), CURLMOPT_CONTENT_LENGTH_PENALTY_SIZE, IS_LONG);
-#endif
/* pipelining server blacklist */
-#if PHP_HTTP_CURL_VERSION(7,30,0)
if ((opt = php_http_option_register(registry, ZEND_STRL("pipelining_server_bl"), CURLMOPT_PIPELINING_SERVER_BL, IS_ARRAY))) {
opt->setter = php_http_curlm_option_set_pipelining_bl;
}
-#endif
/* pipelining host blacklist */
-#if PHP_HTTP_CURL_VERSION(7,30,0)
if ((opt = php_http_option_register(registry, ZEND_STRL("pipelining_site_bl"), CURLMOPT_PIPELINING_SITE_BL, IS_ARRAY))) {
opt->setter = php_http_curlm_option_set_pipelining_bl;
}
+# endif
#endif
/* events */
if ((opt = php_http_option_register(registry, ZEND_STRL("use_eventloop"), 0, 0))) {
case PHP_HTTP_CLIENT_OPT_CONFIGURATION:
return php_http_options_apply(&php_http_curlm_options, (HashTable *) arg, h);
break;
-
+#if !PHP_HTTP_CURL_VERSION(7,62,0)
case PHP_HTTP_CLIENT_OPT_ENABLE_PIPELINING:
if (CURLM_OK != curl_multi_setopt(curl->handle->multi, CURLMOPT_PIPELINING, (long) *((zend_bool *) arg))) {
return FAILURE;
}
break;
-
+#endif
case PHP_HTTP_CLIENT_OPT_USE_EVENTS:
#if PHP_HTTP_HAVE_LIBEVENT
return php_http_curlm_use_eventloop(h, (*(zend_bool *) arg)
REGISTER_NS_LONG_CONSTANT("http\\Client\\Curl", "POSTREDIR_ALL", CURL_REDIR_POST_ALL, CONST_CS|CONST_PERSISTENT);
#endif
+#if PHP_HTTP_CURL_VERSION(7,64,1)
+ REGISTER_NS_LONG_CONSTANT("http\\Client\\Curl", "ALTSVC_READONLYFILE", CURLALTSVC_READONLYFILE, CONST_CS|CONST_PERSISTENT);
+ REGISTER_NS_LONG_CONSTANT("http\\Client\\Curl", "ALTSVC_H1", CURLALTSVC_H1, CONST_CS|CONST_PERSISTENT);
+ REGISTER_NS_LONG_CONSTANT("http\\Client\\Curl", "ALTSVC_H2", CURLALTSVC_H2, CONST_CS|CONST_PERSISTENT);
+ REGISTER_NS_LONG_CONSTANT("http\\Client\\Curl", "ALTSVC_H3", CURLALTSVC_H3, CONST_CS|CONST_PERSISTENT);
+#endif
return SUCCESS;
}