add CURLINFO_RETRY_AFTER
[m6w6/ext-http] / src / php_http_client_curl.c
index aa79d2947f37683c79f07f1b54ffd63dbe99091a..82db05332944a140b01dc2e54af6d5fce296915c 100644 (file)
@@ -330,6 +330,7 @@ static ZEND_RESULT_CODE php_http_curle_get_info(CURL *ch, HashTable *info)
        char *c = NULL;
        long l = 0;
        double d = 0;
        char *c = NULL;
        long l = 0;
        double d = 0;
+       curl_off_t o = 0;
        struct curl_slist *s = NULL, *p = NULL;
        zval tmp;
 
        struct curl_slist *s = NULL, *p = NULL;
        zval tmp;
 
@@ -510,6 +511,12 @@ static ZEND_RESULT_CODE php_http_curle_get_info(CURL *ch, HashTable *info)
                zend_hash_str_update(info, "scheme", lenof("scheme"), &tmp);
        }
 #endif
                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));
 #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));
@@ -1306,6 +1313,11 @@ static void php_http_curle_options_init(php_http_options_t *registry)
        */
        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);
        */
        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);
 
        /* outgoing interface */
        php_http_option_register(registry, ZEND_STRL("interface"), CURLOPT_INTERFACE, IS_STRING);