Skip to content
http.c 65.3 KiB
Newer Older
            /* if not HTTP 1.0 or disabled explicitly, we add a Expect:
               100-continue to the headers which actually speeds up post
               operations (as there is one packet coming back from the web
               server) */
Daniel Stenberg's avatar
Daniel Stenberg committed
            add_bufferf(req_buffer,
                        "Expect: 100-continue\r\n");
            data->set.expect100header = TRUE;
          }

          add_buffer(req_buffer, "\r\n", 2); /* end of headers! */
Daniel Stenberg's avatar
Daniel Stenberg committed
        add_buffer(req_buffer, "\r\n", 2); /* end of headers! */

        if(data->set.postfieldsize) {
          /* set the upload size to the progress meter */
          Curl_pgrsSetUploadSize(data, postsize?postsize:-1);
          /* set the pointer to mark that we will send the post body using
             the read callback */
          http->postdata = (char *)&http->postdata;
        }
      result = add_buffer_send(req_buffer, conn,
                               &data->info.request_size);

      if(result)
        failf(data, "Failed sending HTTP POST request");
          Curl_Transfer(conn, FIRSTSOCKET, -1, TRUE,
                        http->postdata?&http->writebytecount:NULL);
    default:
      add_buffer(req_buffer, "\r\n", 2);
      /* issue the request */
      result = add_buffer_send(req_buffer, conn,
      if(result)
        failf(data, "Failed sending HTTP request");
      else
        /* HTTP GET/HEAD download: */
        result = Curl_Transfer(conn, FIRSTSOCKET, -1, TRUE,
                               http->postdata?&http->writebytecount:NULL);
Daniel Stenberg's avatar
Daniel Stenberg committed
    if(result)
      return result;
Daniel Stenberg's avatar
Daniel Stenberg committed

  return CURLE_OK;
Daniel Stenberg's avatar
Daniel Stenberg committed
}