Newer
Older
Daniel Stenberg
committed
/* 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) */
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
committed
}
add_buffer(req_buffer, "\r\n", 2); /* end of headers! */
Daniel Stenberg
committed
if(data->set.postfieldsize) {
/* set the upload size to the progress meter */
Curl_pgrsSetUploadSize(data, postsize?postsize:-1);
Daniel Stenberg
committed
/* set the pointer to mark that we will send the post body using
the read callback */
http->postdata = (char *)&http->postdata;
}
}
/* issue the request */
Daniel Stenberg
committed
result = add_buffer_send(req_buffer, conn,
&data->info.request_size);
if(result)
failf(data, "Failed sending HTTP POST request");
result =
Daniel Stenberg
committed
Curl_Transfer(conn, FIRSTSOCKET, -1, TRUE,
Daniel Stenberg
committed
&http->readbytecount,
Daniel Stenberg
committed
http->postdata?FIRSTSOCKET:-1,
Daniel Stenberg
committed
http->postdata?&http->writebytecount:NULL);
break;
default:
add_buffer(req_buffer, "\r\n", 2);
Daniel Stenberg
committed
result = add_buffer_send(req_buffer, conn,
Daniel Stenberg
committed
&data->info.request_size);
Daniel Stenberg
committed
if(result)
failf(data, "Failed sending HTTP request");
else
/* HTTP GET/HEAD download: */
Daniel Stenberg
committed
result = Curl_Transfer(conn, FIRSTSOCKET, -1, TRUE,
Daniel Stenberg
committed
&http->readbytecount,
Daniel Stenberg
committed
http->postdata?FIRSTSOCKET:-1,
Daniel Stenberg
committed
http->postdata?&http->writebytecount:NULL);
Daniel Stenberg
committed
}