From d068001102519c01970808e1ec572016ee3d3408 Mon Sep 17 00:00:00 2001 From: Daniel Stenberg Date: Tue, 28 Apr 2009 20:27:06 +0000 Subject: [PATCH] - 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. --- CHANGES | 6 ++++++ RELEASE-NOTES | 3 ++- lib/connect.c | 23 +++++++++++++++++++++++ 3 files changed, 31 insertions(+), 1 deletion(-) diff --git a/CHANGES b/CHANGES index 744422a43..605c8def4 100644 --- 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. diff --git a/RELEASE-NOTES b/RELEASE-NOTES index 77ad07fad..93b4855bd 100644 --- a/RELEASE-NOTES +++ b/RELEASE-NOTES @@ -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) diff --git a/lib/connect.c b/lib/connect.c index c1206cee5..7727bf017 100644 --- a/lib/connect.c +++ b/lib/connect.c @@ -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,