]> granicus.if.org Git - php/commitdiff
Expose some of the new curl constants to PHP userspace
authorPierrick Charron <pierrick@webstart.fr>
Wed, 27 Apr 2016 22:43:41 +0000 (18:43 -0400)
committerAnatol Belski <ab@php.net>
Fri, 29 Apr 2016 12:19:55 +0000 (14:19 +0200)
ext/curl/interface.c
ext/curl/multi.c

index f29a11a3fd4319578afe28c4774a263395070458..6a616411ef6c382e9a89dc651cd697771140362a 100644 (file)
@@ -567,6 +567,13 @@ PHP_MINFO_FUNCTION(curl)
 #endif
 #if LIBCURL_VERSION_NUM >= 0x072600 /* 7.38.0 */
                        {"GSSAPI", CURL_VERSION_GSSAPI},
+#endif
+#if LIBCURL_VERSION_NUM >= 0x072800 /* 7.40.0 */
+                       {"KERBEROS5", CURL_VERSION_KERBEROS5},
+                       {"UNIX_SOCKETS", CURL_VERSION_UNIX_SOCKETS},
+#endif
+#if LIBCURL_VERSION_NUM >= 0x072f00 /* 7.47.0 */
+                       {"PSL", CURL_VERSION_PSL},
 #endif
                        {NULL, 0}
                };
@@ -719,9 +726,6 @@ PHP_MINIT_FUNCTION(curl)
        REGISTER_CURL_CONSTANT(CURLOPT_SSL_CIPHER_LIST);
        REGISTER_CURL_CONSTANT(CURLOPT_SSL_VERIFYHOST);
        REGISTER_CURL_CONSTANT(CURLOPT_SSL_VERIFYPEER);
-#if LIBCURL_VERSION_NUM >= 0x072900 /* 7.41.0 */
-       REGISTER_CURL_CONSTANT(CURLOPT_SSL_VERIFYSTATUS);
-#endif 
        REGISTER_CURL_CONSTANT(CURLOPT_STDERR);
        REGISTER_CURL_CONSTANT(CURLOPT_TELNETOPTIONS);
        REGISTER_CURL_CONSTANT(CURLOPT_TIMECONDITION);
@@ -850,11 +854,6 @@ PHP_MINIT_FUNCTION(curl)
        REGISTER_CURL_CONSTANT(CURLPROXY_SOCKS4);
        REGISTER_CURL_CONSTANT(CURLPROXY_SOCKS5);
 
-#if LIBCURL_VERSION_NUM >= 0x071200 /* Available since 7.18.0 */
-       REGISTER_CURL_CONSTANT(CURLPROXY_SOCKS4A);
-       REGISTER_CURL_CONSTANT(CURLPROXY_SOCKS5_HOSTNAME);
-#endif
-
        /* Curl Share constants */
        REGISTER_CURL_CONSTANT(CURLSHOPT_NONE);
        REGISTER_CURL_CONSTANT(CURLSHOPT_SHARE);
@@ -863,9 +862,6 @@ PHP_MINIT_FUNCTION(curl)
        /* Curl Http Version constants (CURLOPT_HTTP_VERSION) */
        REGISTER_CURL_CONSTANT(CURL_HTTP_VERSION_1_0);
        REGISTER_CURL_CONSTANT(CURL_HTTP_VERSION_1_1);
-#if LIBCURL_VERSION_NUM >= 0x072100 /* 7.33.0 */
-       REGISTER_CURL_CONSTANT(CURL_HTTP_VERSION_2_0);
-#endif
        REGISTER_CURL_CONSTANT(CURL_HTTP_VERSION_NONE);
 
        /* Curl Lock constants */
@@ -895,9 +891,6 @@ PHP_MINIT_FUNCTION(curl)
        REGISTER_CURL_CONSTANT(CURL_VERSION_KERBEROS4);
        REGISTER_CURL_CONSTANT(CURL_VERSION_LIBZ);
        REGISTER_CURL_CONSTANT(CURL_VERSION_SSL);
-#if LIBCURL_VERSION_NUM >= 0x072100 /* 7.33.0 */
-       REGISTER_CURL_CONSTANT(CURL_VERSION_HTTP2);
-#endif
 
 #if LIBCURL_VERSION_NUM >= 0x070a06 /* Available since 7.10.6 */
        REGISTER_CURL_CONSTANT(CURLOPT_HTTPAUTH);
@@ -1060,6 +1053,9 @@ PHP_MINIT_FUNCTION(curl)
        REGISTER_CURL_CONSTANT(CURLPAUSE_SEND_CONT);
        REGISTER_CURL_CONSTANT(CURL_READFUNC_PAUSE);
        REGISTER_CURL_CONSTANT(CURL_WRITEFUNC_PAUSE);
+
+       REGISTER_CURL_CONSTANT(CURLPROXY_SOCKS4A);
+       REGISTER_CURL_CONSTANT(CURLPROXY_SOCKS5_HOSTNAME);
 #endif
 
 #if LIBCURL_VERSION_NUM >= 0x071202 /* Available since 7.18.2 */
@@ -1092,6 +1088,9 @@ PHP_MINIT_FUNCTION(curl)
        REGISTER_CURL_CONSTANT(CURLOPT_PROXYPASSWORD);
        REGISTER_CURL_CONSTANT(CURLOPT_PROXYUSERNAME);
        REGISTER_CURL_CONSTANT(CURLOPT_USERNAME);
+       REGISTER_CURL_CONSTANT(CURL_REDIR_POST_301);
+       REGISTER_CURL_CONSTANT(CURL_REDIR_POST_302);
+       REGISTER_CURL_CONSTANT(CURL_REDIR_POST_ALL);
 #endif
 
 #if LIBCURL_VERSION_NUM >= 0x071303 /* Available since 7.19.3 */
@@ -1121,6 +1120,12 @@ PHP_MINIT_FUNCTION(curl)
        REGISTER_CURL_CONSTANT(CURLPROTO_SFTP);
        REGISTER_CURL_CONSTANT(CURLPROTO_TELNET);
        REGISTER_CURL_CONSTANT(CURLPROTO_TFTP);
+
+       REGISTER_CURL_CONSTANT(CURLPROXY_HTTP_1_0);
+
+       REGISTER_CURL_CONSTANT(CURLFTP_CREATE_DIR);
+       REGISTER_CURL_CONSTANT(CURLFTP_CREATE_DIR_NONE);
+       REGISTER_CURL_CONSTANT(CURLFTP_CREATE_DIR_RETRY);
 #endif
 
 #if LIBCURL_VERSION_NUM >= 0x071306 /* Available since 7.19.6 */
@@ -1156,8 +1161,8 @@ PHP_MINIT_FUNCTION(curl)
        REGISTER_CURL_CONSTANT(CURL_RTSPREQ_PLAY);
        REGISTER_CURL_CONSTANT(CURL_RTSPREQ_RECEIVE);
        REGISTER_CURL_CONSTANT(CURL_RTSPREQ_RECORD);
-       REGISTER_CURL_CONSTANT(CURL_RTSPREQ_SETUP);
        REGISTER_CURL_CONSTANT(CURL_RTSPREQ_SET_PARAMETER);
+       REGISTER_CURL_CONSTANT(CURL_RTSPREQ_SETUP);
        REGISTER_CURL_CONSTANT(CURL_RTSPREQ_TEARDOWN);
 #endif
 
@@ -1200,6 +1205,7 @@ PHP_MINIT_FUNCTION(curl)
 #endif
 
 #if LIBCURL_VERSION_NUM >= 0x071600 /* Available since 7.22.0 */
+       REGISTER_CURL_CONSTANT(CURLAUTH_NTLM_WB);
        REGISTER_CURL_CONSTANT(CURLGSSAPI_DELEGATION_FLAG);
        REGISTER_CURL_CONSTANT(CURLGSSAPI_DELEGATION_POLICY_FLAG);
        REGISTER_CURL_CONSTANT(CURLOPT_GSSAPI_DELEGATION);
@@ -1219,18 +1225,119 @@ PHP_MINIT_FUNCTION(curl)
        REGISTER_CURL_CONSTANT(CURLSSLOPT_ALLOW_BEAST);
 #endif
 
+#if LIBCURL_VERSION_NUM >= 0x071901 /* Available since 7.25.1 */
+       REGISTER_CURL_CONSTANT(CURL_REDIR_POST_303);
+#endif
+
+#if LIBCURL_VERSION_NUM >= 0x071c00 /* Available since 7.28.0 */
+       REGISTER_CURL_CONSTANT(CURLSSH_AUTH_AGENT);
+#endif
+
+#if LIBCURL_VERSION_NUM >= 0x071e00 /* Available since 7.30.0 */
+       REGISTER_CURL_CONSTANT(CURLMOPT_CHUNK_LENGTH_PENALTY_SIZE);
+       REGISTER_CURL_CONSTANT(CURLMOPT_CONTENT_LENGTH_PENALTY_SIZE);
+       REGISTER_CURL_CONSTANT(CURLMOPT_MAX_HOST_CONNECTIONS);
+       REGISTER_CURL_CONSTANT(CURLMOPT_MAX_PIPELINE_LENGTH);
+       REGISTER_CURL_CONSTANT(CURLMOPT_MAX_TOTAL_CONNECTIONS);
+#endif
+
+#if LIBCURL_VERSION_NUM >= 0x071f00 /* Available since 7.31.0 */
+       REGISTER_CURL_CONSTANT(CURLOPT_SASL_IR);
+#endif
+
+#if LIBCURL_VERSION_NUM >= 0x072100 /* Available since 7.33.0 */
+       REGISTER_CURL_CONSTANT(CURLOPT_DNS_INTERFACE);
+       REGISTER_CURL_CONSTANT(CURLOPT_DNS_LOCAL_IP4);
+       REGISTER_CURL_CONSTANT(CURLOPT_DNS_LOCAL_IP6);
+       REGISTER_CURL_CONSTANT(CURLOPT_XOAUTH2_BEARER);
+
+       REGISTER_CURL_CONSTANT(CURL_HTTP_VERSION_2_0);
+       REGISTER_CURL_CONSTANT(CURL_VERSION_HTTP2);
+#endif
+
 #if LIBCURL_VERSION_NUM >= 0x072200 /* Available since 7.34.0 */
+       REGISTER_CURL_CONSTANT(CURLOPT_LOGIN_OPTIONS);
+
        REGISTER_CURL_CONSTANT(CURL_SSLVERSION_TLSv1_0);
        REGISTER_CURL_CONSTANT(CURL_SSLVERSION_TLSv1_1);
        REGISTER_CURL_CONSTANT(CURL_SSLVERSION_TLSv1_2);
 #endif
 
-#if LIBCURL_VERSION_NUM >= 0x072B00 /* Available since 7.43.0 */
+#if LIBCURL_VERSION_NUM >= 0x072400 /* Available since 7.36.0 */
+       REGISTER_CURL_CONSTANT(CURLOPT_EXPECT_100_TIMEOUT_MS);
+       REGISTER_CURL_CONSTANT(CURLOPT_SSL_ENABLE_ALPN);
+       REGISTER_CURL_CONSTANT(CURLOPT_SSL_ENABLE_NPN);
+#endif
+
+#if LIBCURL_VERSION_NUM >= 0x072500 /* Available since 7.37.0 */
+       REGISTER_CURL_CONSTANT(CURLHEADER_SEPARATE);
+       REGISTER_CURL_CONSTANT(CURLHEADER_UNIFIED);
+       REGISTER_CURL_CONSTANT(CURLOPT_HEADEROPT);
+       REGISTER_CURL_CONSTANT(CURLOPT_PROXYHEADER);
+#endif
+
+#if LIBCURL_VERSION_NUM >= 0x072600 /* Available since 7.38.0 */
+       REGISTER_CURL_CONSTANT(CURLAUTH_NEGOTIATE);
+#endif
+
+#if LIBCURL_VERSION_NUM >= 0x072700 /* Available since 7.39.0 */
+       REGISTER_CURL_CONSTANT(CURLOPT_PINNEDPUBLICKEY);
+#endif
+
+#if LIBCURL_VERSION_NUM >= 0x072800 /* Available since 7.40.0 */
+       REGISTER_CURL_CONSTANT(CURLOPT_UNIX_SOCKET_PATH);
+
+       REGISTER_CURL_CONSTANT(CURLPROTO_SMB);
+       REGISTER_CURL_CONSTANT(CURLPROTO_SMBS);
+#endif
+
+#if LIBCURL_VERSION_NUM >= 0x072900 /* Available since 7.41.0 */
+       REGISTER_CURL_CONSTANT(CURLOPT_SSL_VERIFYSTATUS);
+#endif
+
+#if LIBCURL_VERSION_NUM >= 0x072a00 /* Available since 7.42.0 */
+       REGISTER_CURL_CONSTANT(CURLOPT_PATH_AS_IS);
+       REGISTER_CURL_CONSTANT(CURLOPT_SSL_FALSESTART);
+#endif
+
+#if LIBCURL_VERSION_NUM >= 0x072b00 /* Available since 7.43.0 */
+       REGISTER_CURL_CONSTANT(CURL_HTTP_VERSION_2);
+
+       REGISTER_CURL_CONSTANT(CURLOPT_PIPEWAIT);
+       REGISTER_CURL_CONSTANT(CURLOPT_PROXY_SERVICE_NAME);
+       REGISTER_CURL_CONSTANT(CURLOPT_SERVICE_NAME);
+
        REGISTER_CURL_CONSTANT(CURLPIPE_NOTHING);
        REGISTER_CURL_CONSTANT(CURLPIPE_HTTP1);
        REGISTER_CURL_CONSTANT(CURLPIPE_MULTIPLEX);
 #endif
 
+#if LIBCURL_VERSION_NUM >= 0x072c00 /* Available since 7.44.0 */
+       REGISTER_CURL_CONSTANT(CURLSSLOPT_NO_REVOKE);
+#endif
+
+#if LIBCURL_VERSION_NUM >= 0x072d00 /* Available since 7.45.0 */
+       REGISTER_CURL_CONSTANT(CURLOPT_DEFAULT_PROTOCOL);
+#endif
+
+#if LIBCURL_VERSION_NUM >= 0x072e00 /* Available since 7.46.0 */
+       REGISTER_CURL_CONSTANT(CURLOPT_STREAM_WEIGHT);
+#endif
+
+#if LIBCURL_VERSION_NUM >= 0x072f00 /* Available since 7.47.0 */
+       REGISTER_CURL_CONSTANT(CURL_HTTP_VERSION_2TLS);
+#endif
+
+#if LIBCURL_VERSION_NUM >= 0x073000 /* Available since 7.48.0 */
+       REGISTER_CURL_CONSTANT(CURLOPT_TFTP_NO_OPTIONS);
+#endif
+
+#if LIBCURL_VERSION_NUM >= 0x073100 /* Available since 7.49.0 */
+       REGISTER_CURL_CONSTANT(CURL_HTTP_VERSION_2_PRIOR_KNOWLEDGE);
+       REGISTER_CURL_CONSTANT(CURLOPT_CONNECT_TO);
+       REGISTER_CURL_CONSTANT(CURLOPT_TCP_FASTOPEN);
+#endif
+
 #if CURLOPT_FTPASCII != 0
        REGISTER_CURL_CONSTANT(CURLOPT_FTPASCII);
 #endif
@@ -2075,9 +2182,6 @@ static int _php_curl_setopt(php_curl *ch, zend_long option, zval *zvalue) /* {{{
                case CURLOPT_RESUME_FROM:
                case CURLOPT_SSLVERSION:
                case CURLOPT_SSL_VERIFYPEER:
-#if LIBCURL_VERSION_NUM >= 0x072900 /* 7.41.0 */
-               case CURLOPT_SSL_VERIFYSTATUS:
-#endif 
                case CURLOPT_TIMECONDITION:
                case CURLOPT_TIMEOUT:
                case CURLOPT_TIMEVALUE:
@@ -2185,6 +2289,36 @@ static int _php_curl_setopt(php_curl *ch, zend_long option, zval *zvalue) /* {{{
                case CURLOPT_TCP_KEEPIDLE:
                case CURLOPT_TCP_KEEPINTVL:
 #endif
+#if LIBCURL_VERSION_NUM >= 0x071f00 /* Available since 7.31.0 */
+               case CURLOPT_SASL_IR:
+#endif
+#if LIBCURL_VERSION_NUM >= 0x072400 /* Available since 7.36.0 */
+               case CURLOPT_EXPECT_100_TIMEOUT_MS:
+               case CURLOPT_SSL_ENABLE_ALPN:
+               case CURLOPT_SSL_ENABLE_NPN:
+#endif
+#if LIBCURL_VERSION_NUM >= 0x072500 /* Available since 7.37.0 */
+               case CURLOPT_HEADEROPT:
+#endif
+#if LIBCURL_VERSION_NUM >= 0x072900 /* Available since 7.41.0 */
+               case CURLOPT_SSL_VERIFYSTATUS:
+#endif
+#if LIBCURL_VERSION_NUM >= 0x072a00 /* Available since 7.42.0 */
+               case CURLOPT_PATH_AS_IS:
+               case CURLOPT_SSL_FALSESTART:
+#endif
+#if LIBCURL_VERSION_NUM >= 0x072b00 /* Available since 7.43.0 */
+               case CURLOPT_PIPEWAIT:
+#endif
+#if LIBCURL_VERSION_NUM >= 0x072e00 /* Available since 7.46.0 */
+               case CURLOPT_STREAM_WEIGHT:
+#endif
+#if LIBCURL_VERSION_NUM >= 0x073000 /* Available since 7.48.0 */
+               case CURLOPT_TFTP_NO_OPTIONS:
+#endif
+#if LIBCURL_VERSION_NUM >= 0x073100 /* Available since 7.49.0 */
+               case CURLOPT_TCP_FASTOPEN:
+#endif
 #if CURLOPT_MUTE != 0
                case CURLOPT_MUTE:
 #endif
@@ -2269,6 +2403,19 @@ static int _php_curl_setopt(php_curl *ch, zend_long option, zval *zvalue) /* {{{
 #endif
 #if LIBCURL_VERSION_NUM >= 0x071900 /* Available since 7.25.0 */
                case CURLOPT_MAIL_AUTH:
+#endif
+#if LIBCURL_VERSION_NUM >= 0x072200 /* Available since 7.34.0 */
+               case CURLOPT_LOGIN_OPTIONS:
+#endif
+#if LIBCURL_VERSION_NUM >= 0x072700 /* Available since 7.39.0 */
+               case CURLOPT_PINNEDPUBLICKEY:
+#endif
+#if LIBCURL_VERSION_NUM >= 0x072b00 /* Available since 7.43.0 */
+               case CURLOPT_PROXY_SERVICE_NAME:
+               case CURLOPT_SERVICE_NAME:
+#endif
+#if LIBCURL_VERSION_NUM >= 0x072d00 /* Available since 7.45.0 */
+               case CURLOPT_DEFAULT_PROTOCOL:
 #endif
                {
                        zend_string *str = zval_get_string(zvalue);
@@ -2287,6 +2434,15 @@ static int _php_curl_setopt(php_curl *ch, zend_long option, zval *zvalue) /* {{{
 #if LIBCURL_VERSION_NUM >= 0x071400 /* Available since 7.20.0 */
                case CURLOPT_RTSP_SESSION_ID:
 #endif
+#if LIBCURL_VERSION_NUM >= 0x072100 /* Available since 7.33.0 */
+               case CURLOPT_DNS_INTERFACE:
+               case CURLOPT_DNS_LOCAL_IP4:
+               case CURLOPT_DNS_LOCAL_IP6:
+               case CURLOPT_XOAUTH2_BEARER:
+#endif
+#if LIBCURL_VERSION_NUM >= 0x072800 /* Available since 7.40.0 */
+               case CURLOPT_UNIX_SOCKET_PATH:
+#endif
 #if LIBCURL_VERSION_NUM >= 0x071004 /* Available since 7.16.4 */
                case CURLOPT_KRBLEVEL:
 #else
@@ -2431,6 +2587,12 @@ static int _php_curl_setopt(php_curl *ch, zend_long option, zval *zvalue) /* {{{
 #endif
 #if LIBCURL_VERSION_NUM >= 0x071503 /* Available since 7.21.3 */
                case CURLOPT_RESOLVE:
+#endif
+#if LIBCURL_VERSION_NUM >= 0x072500 /* Available since 7.37.0 */
+               case CURLOPT_PROXYHEADER:
+#endif
+#if LIBCURL_VERSION_NUM >= 0x073100 /* Available since 7.49.0 */
+               case CURLOPT_CONNECT_TO:
 #endif
                {
                        zval *current;
@@ -2469,6 +2631,16 @@ static int _php_curl_setopt(php_curl *ch, zend_long option, zval *zvalue) /* {{{
                                        case CURLOPT_RESOLVE:
                                                name = "CURLOPT_RESOLVE";
                                                break;
+#endif
+#if LIBCURL_VERSION_NUM >= 0x072500 /* Available since 7.37.0 */
+                                       case CURLOPT_PROXYHEADER:
+                                               name = "CURLOPT_PROXYHEADER";
+                                               break;
+#endif
+#if LIBCURL_VERSION_NUM >= 0x073100 /* Available since 7.49.0 */
+                                       case CURLOPT_CONNECT_TO:
+                                               name = "CURLOPT_CONNECT_TO";
+                                               break;
 #endif
                                }
                                php_error_docref(NULL, E_WARNING, "You must pass either an object or an array with the %s argument", name);
index 641d20f9037a4946985357ab62da6611cb0c33c3..ab6d56c4383c9142fce7fdad3ff6a459a81e92dd 100644 (file)
@@ -416,6 +416,13 @@ static int _php_curl_multi_setopt(php_curlm *mh, zend_long option, zval *zvalue,
 #endif
 #if LIBCURL_VERSION_NUM >= 0x071003 /* 7.16.3 */
                case CURLMOPT_MAXCONNECTS:
+#endif
+#if LIBCURL_VERSION_NUM >= 0x071e00 /* 7.30.0 */
+               case CURLMOPT_CHUNK_LENGTH_PENALTY_SIZE:
+               case CURLMOPT_CONTENT_LENGTH_PENALTY_SIZE:
+               case CURLMOPT_MAX_HOST_CONNECTIONS:
+               case CURLMOPT_MAX_PIPELINE_LENGTH:
+               case CURLMOPT_MAX_TOTAL_CONNECTIONS:
 #endif
                        error = curl_multi_setopt(mh->multi, option, zval_get_long(zvalue));
                        break;