Subject: | setting CURLOPT_MAX_RECV_SPEED_LARGE (and other parameters expecting curl_off_t?) broken |
Hi, as part of the group that maintains Debian perl packages, I have
received the following bug report. I have checked the latest version of
WWW-Curl, and this doesn't seem to have been fixed (the report is from
3.02). The submitter also proposes a patch that you can find below.
Thanks.
----
Forwarded mail:
I am the maintainer of apt-cacher which I have recently converted to use
libcurl via libwww-curl-perl.
I have had a bug filed against apt-cacher (#462523) which is failing to
limit bandwith usage since conversion to libcurl.
Looking at the source of libwww-curl-perl, this appears to be because
CURLOPT_MAX_RECV_SPEED_LARGE requires a curl_off_t parameter, but
Curl.xs uses the default handler and casts it to long.
I have created a very basic patch and verified that it fixes the test
case for me here. It probably is not finished and requires some version
#ifdefs, but seems a good starting point.
I would be grateful if you would consider including a fix for this.
Thanks,
Mark
--- WWW-Curl-3.02/Curl.xs 2004-04-20 14:24:18.000000000 +0100
+++ /usr/src/WWW-Curl-3.02/Curl.xs 2008-01-29 12:10:29.000000000 +0000
@@ -714,6 +714,18 @@
croak("value is not of type WWW::Curl::Form");
break;
*/
+
+ /* Expect curl_off_t */
+ case CURLOPT_POSTFIELDSIZE_LARGE:
+ case CURLOPT_RESUME_FROM_LARGE:
+ case CURLOPT_INFILESIZE_LARGE:
+ case CURLOPT_MAXFILESIZE_LARGE:
+ case CURLOPT_MAX_SEND_SPEED_LARGE:
+ case CURLOPT_MAX_RECV_SPEED_LARGE:
+ {
+ RETVAL = curl_easy_setopt(self->curl, option,
(curl_off_t)SvIV(value));
+ };
+ break;
/* default cases */
default: