@@ -118,20 +118,16 @@ static int php_curl_option_str(php_curl *ch, zend_long option, const char *str,
118
118
return FAILURE ;
119
119
}
120
120
121
- #if LIBCURL_VERSION_NUM >= 0x071100
122
121
if (make_copy ) {
123
- #endif
124
122
char * copystr ;
125
123
126
124
/* Strings passed to libcurl as 'char *' arguments, are copied by the library since 7.17.0 */
127
125
copystr = estrndup (str , len );
128
126
error = curl_easy_setopt (ch -> cp , option , copystr );
129
127
zend_llist_add_element (& ch -> to_free -> str , & copystr );
130
- #if LIBCURL_VERSION_NUM >= 0x071100
131
128
} else {
132
129
error = curl_easy_setopt (ch -> cp , option , str );
133
130
}
134
- #endif
135
131
136
132
SAVE_CURL_ERROR (ch , error );
137
133
@@ -544,64 +540,41 @@ PHP_MINIT_FUNCTION(curl)
544
540
545
541
/* */
546
542
REGISTER_CURL_CONSTANT (CURLE_ABORTED_BY_CALLBACK );
547
- REGISTER_CURL_CONSTANT (CURLE_BAD_CALLING_ORDER );
548
543
REGISTER_CURL_CONSTANT (CURLE_BAD_CONTENT_ENCODING );
549
544
REGISTER_CURL_CONSTANT (CURLE_BAD_DOWNLOAD_RESUME );
550
545
REGISTER_CURL_CONSTANT (CURLE_BAD_FUNCTION_ARGUMENT );
551
- REGISTER_CURL_CONSTANT (CURLE_BAD_PASSWORD_ENTERED );
552
546
REGISTER_CURL_CONSTANT (CURLE_COULDNT_CONNECT );
553
547
REGISTER_CURL_CONSTANT (CURLE_COULDNT_RESOLVE_HOST );
554
548
REGISTER_CURL_CONSTANT (CURLE_COULDNT_RESOLVE_PROXY );
555
549
REGISTER_CURL_CONSTANT (CURLE_FAILED_INIT );
556
550
REGISTER_CURL_CONSTANT (CURLE_FILE_COULDNT_READ_FILE );
557
- REGISTER_CURL_CONSTANT (CURLE_FTP_ACCESS_DENIED );
558
- REGISTER_CURL_CONSTANT (CURLE_FTP_BAD_DOWNLOAD_RESUME );
559
551
REGISTER_CURL_CONSTANT (CURLE_FTP_CANT_GET_HOST );
560
- REGISTER_CURL_CONSTANT (CURLE_FTP_CANT_RECONNECT );
561
- REGISTER_CURL_CONSTANT (CURLE_FTP_COULDNT_GET_SIZE );
562
552
REGISTER_CURL_CONSTANT (CURLE_FTP_COULDNT_RETR_FILE );
563
- REGISTER_CURL_CONSTANT (CURLE_FTP_COULDNT_SET_ASCII );
564
- REGISTER_CURL_CONSTANT (CURLE_FTP_COULDNT_SET_BINARY );
565
- REGISTER_CURL_CONSTANT (CURLE_FTP_COULDNT_STOR_FILE );
566
553
REGISTER_CURL_CONSTANT (CURLE_FTP_COULDNT_USE_REST );
567
- REGISTER_CURL_CONSTANT (CURLE_FTP_PARTIAL_FILE );
568
554
REGISTER_CURL_CONSTANT (CURLE_FTP_PORT_FAILED );
569
- REGISTER_CURL_CONSTANT (CURLE_FTP_QUOTE_ERROR );
570
- REGISTER_CURL_CONSTANT (CURLE_FTP_USER_PASSWORD_INCORRECT );
571
555
REGISTER_CURL_CONSTANT (CURLE_FTP_WEIRD_227_FORMAT );
572
556
REGISTER_CURL_CONSTANT (CURLE_FTP_WEIRD_PASS_REPLY );
573
557
REGISTER_CURL_CONSTANT (CURLE_FTP_WEIRD_PASV_REPLY );
574
558
REGISTER_CURL_CONSTANT (CURLE_FTP_WEIRD_SERVER_REPLY );
575
- REGISTER_CURL_CONSTANT (CURLE_FTP_WEIRD_USER_REPLY );
576
- REGISTER_CURL_CONSTANT (CURLE_FTP_WRITE_ERROR );
577
559
REGISTER_CURL_CONSTANT (CURLE_FUNCTION_NOT_FOUND );
578
560
REGISTER_CURL_CONSTANT (CURLE_GOT_NOTHING );
579
- REGISTER_CURL_CONSTANT (CURLE_HTTP_NOT_FOUND );
580
- REGISTER_CURL_CONSTANT (CURLE_HTTP_PORT_FAILED );
581
561
REGISTER_CURL_CONSTANT (CURLE_HTTP_POST_ERROR );
582
- REGISTER_CURL_CONSTANT (CURLE_HTTP_RANGE_ERROR );
583
562
REGISTER_CURL_CONSTANT (CURLE_HTTP_RETURNED_ERROR );
584
563
REGISTER_CURL_CONSTANT (CURLE_LDAP_CANNOT_BIND );
585
564
REGISTER_CURL_CONSTANT (CURLE_LDAP_SEARCH_FAILED );
586
- REGISTER_CURL_CONSTANT (CURLE_LIBRARY_NOT_FOUND );
587
- REGISTER_CURL_CONSTANT (CURLE_MALFORMAT_USER );
588
- REGISTER_CURL_CONSTANT (CURLE_OBSOLETE );
589
565
REGISTER_CURL_CONSTANT (CURLE_OK );
590
566
REGISTER_CURL_CONSTANT (CURLE_OPERATION_TIMEDOUT );
591
- REGISTER_CURL_CONSTANT (CURLE_OPERATION_TIMEOUTED );
592
567
REGISTER_CURL_CONSTANT (CURLE_OUT_OF_MEMORY );
593
568
REGISTER_CURL_CONSTANT (CURLE_PARTIAL_FILE );
594
569
REGISTER_CURL_CONSTANT (CURLE_READ_ERROR );
595
570
REGISTER_CURL_CONSTANT (CURLE_RECV_ERROR );
596
571
REGISTER_CURL_CONSTANT (CURLE_SEND_ERROR );
597
- REGISTER_CURL_CONSTANT (CURLE_SHARE_IN_USE );
598
572
REGISTER_CURL_CONSTANT (CURLE_SSL_CACERT );
599
573
REGISTER_CURL_CONSTANT (CURLE_SSL_CERTPROBLEM );
600
574
REGISTER_CURL_CONSTANT (CURLE_SSL_CIPHER );
601
575
REGISTER_CURL_CONSTANT (CURLE_SSL_CONNECT_ERROR );
602
576
REGISTER_CURL_CONSTANT (CURLE_SSL_ENGINE_NOTFOUND );
603
577
REGISTER_CURL_CONSTANT (CURLE_SSL_ENGINE_SETFAILED );
604
- REGISTER_CURL_CONSTANT (CURLE_SSL_PEER_CERTIFICATE );
605
578
#if LIBCURL_VERSION_NUM >= 0x072700 /* Available since 7.39.0 */
606
579
REGISTER_CURL_CONSTANT (CURLE_SSL_PINNEDPUBKEYNOTMATCH );
607
580
#endif
@@ -610,7 +583,6 @@ PHP_MINIT_FUNCTION(curl)
610
583
REGISTER_CURL_CONSTANT (CURLE_UNKNOWN_TELNET_OPTION );
611
584
REGISTER_CURL_CONSTANT (CURLE_UNSUPPORTED_PROTOCOL );
612
585
REGISTER_CURL_CONSTANT (CURLE_URL_MALFORMAT );
613
- REGISTER_CURL_CONSTANT (CURLE_URL_MALFORMAT_USER );
614
586
REGISTER_CURL_CONSTANT (CURLE_WRITE_ERROR );
615
587
616
588
/* cURL info constants */
@@ -735,7 +707,7 @@ PHP_MINIT_FUNCTION(curl)
735
707
REGISTER_CURL_CONSTANT (CURL_IPRESOLVE_WHATEVER );
736
708
737
709
/* Available since 7.11.0 */
738
- REGISTER_CURL_CONSTANT (CURLE_FTP_SSL_FAILED );
710
+ REGISTER_CURL_CONSTANT (CURLE_USE_SSL_FAILED );
739
711
REGISTER_CURL_CONSTANT (CURLFTPSSL_ALL );
740
712
REGISTER_CURL_CONSTANT (CURLFTPSSL_CONTROL );
741
713
REGISTER_CURL_CONSTANT (CURLFTPSSL_NONE );
@@ -791,13 +763,12 @@ PHP_MINIT_FUNCTION(curl)
791
763
REGISTER_CURL_CONSTANT (CURLOPT_MAX_RECV_SPEED_LARGE );
792
764
REGISTER_CURL_CONSTANT (CURLOPT_MAX_SEND_SPEED_LARGE );
793
765
794
- #if LIBCURL_VERSION_NUM >= 0x071000 /* Available since 7.16.0 */
766
+ /* Available since 7.16.0 */
795
767
REGISTER_CURL_CONSTANT (CURLE_SSL_CACERT_BADFILE );
796
768
REGISTER_CURL_CONSTANT (CURLOPT_SSL_SESSIONID_CACHE );
797
769
REGISTER_CURL_CONSTANT (CURLMOPT_PIPELINING );
798
- #endif
799
770
800
- #if LIBCURL_VERSION_NUM >= 0x071001 /* Available since 7.16.1 */
771
+ /* Available since 7.16.1 */
801
772
REGISTER_CURL_CONSTANT (CURLE_SSH );
802
773
REGISTER_CURL_CONSTANT (CURLOPT_FTP_SSL_CCC );
803
774
REGISTER_CURL_CONSTANT (CURLOPT_SSH_AUTH_TYPES );
@@ -806,26 +777,22 @@ PHP_MINIT_FUNCTION(curl)
806
777
REGISTER_CURL_CONSTANT (CURLFTPSSL_CCC_ACTIVE );
807
778
REGISTER_CURL_CONSTANT (CURLFTPSSL_CCC_NONE );
808
779
REGISTER_CURL_CONSTANT (CURLFTPSSL_CCC_PASSIVE );
809
- #endif
810
780
811
- #if LIBCURL_VERSION_NUM >= 0x071002 /* Available since 7.16.2 */
781
+ /* Available since 7.16.2 */
812
782
REGISTER_CURL_CONSTANT (CURLOPT_CONNECTTIMEOUT_MS );
813
783
REGISTER_CURL_CONSTANT (CURLOPT_HTTP_CONTENT_DECODING );
814
784
REGISTER_CURL_CONSTANT (CURLOPT_HTTP_TRANSFER_DECODING );
815
785
REGISTER_CURL_CONSTANT (CURLOPT_TIMEOUT_MS );
816
- #endif
817
786
818
- #if LIBCURL_VERSION_NUM >= 0x071003 /* Available since 7.16.3 */
787
+ /* Available since 7.16.3 */
819
788
REGISTER_CURL_CONSTANT (CURLMOPT_MAXCONNECTS );
820
- #endif
821
789
822
- #if LIBCURL_VERSION_NUM >= 0x071004 /* Available since 7.16.4 */
790
+ /* Available since 7.16.4 */
823
791
REGISTER_CURL_CONSTANT (CURLOPT_KRBLEVEL );
824
792
REGISTER_CURL_CONSTANT (CURLOPT_NEW_DIRECTORY_PERMS );
825
793
REGISTER_CURL_CONSTANT (CURLOPT_NEW_FILE_PERMS );
826
- #endif
827
794
828
- #if LIBCURL_VERSION_NUM >= 0x071100 /* Available since 7.17.0 */
795
+ /* Available since 7.17.0 */
829
796
REGISTER_CURL_CONSTANT (CURLOPT_APPEND );
830
797
REGISTER_CURL_CONSTANT (CURLOPT_DIRLISTONLY );
831
798
REGISTER_CURL_CONSTANT (CURLOPT_USE_SSL );
@@ -834,11 +801,18 @@ PHP_MINIT_FUNCTION(curl)
834
801
REGISTER_CURL_CONSTANT (CURLUSESSL_CONTROL );
835
802
REGISTER_CURL_CONSTANT (CURLUSESSL_NONE );
836
803
REGISTER_CURL_CONSTANT (CURLUSESSL_TRY );
837
- #endif
838
804
839
- #if LIBCURL_VERSION_NUM >= 0x071101 /* Available since 7.17.1 */
805
+ REGISTER_CURL_CONSTANT (CURLE_REMOTE_ACCESS_DENIED );
806
+ REGISTER_CURL_CONSTANT (CURLE_FTP_COULDNT_SET_TYPE );
807
+ REGISTER_CURL_CONSTANT (CURLE_UPLOAD_FAILED );
808
+ REGISTER_CURL_CONSTANT (CURLE_QUOTE_ERROR );
809
+ REGISTER_CURL_CONSTANT (CURLE_INTERFACE_FAILED );
810
+ REGISTER_CURL_CONSTANT (CURLE_RANGE_ERROR );
811
+ REGISTER_CURL_CONSTANT (CURLE_NOT_BUILT_IN );
812
+
813
+ /* Available since 7.17.1 */
840
814
REGISTER_CURL_CONSTANT (CURLOPT_SSH_HOST_PUBLIC_KEY_MD5 );
841
- #endif
815
+ REGISTER_CURL_CONSTANT ( CURLE_PEER_FAILED_VERIFICATION );
842
816
843
817
#if LIBCURL_VERSION_NUM >= 0x071200 /* Available since 7.18.0 */
844
818
REGISTER_CURL_CONSTANT (CURLOPT_PROXY_TRANSFER_MODE );
@@ -1716,12 +1690,10 @@ PHP_FUNCTION(curl_version)
1716
1690
if (d -> age >= 2 ) {
1717
1691
CAAS ("libidn" , d -> libidn );
1718
1692
}
1719
- #if LIBCURL_VERSION_NUM >= 0x071001 /* Available since 7.16.1 */
1720
1693
if (d -> age >= 3 ) {
1721
1694
CAAL ("iconv_ver_num" , d -> iconv_ver_num );
1722
1695
CAAS ("libssh_version" , d -> libssh_version );
1723
1696
}
1724
- #endif
1725
1697
#if LIBCURL_VERSION_NUM >= 0x073900 /* Available since 7.57.0 */
1726
1698
if (d -> age >= 4 ) {
1727
1699
CAAL ("brotli_ver_num" , d -> brotli_ver_num );
@@ -2079,32 +2051,18 @@ static int _php_curl_setopt(php_curl *ch, zend_long option, zval *zvalue) /* {{{
2079
2051
case CURLOPT_CONNECT_ONLY :
2080
2052
case CURLOPT_LOCALPORT :
2081
2053
case CURLOPT_LOCALPORTRANGE :
2082
- #if LIBCURL_VERSION_NUM >= 0x071000 /* Available since 7.16.0 */
2083
2054
case CURLOPT_SSL_SESSIONID_CACHE :
2084
- #endif
2085
- #if LIBCURL_VERSION_NUM >= 0x071001 /* Available since 7.16.1 */
2086
2055
case CURLOPT_FTP_SSL_CCC :
2087
2056
case CURLOPT_SSH_AUTH_TYPES :
2088
- #endif
2089
- #if LIBCURL_VERSION_NUM >= 0x071002 /* Available since 7.16.2 */
2090
2057
case CURLOPT_CONNECTTIMEOUT_MS :
2091
2058
case CURLOPT_HTTP_CONTENT_DECODING :
2092
2059
case CURLOPT_HTTP_TRANSFER_DECODING :
2093
2060
case CURLOPT_TIMEOUT_MS :
2094
- #endif
2095
- #if LIBCURL_VERSION_NUM >= 0x071004 /* Available since 7.16.4 */
2096
2061
case CURLOPT_NEW_DIRECTORY_PERMS :
2097
2062
case CURLOPT_NEW_FILE_PERMS :
2098
- #endif
2099
- #if LIBCURL_VERSION_NUM >= 0x071100 /* Available since 7.17.0 */
2100
2063
case CURLOPT_USE_SSL :
2101
2064
case CURLOPT_APPEND :
2102
2065
case CURLOPT_DIRLISTONLY :
2103
- #else
2104
- case CURLOPT_FTP_SSL :
2105
- case CURLOPT_FTPAPPEND :
2106
- case CURLOPT_FTPLISTONLY :
2107
- #endif
2108
2066
#if LIBCURL_VERSION_NUM >= 0x071200 /* Available since 7.18.0 */
2109
2067
case CURLOPT_PROXY_TRANSFER_MODE :
2110
2068
#endif
@@ -2245,9 +2203,7 @@ static int _php_curl_setopt(php_curl *ch, zend_long option, zval *zvalue) /* {{{
2245
2203
case CURLOPT_USERPWD :
2246
2204
case CURLOPT_COOKIELIST :
2247
2205
case CURLOPT_FTP_ALTERNATIVE_TO_USER :
2248
- #if LIBCURL_VERSION_NUM >= 0x071101 /* Available since 7.17.1 */
2249
2206
case CURLOPT_SSH_HOST_PUBLIC_KEY_MD5 :
2250
- #endif
2251
2207
#if LIBCURL_VERSION_NUM >= 0x071301 /* Available since 7.19.1 */
2252
2208
case CURLOPT_PASSWORD :
2253
2209
case CURLOPT_PROXYPASSWORD :
@@ -2343,11 +2299,7 @@ static int _php_curl_setopt(php_curl *ch, zend_long option, zval *zvalue) /* {{{
2343
2299
#if LIBCURL_VERSION_NUM >= 0x072800 /* Available since 7.40.0 */
2344
2300
case CURLOPT_UNIX_SOCKET_PATH :
2345
2301
#endif
2346
- #if LIBCURL_VERSION_NUM >= 0x071004 /* Available since 7.16.4 */
2347
2302
case CURLOPT_KRBLEVEL :
2348
- #else
2349
- case CURLOPT_KRB4LEVEL :
2350
- #endif
2351
2303
{
2352
2304
if (Z_ISNULL_P (zvalue )) {
2353
2305
error = curl_easy_setopt (ch -> cp , option , NULL );
@@ -2751,25 +2703,12 @@ static int _php_curl_setopt(php_curl *ch, zend_long option, zval *zvalue) /* {{{
2751
2703
error = curl_easy_setopt (ch -> cp , CURLOPT_HTTPPOST , first );
2752
2704
#endif
2753
2705
} else {
2754
- #if LIBCURL_VERSION_NUM >= 0x071101
2755
2706
zend_string * tmp_str ;
2756
2707
zend_string * str = zval_get_tmp_string (zvalue , & tmp_str );
2757
2708
/* with curl 7.17.0 and later, we can use COPYPOSTFIELDS, but we have to provide size before */
2758
2709
error = curl_easy_setopt (ch -> cp , CURLOPT_POSTFIELDSIZE , ZSTR_LEN (str ));
2759
2710
error = curl_easy_setopt (ch -> cp , CURLOPT_COPYPOSTFIELDS , ZSTR_VAL (str ));
2760
2711
zend_tmp_string_release (tmp_str );
2761
- #else
2762
- char * post = NULL ;
2763
- zend_string * tmp_str ;
2764
- zend_string * str = zval_get_tmp_string (zvalue , & tmp_str );
2765
-
2766
- post = estrndup (ZSTR_VAL (str ), ZSTR_LEN (str ));
2767
- zend_llist_add_element (& ch -> to_free -> str , & post );
2768
-
2769
- curl_easy_setopt (ch -> cp , CURLOPT_POSTFIELDS , post );
2770
- error = curl_easy_setopt (ch -> cp , CURLOPT_POSTFIELDSIZE , ZSTR_LEN (str ));
2771
- zend_tmp_string_release (tmp_str );
2772
- #endif
2773
2712
}
2774
2713
break ;
2775
2714
@@ -2837,10 +2776,8 @@ static int _php_curl_setopt(php_curl *ch, zend_long option, zval *zvalue) /* {{{
2837
2776
case CURLOPT_RANDOM_FILE :
2838
2777
case CURLOPT_SSLCERT :
2839
2778
case CURLOPT_NETRC_FILE :
2840
- #if LIBCURL_VERSION_NUM >= 0x071001 /* Available since 7.16.1 */
2841
2779
case CURLOPT_SSH_PRIVATE_KEYFILE :
2842
2780
case CURLOPT_SSH_PUBLIC_KEYFILE :
2843
- #endif
2844
2781
#if LIBCURL_VERSION_NUM >= 0x071300 /* Available since 7.19.0 */
2845
2782
case CURLOPT_CRLFILE :
2846
2783
case CURLOPT_ISSUERCERT :
0 commit comments