[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[GNUnet-SVN] [gnurl] 55/254: CURLOPT_BUFFERSIZE: 1024 bytes is now the m
From: |
gnunet |
Subject: |
[GNUnet-SVN] [gnurl] 55/254: CURLOPT_BUFFERSIZE: 1024 bytes is now the minimum size |
Date: |
Sat, 17 Jun 2017 16:51:27 +0200 |
This is an automated email from the git hooks/post-receive script.
ng0 pushed a commit to annotated tag gnurl-7.54.1
in repository gnurl.
commit c2ddc12d6086b522703c8b80a72ab791680f1a28
Author: Daniel Stenberg <address@hidden>
AuthorDate: Tue Apr 25 00:09:22 2017 +0200
CURLOPT_BUFFERSIZE: 1024 bytes is now the minimum size
The buffer is needed to receive FTP, HTTP CONNECT responses etc so
already at this size things risk breaking and smaller is certainly not
wise.
---
lib/url.c | 15 +++++++++------
lib/urldata.h | 1 +
2 files changed, 10 insertions(+), 6 deletions(-)
diff --git a/lib/url.c b/lib/url.c
index 4fc2f4cad..04c03ac8d 100644
--- a/lib/url.c
+++ b/lib/url.c
@@ -2284,15 +2284,17 @@ CURLcode Curl_setopt(struct Curl_easy *data, CURLoption
option,
* 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);
+ arg = va_arg(param, long);
- if(data->set.buffer_size > MAX_BUFSIZE)
- data->set.buffer_size = MAX_BUFSIZE; /* huge internal default */
- else if(data->set.buffer_size < 1)
- data->set.buffer_size = BUFSIZE;
+ if(arg > MAX_BUFSIZE)
+ arg = MAX_BUFSIZE; /* huge internal default */
+ else if(arg < 1)
+ arg = BUFSIZE;
+ else if(arg < MIN_BUFSIZE)
+ arg = BUFSIZE;
/* Resize only if larger than default buffer size. */
- if(data->set.buffer_size > BUFSIZE) {
+ if(arg > BUFSIZE) {
char *newbuff = realloc(data->state.buffer, data->set.buffer_size + 1);
if(!newbuff) {
DEBUGF(fprintf(stderr, "Error: realloc of buffer failed\n"));
@@ -2301,6 +2303,7 @@ CURLcode Curl_setopt(struct Curl_easy *data, CURLoption
option,
else
data->state.buffer = newbuff;
}
+ data->set.buffer_size = arg;
break;
diff --git a/lib/urldata.h b/lib/urldata.h
index f7a55e15e..b300d8a69 100644
--- a/lib/urldata.h
+++ b/lib/urldata.h
@@ -205,6 +205,7 @@
#define BUFSIZE CURL_MAX_WRITE_SIZE
#undef MAX_BUFSIZE
#define MAX_BUFSIZE CURL_MAX_READ_SIZE
+#define MIN_BUFSIZE 1024
#define CURL_BUFSIZE(x) ((x)?(x):(BUFSIZE))
/* Initial size of the buffer to store headers in, it'll be enlarged in case
--
To stop receiving notification emails like this one, please contact
address@hidden
- [GNUnet-SVN] [gnurl] 103/254: buildconf: fix hang on IRIX, (continued)
- [GNUnet-SVN] [gnurl] 103/254: buildconf: fix hang on IRIX, gnunet, 2017/06/17
- [GNUnet-SVN] [gnurl] 30/254: lib: remove unused code, gnunet, 2017/06/17
- [GNUnet-SVN] [gnurl] 102/254: opts: fix bad example formatting \n => \\n, gnunet, 2017/06/17
- [GNUnet-SVN] [gnurl] 86/254: curl: fix warning "comma at end of enumerator list", gnunet, 2017/06/17
- [GNUnet-SVN] [gnurl] 61/254: failf: use private buffer, don't clobber receive buffer, gnunet, 2017/06/17
- [GNUnet-SVN] [gnurl] 92/254: runtests: use -R for random order, gnunet, 2017/06/17
- [GNUnet-SVN] [gnurl] 71/254: url: let CURLOPT_BUFFERSIZE realloc to smaller sizes too, gnunet, 2017/06/17
- [GNUnet-SVN] [gnurl] 42/254: unit1604: fixed compilation under Windows, broken in the previous commit, gnunet, 2017/06/17
- [GNUnet-SVN] [gnurl] 38/254: tests: added --remote-time tests for remaining protocols that support it, gnunet, 2017/06/17
- [GNUnet-SVN] [gnurl] 41/254: tests: fixed OOM handling of unit tests to abort test, gnunet, 2017/06/17
- [GNUnet-SVN] [gnurl] 55/254: CURLOPT_BUFFERSIZE: 1024 bytes is now the minimum size,
gnunet <=
- [GNUnet-SVN] [gnurl] 57/254: buffer_size: make sure it always has the correct size, gnunet, 2017/06/17
- [GNUnet-SVN] [gnurl] 105/254: asyn-thread: fix unused macro warnings, gnunet, 2017/06/17
- [GNUnet-SVN] [gnurl] 73/254: gtls: fixed a lingering BUFSIZE reference, gnunet, 2017/06/17
- [GNUnet-SVN] [gnurl] 70/254: BUFSIZE: rename to READBUFFER_*, make separate MASTERBUF_SIZE, gnunet, 2017/06/17
- [GNUnet-SVN] [gnurl] 149/254: cmdline-opts/write-out.d: s/-L/--location, gnunet, 2017/06/17
- [GNUnet-SVN] [gnurl] 99/254: runtests.pl: simplify the datacheck read section, gnunet, 2017/06/17
- [GNUnet-SVN] [gnurl] 44/254: http2: declare TU-local variables static, gnunet, 2017/06/17
- [GNUnet-SVN] [gnurl] 54/254: ftp: use private buffer for temp storage, not receive buffer, gnunet, 2017/06/17
- [GNUnet-SVN] [gnurl] 81/254: lib: fix compiler warnings, gnunet, 2017/06/17
- [GNUnet-SVN] [gnurl] 47/254: tool_cb_prg: fix double-promotion warning, gnunet, 2017/06/17