diff options
author | Daniel Stenberg <daniel@haxx.se> | 2002-06-15 21:00:54 +0000 |
---|---|---|
committer | Daniel Stenberg <daniel@haxx.se> | 2002-06-15 21:00:54 +0000 |
commit | e54e0c78778f6844b067c8d6a4e5d57069e088ae (patch) | |
tree | 10cf95c92dbe96baa18f8670fe1f037a791e4053 /lib | |
parent | 5cb06d8fd6e917e118fa039cf02017d6c903a145 (diff) |
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.
Diffstat (limited to 'lib')
-rw-r--r-- | lib/transfer.c | 4 | ||||
-rw-r--r-- | lib/url.c | 13 | ||||
-rw-r--r-- | lib/urldata.h | 1 |
3 files changed, 17 insertions, 1 deletions
diff --git a/lib/transfer.c b/lib/transfer.c index 893897b05..d36c90fce 100644 --- a/lib/transfer.c +++ b/lib/transfer.c @@ -220,7 +220,9 @@ CURLcode Curl_readwrite(struct connectdata *conn, /* read! */ 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) break; /* get out of loop */ @@ -1011,6 +1011,19 @@ CURLcode Curl_setopt(struct SessionHandle *data, CURLoption option, ...) */ data->set.telnet_options = va_arg(param, struct curl_slist *); 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: /* unknown tag and its companion, just ignore: */ return CURLE_FAILED_INIT; /* correct this */ diff --git a/lib/urldata.h b/lib/urldata.h index 161cc0004..cb0e3dec9 100644 --- a/lib/urldata.h +++ b/lib/urldata.h @@ -631,6 +631,7 @@ struct UserDefined { struct ssl_config_data ssl; /* user defined SSL stuff */ 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 this session. They are STATIC, set by libcurl users or at least initially |