]> granicus.if.org Git - curl/commitdiff
upload: UPLOAD_BUFSIZE is now for the upload buffer
authorDaniel Stenberg <daniel@haxx.se>
Tue, 25 Apr 2017 12:37:06 +0000 (14:37 +0200)
committerDaniel Stenberg <daniel@haxx.se>
Mon, 1 May 2017 20:55:29 +0000 (22:55 +0200)
lib/file.c
lib/smb.c
lib/transfer.c
lib/urldata.h

index 4b1017c6f1e16d3e3e1519d0a83f3868c66e9fe9..dc458db1fdfff24595d6c845db9199a85c47f508 100644 (file)
@@ -360,7 +360,7 @@ static CURLcode file_upload(struct connectdata *conn)
 
   while(!result) {
     int readcount;
-    result = Curl_fillreadbuffer(conn, BUFSIZE, &readcount);
+    result = Curl_fillreadbuffer(conn, (int)data->set.buffer_size, &readcount);
     if(result)
       break;
 
index 51b3434cbe71db5bff7a752180e74e9d5e686b72..5b1ffa9b7cbfec0f5c86e29a11be43592d6ba866 100644 (file)
--- a/lib/smb.c
+++ b/lib/smb.c
@@ -607,7 +607,7 @@ static CURLcode smb_send_and_recv(struct connectdata *conn, void **msg)
 
   /* Check if there is data in the transfer buffer */
   if(!smbc->send_size && smbc->upload_size) {
-    int nread = smbc->upload_size > BUFSIZE ? BUFSIZE :
+    int nread = smbc->upload_size > UPLOAD_BUFSIZE ? UPLOAD_BUFSIZE :
       (int) smbc->upload_size;
     conn->data->req.upload_fromhere = conn->data->state.uploadbuffer;
     result = Curl_fillreadbuffer(conn, nread, &nread);
index d6aac675b7e0c8c2437b9766df9c8085f3000314..bafb6e9c8f21e8f898a0f6000e246b4702e083b4 100644 (file)
@@ -904,7 +904,7 @@ static CURLcode readwrite_upload(struct Curl_easy *data,
             sending_http_headers = FALSE;
         }
 
-        result = Curl_fillreadbuffer(conn, BUFSIZE, &fillcount);
+        result = Curl_fillreadbuffer(conn, UPLOAD_BUFSIZE, &fillcount);
         if(result)
           return result;
 
index 6e87684bf752e7bcc03fe343489d51c43fa442d4..22b0f81957c82f073308af27e23a955c9df5638a 100644 (file)
 #define MAX_BUFSIZE CURL_MAX_READ_SIZE
 #define MIN_BUFSIZE 1024
 
+/* The upload buffer size, should not be smaller than CURL_MAX_WRITE_SIZE, as
+   it needs to hold a full buffer as could be sent in a write callback */
+#define UPLOAD_BUFSIZE CURL_MAX_WRITE_SIZE
+
 /* Initial size of the buffer to store headers in, it'll be enlarged in case
    of need. */
 #define HEADERSIZE 256
@@ -1333,7 +1337,7 @@ struct UrlState {
   size_t headersize;   /* size of the allocation */
 
   char *buffer; /* download buffer */
-  char uploadbuffer[BUFSIZE+1]; /* upload buffer */
+  char uploadbuffer[UPLOAD_BUFSIZE+1]; /* upload buffer */
   curl_off_t current_speed;  /* the ProgressShow() function sets this,
                                 bytes / second */
   bool this_is_a_follow; /* this is a followed Location: request */