mirror of
https://github.com/moparisthebest/curl
synced 2024-12-22 08:08:50 -05:00
CURLOPT_BUFFERSIZE allows an application to set a prefered buffer size
for receiving data from the network. It is meant as a hint, not as a forced limit.
This commit is contained in:
parent
5cb06d8fd6
commit
e54e0c7877
@ -220,7 +220,9 @@ CURLcode Curl_readwrite(struct connectdata *conn,
|
|||||||
|
|
||||||
/* read! */
|
/* read! */
|
||||||
result = Curl_read(conn, conn->sockfd, k->buf,
|
result = Curl_read(conn, conn->sockfd, k->buf,
|
||||||
BUFSIZE -1, &nread);
|
data->set.buffer_size?
|
||||||
|
data->set.buffer_size:BUFSIZE -1,
|
||||||
|
&nread);
|
||||||
|
|
||||||
if(0>result)
|
if(0>result)
|
||||||
break; /* get out of loop */
|
break; /* get out of loop */
|
||||||
|
13
lib/url.c
13
lib/url.c
@ -1011,6 +1011,19 @@ CURLcode Curl_setopt(struct SessionHandle *data, CURLoption option, ...)
|
|||||||
*/
|
*/
|
||||||
data->set.telnet_options = va_arg(param, struct curl_slist *);
|
data->set.telnet_options = va_arg(param, struct curl_slist *);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case CURLOPT_BUFFERSIZE:
|
||||||
|
/*
|
||||||
|
* The application kindly asks for a differently sized receive buffer.
|
||||||
|
* If it seems reasonable, we'll use it.
|
||||||
|
*/
|
||||||
|
data->set.buffer_size = va_arg(param, long);
|
||||||
|
|
||||||
|
if(data->set.buffer_size> (BUFSIZE -1 ))
|
||||||
|
data->set.buffer_size = 0; /* huge internal default */
|
||||||
|
|
||||||
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
/* unknown tag and its companion, just ignore: */
|
/* unknown tag and its companion, just ignore: */
|
||||||
return CURLE_FAILED_INIT; /* correct this */
|
return CURLE_FAILED_INIT; /* correct this */
|
||||||
|
@ -631,6 +631,7 @@ struct UserDefined {
|
|||||||
struct ssl_config_data ssl; /* user defined SSL stuff */
|
struct ssl_config_data ssl; /* user defined SSL stuff */
|
||||||
|
|
||||||
int dns_cache_timeout; /* DNS cache timeout */
|
int dns_cache_timeout; /* DNS cache timeout */
|
||||||
|
long buffer_size; /* size of receive buffer to use */
|
||||||
|
|
||||||
/* Here follows boolean settings that define how to behave during
|
/* Here follows boolean settings that define how to behave during
|
||||||
this session. They are STATIC, set by libcurl users or at least initially
|
this session. They are STATIC, set by libcurl users or at least initially
|
||||||
|
Loading…
Reference in New Issue
Block a user