Skip to content
url.c 153 KiB
Newer Older
  return CURLE_OK;
}

/*
 * do_complete is called when the DO actions are complete.
 *
 * We init chunking and trailer bits to their default values here immediately
 * before receiving any header data for the current request in the pipeline.
 */
static void do_complete(struct connectdata *conn)
{
  conn->data->req.chunk=FALSE;
  conn->data->req.trailerhdrpresent=FALSE;
  conn->data->req.maxfd = (conn->sockfd>conn->writesockfd?
                               conn->sockfd:conn->writesockfd)+1;
CURLcode Curl_do(struct connectdata **connp, bool *done)
  CURLcode result=CURLE_OK;
  struct connectdata *conn = *connp;
  struct SessionHandle *data = conn->data;
  /* setup and init stuff before DO starts, in preparing for the transfer */
  do_init(conn);
    /* generic protocol-specific function pointer set in curl_connect() */
    result = conn->handler->do_it(conn, done);
    /* This was formerly done in transfer.c, but we better do it here */
    if((CURLE_SEND_ERROR == result) && conn->bits.reuse) {
        /*
         * If the connection is using an easy handle, call reconnect
         * to re-establish the connection.  Otherwise, let the multi logic
         * figure out how to re-establish the connection.
         */
        if(!data->multi) {
          result = Curl_reconnect_request(connp);
          if(result == CURLE_OK) {
            /* ... finally back to actually retry the DO phase */
            result = conn->handler->do_it(conn, done);
    if((result == CURLE_OK) && *done)
      /* do_complete must be called after the protocol-specific DO function */
CURLcode Curl_do_more(struct connectdata *conn)
{
  CURLcode result=CURLE_OK;

  if(conn->handler->do_more)
    result = conn->handler->do_more(conn);
  if(result == CURLE_OK)
    /* do_complete must be called after the protocol-specific DO function */
    do_complete(conn);


/* Called on connect, and if there's already a protocol-specific struct
   allocated for a different connection, this frees it that it can be setup
   properly later on. */
void Curl_reset_reqproto(struct connectdata *conn)
{
  struct SessionHandle *data = conn->data;
  if(data->state.proto.generic && data->state.current_conn != conn) {
    free(data->state.proto.generic);
    data->state.proto.generic = NULL;