? ares/libcares.pc
Index: lib/multi.c
===================================================================
RCS file: /cvsroot/curl/curl/lib/multi.c,v
retrieving revision 1.160
diff -U 20 -r1.160 multi.c
--- lib/multi.c	18 Jan 2008 21:51:11 -0000	1.160
+++ lib/multi.c	21 Jan 2008 14:46:12 -0000
@@ -68,41 +68,40 @@
 /* NOTE: if you add a state here, add the name to the statename[] array as
    well!
 */
 typedef enum {
   CURLM_STATE_INIT,        /* start in this state */
   CURLM_STATE_CONNECT,     /* resolve/connect has been sent off */
   CURLM_STATE_WAITRESOLVE, /* awaiting the resolve to finalize */
   CURLM_STATE_WAITCONNECT, /* awaiting the connect to finalize */
   CURLM_STATE_WAITPROXYCONNECT, /* awaiting proxy CONNECT to finalize */
   CURLM_STATE_PROTOCONNECT, /* completing the protocol-specific connect phase */
   CURLM_STATE_WAITDO,      /* wait for our turn to send the request */
   CURLM_STATE_DO,          /* start send off the request (part 1) */
   CURLM_STATE_DOING,       /* sending off the request (part 1) */
   CURLM_STATE_DO_MORE,     /* send off the request (part 2) */
   CURLM_STATE_DO_DONE,     /* done sending off request */
   CURLM_STATE_WAITPERFORM, /* wait for our turn to read the response */
   CURLM_STATE_PERFORM,     /* transfer data */
   CURLM_STATE_TOOFAST,     /* wait because limit-rate exceeded */
   CURLM_STATE_DONE,        /* post data transfer operation */
   CURLM_STATE_COMPLETED,   /* operation complete */
-  CURLM_STATE_CANCELLED,   /* cancelled */
 
   CURLM_STATE_LAST /* not a true state, never use this */
 } CURLMstate;
 
 /* we support N sockets per easy handle. Set the corresponding bit to what
    action we should wait for */
 #define MAX_SOCKSPEREASYHANDLE 5
 #define GETSOCK_READABLE (0x00ff)
 #define GETSOCK_WRITABLE (0xff00)
 
 struct closure {
   struct closure *next; /* a simple one-way list of structs */
   struct SessionHandle *easy_handle;
 };
 
 struct Curl_one_easy {
   /* first, two fields for the linked list of these */
   struct Curl_one_easy *next;
   struct Curl_one_easy *prev;
 
@@ -199,41 +198,40 @@
                            struct curl_llist *pipeline);
 
 #ifdef CURLDEBUG
 static const char * const statename[]={
   "INIT",
   "CONNECT",
   "WAITRESOLVE",
   "WAITCONNECT",
   "WAITPROXYCONNECT",
   "PROTOCONNECT",
   "WAITDO",
   "DO",
   "DOING",
   "DO_MORE",
   "DO_DONE",
   "WAITPERFORM",
   "PERFORM",
   "TOOFAST",
   "DONE",
   "COMPLETED",
-  "CANCELLED"
 };
 
 void curl_multi_dump(CURLM *multi_handle);
 #endif
 
 /* always use this function to change state, to make debugging easier */
 static void multistate(struct Curl_one_easy *easy, CURLMstate state)
 {
 #ifdef CURLDEBUG
   long connectindex = -5000;
 #endif
   CURLMstate oldstate = easy->state;
 
   if(oldstate == state)
     /* don't bother when the new state is the same as the old state */
     return;
 
   easy->state = state;
 
 #ifdef CURLDEBUG
@@ -570,49 +568,46 @@
     return CURLM_BAD_HANDLE;
 
   /* Verify that we got a somewhat good easy handle too */
   if(!GOOD_EASY_HANDLE(curl_handle))
     return CURLM_BAD_EASY_HANDLE;
 
   /* pick-up from the 'curl_handle' the kept position in the list */
   easy = ((struct SessionHandle *)curl_handle)->multi_pos;
 
   if(easy) {
     bool premature = (bool)(easy->state != CURLM_STATE_COMPLETED);
 
     /* If the 'state' is not INIT or COMPLETED, we might need to do something
        nice to put the easy_handle in a good known state when this returns. */
     if(premature)
       /* this handle is "alive" so we need to count down the total number of
          alive connections when this is removed */
       multi->num_alive--;
 
     if(easy->easy_handle->state.is_in_pipeline &&
-        easy->state > CURLM_STATE_DO &&
-        easy->state < CURLM_STATE_COMPLETED) {
-      /* If the handle is in a pipeline and has finished sending off its
-         request but not received its reponse yet, we need to remember the
-         fact that we want to remove this handle but do the actual removal at
-         a later time */
-      easy->easy_handle->state.cancelled = TRUE;
-      return CURLM_OK;
-    }
+        easy->state > CURLM_STATE_WAITDO &&
+        easy->state < CURLM_STATE_COMPLETED)
+      /* If the handle is in a pipeline and has started sending off its
+         request but not received its reponse yet, we need to close
+         connection. */
+      easy->easy_conn->bits.close = TRUE;
 
     /* The timer must be shut down before easy->multi is set to NULL,
        else the timenode will remain in the splay tree after
        curl_easy_cleanup is called. */
     Curl_expire(easy->easy_handle, 0);
 
     if(easy->easy_handle->dns.hostcachetype == HCACHE_MULTI) {
       /* clear out the usage of the shared DNS cache */
       easy->easy_handle->dns.hostcache = NULL;
       easy->easy_handle->dns.hostcachetype = HCACHE_NONE;
     }
 
     /* we must call Curl_done() here (if we still "own it") so that we don't
        leave a half-baked one around */
     if(easy->easy_conn &&
        (easy->easy_conn->data == easy->easy_handle)) {
 
       /* Curl_done() clears the conn->data field to lose the association
          between the easy handle and the connection */
       Curl_done(&easy->easy_conn, easy->result, premature);
@@ -1334,73 +1329,60 @@
         }
       }
 
       break;
 
     case CURLM_STATE_DONE:
       /* Remove ourselves from the receive pipeline */
       Curl_removeHandleFromPipeline(easy->easy_handle,
                                     easy->easy_conn->recv_pipe);
       /* Check if we can move pending requests to send pipe */
       checkPendPipeline(easy->easy_conn);
       easy->easy_handle->state.is_in_pipeline = FALSE;
 
       if(easy->easy_conn->bits.stream_was_rewound) {
           /* This request read past its response boundary so we quickly
              let the other requests consume those bytes since there is no
              guarantee that the socket will become active again */
           result = CURLM_CALL_MULTI_PERFORM;
       }
 
-      if(!easy->easy_handle->state.cancelled) {
-        /* post-transfer command */
-        easy->result = Curl_done(&easy->easy_conn, CURLE_OK, FALSE);
+      /* post-transfer command */
+      easy->result = Curl_done(&easy->easy_conn, CURLE_OK, FALSE);
 
-        /* after we have DONE what we're supposed to do, go COMPLETED, and
-           it doesn't matter what the Curl_done() returned! */
-        multistate(easy, CURLM_STATE_COMPLETED);
-      }
+      /* after we have DONE what we're supposed to do, go COMPLETED, and
+         it doesn't matter what the Curl_done() returned! */
+      multistate(easy, CURLM_STATE_COMPLETED);
 
       break;
 
     case CURLM_STATE_COMPLETED:
-      if(easy->easy_handle->state.cancelled)
-        /* Go into the CANCELLED state if we were cancelled */
-        multistate(easy, CURLM_STATE_CANCELLED);
-
       /* this is a completed transfer, it is likely to still be connected */
 
       /* This node should be delinked from the list now and we should post
          an information message that we are complete. */
 
       /* Important: reset the conn pointer so that we don't point to memory
          that could be freed anytime */
       easy->easy_conn = NULL;
       break;
 
-    case CURLM_STATE_CANCELLED:
-      /* Cancelled transfer, wait to be cleaned up */
-
-      /* Reset the conn pointer so we don't leave it dangling */
-      easy->easy_conn = NULL;
-      break;
-
     default:
       return CURLM_INTERNAL_ERROR;
     }
 
     if(CURLM_STATE_COMPLETED != easy->state) {
       if(CURLE_OK != easy->result) {
         /*
          * If an error was returned, and we aren't in completed state now,
          * then we go to completed and consider this transfer aborted.
          */
 
         /* NOTE: no attempt to disconnect connections must be made
            in the case blocks above - cleanup happens only here */
 
         easy->easy_handle->state.is_in_pipeline = FALSE;
         easy->easy_handle->state.pipe_broke = FALSE;
 
         if(easy->easy_conn) {
           /* if this has a connection, unsubscribe from the pipelines */
           easy->easy_conn->writechannel_inuse = FALSE;
@@ -1464,49 +1446,40 @@
     Curl_expire(easy->easy_handle, 10);
 
   return result;
 }
 
 
 CURLMcode curl_multi_perform(CURLM *multi_handle, int *running_handles)
 {
   struct Curl_multi *multi=(struct Curl_multi *)multi_handle;
   struct Curl_one_easy *easy;
   CURLMcode returncode=CURLM_OK;
   struct Curl_tree *t;
 
   if(!GOOD_MULTI_HANDLE(multi))
     return CURLM_BAD_HANDLE;
 
   easy=multi->easy.next;
   while(easy != &multi->easy) {
     CURLMcode result;
 
-    if(easy->easy_handle->state.cancelled &&
-        easy->state == CURLM_STATE_CANCELLED) {
-      /* Remove cancelled handles once it's safe to do so */
-      Curl_multi_rmeasy(multi_handle, easy->easy_handle);
-      easy->easy_handle = NULL;
-      easy = easy->next;
-      continue;
-    }
-
     result = multi_runsingle(multi, easy);
     if(result)
       returncode = result;
 
     easy = easy->next; /* operate on next handle */
   }
 
   /*
    * Simply remove all expired timers from the splay since handles are dealt
    * with unconditionally by this function and curl_multi_timeout() requires
    * that already passed/handled expire times are removed from the splay.
    */
   do {
     struct timeval now = Curl_tvnow();
     int key = now.tv_sec; /* drop the usec part */
 
     multi->timetree = Curl_splaygetbest(key, multi->timetree, &t);
     if(t) {
       struct SessionHandle *d = t->payload;
       struct timeval* tv = &d->state.expiretime;
Index: lib/sendf.c
===================================================================
RCS file: /cvsroot/curl/curl/lib/sendf.c,v
retrieving revision 1.138
diff -U 20 -r1.138 sendf.c
--- lib/sendf.c	8 Jan 2008 14:52:07 -0000	1.138
+++ lib/sendf.c	21 Jan 2008 14:46:16 -0000
@@ -402,45 +402,40 @@
   DEBUGF(infof(data, "Pausing with %d bytes in buffer for type %02x\n",
                (int)len, type));
 
   return CURLE_OK;
 }
 
 
 /* client_write() sends data to the write callback(s)
 
    The bit pattern defines to what "streams" to write to. Body and/or header.
    The defines are in sendf.h of course.
  */
 CURLcode Curl_client_write(struct connectdata *conn,
                            int type,
                            char *ptr,
                            size_t len)
 {
   struct SessionHandle *data = conn->data;
   size_t wrote;
 
-  if(data->state.cancelled) {
-    /* We just suck everything into a black hole */
-    return CURLE_OK;
-  }
-
   /* If reading is actually paused, we're forced to append this chunk of data
      to the already held data, but only if it is the same type as otherwise it
      can't work and it'll return error instead. */
   if(data->req.keepon & KEEP_READ_PAUSE) {
     size_t newlen;
     char *newptr;
     if(type != data->state.tempwritetype)
       /* major internal confusion */
       return CURLE_RECV_ERROR;
 
     /* figure out the new size of the data to save */
     newlen = len + data->state.tempwritesize;
     /* allocate the new memory area */
     newptr = malloc(newlen);
     if(!newptr)
       return CURLE_OUT_OF_MEMORY;
     /* copy the previously held data to the new area */
     memcpy(newptr, data->state.tempwrite, data->state.tempwritesize);
     /* copy the new data to the end of the new area */
     memcpy(newptr + data->state.tempwritesize, ptr, len);
Index: lib/url.c
===================================================================
RCS file: /cvsroot/curl/curl/lib/url.c,v
retrieving revision 1.695
diff -U 20 -r1.695 url.c
--- lib/url.c	16 Jan 2008 12:24:00 -0000	1.695
+++ lib/url.c	21 Jan 2008 14:46:32 -0000
@@ -2460,41 +2460,41 @@
              !strequal(needle->passwd, check->passwd)) {
             /* one of them was different */
             continue;
           }
         }
         match = TRUE;
       }
     }
     else { /* The requested needle connection is using a proxy,
               is the checked one using the same host, port and type? */
       if(check->bits.proxy &&
          (needle->proxytype == check->proxytype) &&
          strequal(needle->proxy.name, check->proxy.name) &&
          needle->port == check->port) {
         /* This is the same proxy connection, use it! */
         match = TRUE;
       }
     }
 
     if(match) {
-      if(!Curl_isPipeliningEnabled(data)) {
+      if(!check->is_in_pipeline) {
         /* The check for a dead socket makes sense only in the
            non-pipelining case */
         bool dead = SocketIsDead(check->sock[FIRSTSOCKET]);
         if(dead) {
           check->data = data;
           infof(data, "Connection #%d seems to be dead!\n", i);
 
           Curl_disconnect(check); /* disconnect resources */
           data->state.connc->connects[i]=NULL; /* nothing here */
 
           return FALSE;
         }
       }
 
       check->inuse = TRUE; /* mark this as being in use so that no other
                               handle in a multi stack may nick it */
       if(canPipeline) {
         /* Mark the connection as being in a pipeline */
         check->is_in_pipeline = TRUE;
       }
Index: lib/urldata.h
===================================================================
RCS file: /cvsroot/curl/curl/lib/urldata.h,v
retrieving revision 1.371
diff -U 20 -r1.371 urldata.h
--- lib/urldata.h	16 Jan 2008 12:24:00 -0000	1.371
+++ lib/urldata.h	21 Jan 2008 14:46:34 -0000
@@ -1177,41 +1177,40 @@
 #ifdef USE_ARES
   ares_channel areschannel; /* for name resolves */
 #endif
 
 #if defined(USE_SSLEAY) && defined(HAVE_OPENSSL_ENGINE_H)
   ENGINE *engine;
 #endif /* USE_SSLEAY */
   struct timeval expiretime; /* set this with Curl_expire() only */
   struct Curl_tree timenode; /* for the splay stuff */
 
   /* a place to store the most recenlty set FTP entrypath */
   char *most_recent_ftp_entrypath;
 
   /* set after initial USER failure, to prevent an authentication loop */
   bool ftp_trying_alternative;
 
   bool expect100header;  /* TRUE if we added Expect: 100-continue */
 
   bool pipe_broke; /* TRUE if the connection we were pipelined on broke
                       and we need to restart from the beginning */
-  bool cancelled; /* TRUE if the request was cancelled */
 
 #ifndef WIN32
 /* do FTP line-end conversions on most platforms */
 #define CURL_DO_LINEEND_CONV
   /* for FTP downloads: track CRLF sequences that span blocks */
   bool prev_block_had_trailing_cr;
   /* for FTP downloads: how many CRLFs did we converted to LFs? */
   curl_off_t crlf_conversions;
 #endif
   /* If set to non-NULL, there's a connection in a shared connection cache
      that uses this handle so we can't kill this SessionHandle just yet but
      must keep it around and add it to the list of handles to kill once all
      its connections are gone */
   void *shared_conn;
   bool closed; /* set to TRUE when curl_easy_cleanup() has been called on this
                   handle, but it is kept around as mentioned for
                   shared_conn */
   char *pathbuffer;/* allocated buffer to store the URL's path part in */
   char *path;      /* path to use, points to somewhere within the pathbuffer
                       area */
