]> granicus.if.org Git - curl/commitdiff
- Constantine Sapuntzakis filed bug report #2783090
authorDaniel Stenberg <daniel@haxx.se>
Tue, 28 Apr 2009 20:27:06 +0000 (20:27 +0000)
committerDaniel Stenberg <daniel@haxx.se>
Tue, 28 Apr 2009 20:27:06 +0000 (20:27 +0000)
  (http://curl.haxx.se/bug/view.cgi?id=2783090) pointing out that on windows
  we need to grow the SO_SNDBUF buffer somewhat to get really good upload
  speeds. http://support.microsoft.com/kb/823764 has the details. Friends
  confirmed that simply adding 32 to CURL_MAX_WRITE_SIZE is enough.

CHANGES
RELEASE-NOTES
lib/connect.c

diff --git a/CHANGES b/CHANGES
index 744422a431dc80d79cad88e12fc09250bc522d8e..605c8def444e168317e0b95837bf08002ba2814d 100644 (file)
--- a/CHANGES
+++ b/CHANGES
@@ -7,6 +7,12 @@
                                   Changelog
 
 Daniel Stenberg (28 Apr 2009)
+- Constantine Sapuntzakis filed bug report #2783090
+  (http://curl.haxx.se/bug/view.cgi?id=2783090) pointing out that on windows
+  we need to grow the SO_SNDBUF buffer somewhat to get really good upload
+  speeds. http://support.microsoft.com/kb/823764 has the details. Friends
+  confirmed that simply adding 32 to CURL_MAX_WRITE_SIZE is enough.
+
 - Bug report #2709004 (http://curl.haxx.se/bug/view.cgi?id=2709004) by Tim
   Chen pointed out how curl couldn't upload with resume when reading from a
   pipe.
index 77ad07fad97e83169ff2161cdbc416460c456599..93b4855bdcd70e6afd75b8e9d13ad4c054a23862 100644 (file)
@@ -34,6 +34,7 @@ This release includes the following bugfixes:
  o --libcurl bogus strings where other data was pointed to
  o crash related to FTP and "Re-used connection seems dead, get a new one"
  o CURLINFO_APPCONNECT_TIME with the multi interface
+ o Enhanced upload speeds on Windows
 
 This release includes the following known bugs:
 
@@ -46,6 +47,6 @@ advice from friends like these:
  Andre Guibert de Bruet, Andreas Farber, Frank Hempel, Pierre Brico,
  Kamil Dudka, Jim Freeman, Daniel Johnson, Toshio Kuratomi, Martin Storsjo,
  Pramod Sharma, Gisle Vanem, Leanic Lefever, Rainer Koenig, Sven Wegener,
- Tim Chen
+ Tim Chen, Constantine Sapuntzakis
 
         Thanks! (and sorry if I forgot to mention someone)
index c1206cee57144b0b7c4565d25bd926ad65db0403..7727bf0179a7359daa33e7bec514404ba0c2e3bd 100644 (file)
@@ -704,6 +704,27 @@ static void nosigpipe(struct connectdata *conn,
 #define nosigpipe(x,y)
 #endif
 
+#ifdef WIN32
+/* When you run a program that uses the Windows Sockets API, you may
+   experience slow performance when you copy data to a TCP server.
+
+   http://support.microsoft.com/kb/823764
+
+   Work-around: Make the Socket Send Buffer Size Larger Than the Program Send
+   Buffer Size
+
+*/
+static void sndbufset(struct connectdata *conn,
+                      curl_socket_t sockfd)
+{
+  int val = CURL_MAX_WRITE_SIZE + 32;
+  setsockopt(sockfd, SOL_SOCKET, SO_SNDBUF, (const char *)&val, sizeof(val));
+}
+#else
+#define sndbufset(x,y)
+#endif
+
+
 /* singleipconnect() connects to the given IP only, and it may return without
    having connected if used from the multi interface. */
 static curl_socket_t
@@ -807,6 +828,8 @@ singleipconnect(struct connectdata *conn,
 
   nosigpipe(conn, sockfd);
 
+  sndbufset(conn, sockfd);
+
   if(data->set.fsockopt) {
     /* activate callback for setting socket options */
     error = data->set.fsockopt(data->set.sockopt_client,