]> granicus.if.org Git - php/commitdiff
Added support for CURLOPT_MAX_RECV_SPEED_LARGE and CURLOPT_MAX_SEND_SPEED_LARGE....
authorPierrick Charron <pierrick@php.net>
Fri, 29 Apr 2011 10:41:44 +0000 (10:41 +0000)
committerPierrick Charron <pierrick@php.net>
Fri, 29 Apr 2011 10:41:44 +0000 (10:41 +0000)
# MFH. This addition was already committed to trunk and is backported as requested in #54622

NEWS
ext/curl/interface.c

diff --git a/NEWS b/NEWS
index 93108980d6698646813020c635fe26e0657a336f..2a11f90cb36c1eaac445084d5c02ed8f74434c11 100644 (file)
--- a/NEWS
+++ b/NEWS
@@ -28,6 +28,8 @@ PHP                                                                        NEWS
 
 - cURL
   . Added CURLINFO_REDIRECT_URL support. (Daniel Stenberg, Pierre)
+  . Added support for CURLOPT_MAX_RECV_SPEED_LARGE and 
+    CURLOPT_MAX_SEND_SPEED_LARGE. FR #51815. (Pierrick)
 
 - DateTime extension:
   . Fixed bug #54340 (DateTime::add() method bug). (Adam)
index 77f72c18027156defe83c9ddc3f5dfc6ff638000..484dfce0a7cc29ebcfe548082ebd95abb76f9983 100644 (file)
@@ -590,6 +590,11 @@ PHP_MINIT_FUNCTION(curl)
        REGISTER_CURL_CONSTANT(CURL_TIMECOND_IFUNMODSINCE);
        REGISTER_CURL_CONSTANT(CURL_TIMECOND_LASTMOD);
 
+#if LIBCURL_VERSION_NUM > 0x070f04 /* CURLOPT_MAX_RECV_SPEED_LARGE & CURLOPT_MAX_SEND_SPEED_LARGE  are available since curl 7.15.5 */
+       REGISTER_CURL_CONSTANT(CURLOPT_MAX_RECV_SPEED_LARGE);
+       REGISTER_CURL_CONSTANT(CURLOPT_MAX_SEND_SPEED_LARGE);
+#endif 
+
 #if LIBCURL_VERSION_NUM > 0x070a05 /* CURLOPT_HTTPAUTH is available since curl 7.10.6 */
        REGISTER_CURL_CONSTANT(CURLOPT_HTTPAUTH);
        /* http authentication options */
@@ -1692,6 +1697,13 @@ static int _php_curl_setopt(php_curl *ch, long option, zval **zvalue, zval *retu
 #endif
                        error = curl_easy_setopt(ch->cp, option, Z_LVAL_PP(zvalue));
                        break;
+#if LIBCURL_VERSION_NUM > 0x070f04
+               case CURLOPT_MAX_RECV_SPEED_LARGE:
+               case CURLOPT_MAX_SEND_SPEED_LARGE:
+                       convert_to_long_ex(zvalue);
+                       error = curl_easy_setopt(ch->cp, option, (curl_off_t)Z_LVAL_PP(zvalue));
+                       break;
+#endif
                case CURLOPT_FOLLOWLOCATION:
                        convert_to_long_ex(zvalue);
                        if ((PG(open_basedir) && *PG(open_basedir)) || PG(safe_mode)) {