--- curl-7.15.1\lib\http.c	Thu Oct 20 22:07:34 2005
+++ curl-7.15.1-patch\lib\http.c	Wed Jan 04 18:20:32 2006
@@ -843,21 +843,27 @@
  * Returns CURLcode
  */
static
CURLcode add_buffer_send(send_buffer *in,
                          struct connectdata *conn,
-                         long *bytes_written) /* add the number of sent
+                         long *bytes_written,
+                         int socketnum) /* add the number of sent
                                                  bytes to this counter */
{
   ssize_t amount;
   CURLcode res;
   char *ptr;
   size_t size;
   struct HTTP *http = conn->proto.http;
   size_t sendsize;
-  curl_socket_t sockfd = conn->sock[FIRSTSOCKET];
+  curl_socket_t sockfd = 0;

+  if (socketnum > SECONDARYSOCKET)
+    sockfd = conn->sock[FIRSTSOCKET];
+  else
+    sockfd = conn->sock[socketnum];
+
   /* The looping below is required since we use non-blocking sockets, but 
due
      to the circumstances we will just loop and try again and again etc */

   ptr = in->buffer;
   size = in->size_used;
@@ -1164,11 +1170,11 @@
           result = add_bufferf(req_buffer, "\r\n");

         if(CURLE_OK == result)
           /* Now send off the request */
           result = add_buffer_send(req_buffer, conn,
-                                   &data->info.request_size);
+                                   &data->info.request_size, sockindex);
       }
       if(result)
         failf(data, "Failed sending CONNECT to proxy");
     }
     free(host_port);
@@ -2030,11 +2036,11 @@
         result = add_bufferf(req_buffer, "Content-Length: 0\r\n\r\n");
         if(result)
           return result;

         result = add_buffer_send(req_buffer, conn,
-                                 &data->info.request_size);
+                                 &data->info.request_size, FIRSTSOCKET);
         if(result)
           failf(data, "Failed sending POST request");
         else
           /* setup variables for the upcoming transfer */
           result = Curl_Transfer(conn, FIRSTSOCKET, -1, TRUE,
@@ -2095,11 +2101,11 @@
       /* set upload size to the progress meter */
       Curl_pgrsSetUploadSize(data, http->postsize);

       /* fire away the whole request to the server */
       result = add_buffer_send(req_buffer, conn,
-                               &data->info.request_size);
+                               &data->info.request_size, FIRSTSOCKET);
       if(result)
         failf(data, "Failed sending POST request");
       else
         /* setup variables for the upcoming transfer */
         result = Curl_Transfer(conn, FIRSTSOCKET, -1, TRUE,
@@ -2139,11 +2145,11 @@
       /* set the upload size to the progress meter */
       Curl_pgrsSetUploadSize(data, postsize);

       /* this sends the buffer and frees all the buffer resources */
       result = add_buffer_send(req_buffer, conn,
-                               &data->info.request_size);
+                               &data->info.request_size, FIRSTSOCKET);
       if(result)
         failf(data, "Failed sending PUT request");
       else
         /* prepare for transfer */
         result = Curl_Transfer(conn, FIRSTSOCKET, -1, TRUE,
@@ -2261,11 +2267,11 @@
           http->postdata = (char *)&http->postdata;
         }
       }
       /* issue the request */
       result = add_buffer_send(req_buffer, conn,
-                               &data->info.request_size);
+                               &data->info.request_size, FIRSTSOCKET);

       if(result)
         failf(data, "Failed sending HTTP POST request");
       else
         result =
@@ -2278,11 +2284,11 @@
     default:
       add_buffer(req_buffer, "\r\n", 2);

       /* issue the request */
       result = add_buffer_send(req_buffer, conn,
-                               &data->info.request_size);
+                               &data->info.request_size, FIRSTSOCKET);

       if(result)
         failf(data, "Failed sending HTTP request");
       else
         /* HTTP GET/HEAD download: */


