php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Request #51815 Add support for cURL option CURLOPT_MAX_RECV_SPEED_LARGE
Submitted: 2010-05-13 23:13 UTC Modified: 2010-05-14 08:30 UTC
From: perryc at gmail dot com Assigned: pierrick (profile)
Status: Closed Package: cURL related
PHP Version: 5.2SVN-2010-05-13 (snap) OS: all
Private report: No CVE-ID: None
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: perryc at gmail dot com
New email:
PHP Version: OS:

 

 [2010-05-13 23:13 UTC] perryc at gmail dot com
Description:
------------
cURL has supported download an upload rate limiting via CURLOPT_MAX_RECV_SPEED_LARGE and CURLOPT_MAX_SEND_SPEED_LARGE for some time.  Support for these options needs to be added to ext/curl/interface.c (they are simple integer values so no special support is needed, they just need to be added to the constant definitions and switch statement).

Test script:
---------------
<?php

// create a new cURL resource
$ch = curl_init();

$fh = fopen("out.dat", "w");

// set URL and other appropriate options
curl_setopt($ch, CURLOPT_MAX_RECV_SPEED_LARGE, 10240);
curl_setopt($ch, CURLOPT_URL, "http://bitcast-a.bitgravity.com/bitgravity/1MB");
curl_setopt($ch, CURLOPT_FILE, $fh);
curl_setopt($ch, CURLOPT_HEADER, 0);

// grab URL
curl_exec($ch);

// close cURL resource, and free up system resources
curl_close($ch);
fclose($fh);
?>


Expected result:
----------------
Script should take at least 100 seconds to run (no matter the speed of the local internet connection).

Actual result:
--------------
Currently, because CURLOPT_MAX_RECV_SPEED_LARGE is not implemented in the cURL extension, the script takes as long as downloading the file over the local internet connection takes, i.e. there is no rate limiting.

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2010-05-14 08:30 UTC] pierrick@php.net
-Status: Open +Status: Closed -Assigned To: +Assigned To: pierrick
 [2010-05-14 08:30 UTC] pierrick@php.net
This bug has been fixed in SVN.

Snapshots of the sources are packaged every three hours; this change
will be in the next snapshot. You can grab the snapshot at
http://snaps.php.net/.
 
Thank you for the report, and for helping us make PHP better.


 [2011-04-29 12:41 UTC] pierrick@php.net
Automatic comment from SVN on behalf of pierrick
Revision: http://svn.php.net/viewvc/?view=revision&amp;revision=310648
Log: Added support for CURLOPT_MAX_RECV_SPEED_LARGE and CURLOPT_MAX_SEND_SPEED_LARGE. FR #51815
# MFH. This addition was already committed to trunk and is backported as requested in #54622
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Tue Oct 08 09:01:27 2024 UTC