@@ -869,6 +869,22 @@ static CURLcode done_sending(struct connectdata *conn,
869869 return CURLE_OK ;
870870}
871871
872+ #if defined(WIN32 ) && defined(SIO_IDEAL_SEND_BACKLOG_QUERY )
873+ static void win_update_buffer_size (curl_socket_t sockfd )
874+ {
875+ int result ;
876+ ULONG ideal ;
877+ DWORD ideallen ;
878+ result = WSAIoctl (sockfd , SIO_IDEAL_SEND_BACKLOG_QUERY , 0 , 0 ,
879+ & ideal , sizeof (ideal ), & ideallen , 0 , 0 );
880+ if (result == 0 ) {
881+ setsockopt (sockfd , SOL_SOCKET , SO_SNDBUF ,
882+ (const char * )& ideal , sizeof (ideal ));
883+ }
884+ }
885+ #else
886+ #define win_update_buffer_size (x )
887+ #endif
872888
873889/*
874890 * Send data to upload to the server, when the socket is writable.
@@ -1020,10 +1036,11 @@ static CURLcode readwrite_upload(struct Curl_easy *data,
10201036 k -> upload_fromhere , /* buffer pointer */
10211037 k -> upload_present , /* buffer size */
10221038 & bytes_written ); /* actually sent */
1023-
10241039 if (result )
10251040 return result ;
10261041
1042+ win_update_buffer_size (conn -> writesockfd );
1043+
10271044 if (data -> set .verbose )
10281045 /* show the data before we change the pointer upload_fromhere */
10291046 Curl_debug (data , CURLINFO_DATA_OUT , k -> upload_fromhere ,
0 commit comments