summaryrefslogtreecommitdiff
path: root/plugins/FTPFileYM/curl/lib/transfer.c
diff options
context:
space:
mode:
authorGeorge Hazan <george.hazan@gmail.com>2013-11-10 21:43:18 +0000
committerGeorge Hazan <george.hazan@gmail.com>2013-11-10 21:43:18 +0000
commit530102b3b16fdc6f008cdf312e5977a878f295db (patch)
tree3159eb3d5712151a33d796b7a0039ae9a4d00e09 /plugins/FTPFileYM/curl/lib/transfer.c
parente40ecc70a7db28bdf78dad5d804e07d08a77159c (diff)
libcurl update
git-svn-id: http://svn.miranda-ng.org/main/trunk@6864 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'plugins/FTPFileYM/curl/lib/transfer.c')
-rw-r--r--plugins/FTPFileYM/curl/lib/transfer.c48
1 files changed, 30 insertions, 18 deletions
diff --git a/plugins/FTPFileYM/curl/lib/transfer.c b/plugins/FTPFileYM/curl/lib/transfer.c
index 330b37a2b1..533e394b6b 100644
--- a/plugins/FTPFileYM/curl/lib/transfer.c
+++ b/plugins/FTPFileYM/curl/lib/transfer.c
@@ -101,11 +101,13 @@ CURLcode Curl_fillreadbuffer(struct connectdata *conn, int bytes, int *nreadp)
#ifdef CURL_DOES_CONVERSIONS
bool sending_http_headers = FALSE;
- if((conn->handler->protocol&(CURLPROTO_HTTP|CURLPROTO_RTSP)) &&
- (data->state.proto.http->sending == HTTPSEND_REQUEST)) {
- /* We're sending the HTTP request headers, not the data.
- Remember that so we don't re-translate them into garbage. */
- sending_http_headers = TRUE;
+ if(conn->handler->protocol&(CURLPROTO_HTTP|CURLPROTO_RTSP)) {
+ const struct HTTP *http = data->req.protop;
+
+ if(http->sending == HTTPSEND_REQUEST)
+ /* We're sending the HTTP request headers, not the data.
+ Remember that so we don't re-translate them into garbage. */
+ sending_http_headers = TRUE;
}
#endif
@@ -473,7 +475,7 @@ static CURLcode readwrite_data(struct SessionHandle *data,
/* We've stopped dealing with input, get out of the do-while loop */
if(nread > 0) {
- if(conn->data->multi && Curl_multi_canPipeline(conn->data->multi)) {
+ if(Curl_multi_pipeline_enabled(conn->data->multi)) {
infof(data,
"Rewinding stream by : %zd"
" bytes on url %s (zero-length body)\n",
@@ -540,6 +542,10 @@ static CURLcode readwrite_data(struct SessionHandle *data,
if(!Curl_meets_timecondition(data, k->timeofdoc)) {
*done = TRUE;
+ /* We're simulating a http 304 from server so we return
+ what should have been returned from the server */
+ data->info.httpcode = 304;
+ infof(data, "Simulate a HTTP 304 response!\n");
/* we abort the transfer before it is completed == we ruin the
re-use ability. Close the connection */
conn->bits.close = TRUE;
@@ -602,8 +608,7 @@ static CURLcode readwrite_data(struct SessionHandle *data,
if(dataleft != 0) {
infof(conn->data, "Leftovers after chunking: %zu bytes\n",
dataleft);
- if(conn->data->multi &&
- Curl_multi_canPipeline(conn->data->multi)) {
+ if(Curl_multi_pipeline_enabled(conn->data->multi)) {
/* only attempt the rewind if we truly are pipelining */
infof(conn->data, "Rewinding %zu bytes\n",dataleft);
read_rewind(conn, dataleft);
@@ -626,7 +631,7 @@ static CURLcode readwrite_data(struct SessionHandle *data,
excess = (size_t)(k->bytecount + nread - k->maxdownload);
if(excess > 0 && !k->ignorebody) {
- if(conn->data->multi && Curl_multi_canPipeline(conn->data->multi)) {
+ if(Curl_multi_pipeline_enabled(conn->data->multi)) {
/* The 'excess' amount below can't be more than BUFSIZE which
always will fit in a size_t */
infof(data,
@@ -811,9 +816,10 @@ static CURLcode readwrite_upload(struct SessionHandle *data,
/* HTTP pollution, this should be written nicer to become more
protocol agnostic. */
int fillcount;
+ struct HTTP *http = data->req.protop;
if((k->exp100 == EXP100_SENDING_REQUEST) &&
- (data->state.proto.http->sending == HTTPSEND_BODY)) {
+ (http->sending == HTTPSEND_BODY)) {
/* If this call is to send body data, we must take some action:
We have sent off the full HTTP 1.1 request, and we shall now
go into the Expect: 100 state and await such a header */
@@ -828,7 +834,7 @@ static CURLcode readwrite_upload(struct SessionHandle *data,
}
if(conn->handler->protocol&(CURLPROTO_HTTP|CURLPROTO_RTSP)) {
- if(data->state.proto.http->sending == HTTPSEND_REQUEST)
+ if(http->sending == HTTPSEND_REQUEST)
/* We're sending the HTTP request headers, not the data.
Remember that so we don't change the line endings. */
sending_http_headers = TRUE;
@@ -1853,7 +1859,7 @@ CURLcode Curl_retry_request(struct connectdata *conn,
data->req.headerbytecount == 0) &&
conn->bits.reuse &&
!data->set.opt_no_body &&
- data->set.rtspreq != RTSPREQ_RECEIVE)) {
+ data->set.rtspreq != RTSPREQ_RECEIVE)) {
/* We got no data, we attempted to re-use a connection and yet we want a
"body". This might happen if the connection was left alive when we were
done using it before, but that was closed when we wanted to read from
@@ -1871,9 +1877,11 @@ CURLcode Curl_retry_request(struct connectdata *conn,
transferred! */
- if((conn->handler->protocol&CURLPROTO_HTTP) &&
- data->state.proto.http->writebytecount)
- return Curl_readrewind(conn);
+ if(conn->handler->protocol&CURLPROTO_HTTP) {
+ struct HTTP *http = data->req.protop;
+ if(http->writebytecount)
+ return Curl_readrewind(conn);
+ }
}
return CURLE_OK;
}
@@ -1931,6 +1939,7 @@ Curl_setup_transfer(
k->keepon |= KEEP_RECV;
if(conn->writesockfd != CURL_SOCKET_BAD) {
+ struct HTTP *http = data->req.protop;
/* HTTP 1.1 magic:
Even if we require a 100-return code before uploading data, we might
@@ -1941,13 +1950,16 @@ Curl_setup_transfer(
state info where we wait for the 100-return code
*/
if((data->state.expect100header) &&
- (data->state.proto.http->sending == HTTPSEND_BODY)) {
+ (conn->handler->protocol&CURLPROTO_HTTP) &&
+ (http->sending == HTTPSEND_BODY)) {
/* wait with write until we either got 100-continue or a timeout */
k->exp100 = EXP100_AWAITING_CONTINUE;
k->start100 = Curl_tvnow();
- /* set a timeout for the multi interface */
- Curl_expire(data, CURL_TIMEOUT_EXPECT_100);
+ /* Set a timeout for the multi interface. Add the inaccuracy margin so
+ that we don't fire slightly too early and get denied to run. */
+ Curl_expire(data, CURL_TIMEOUT_EXPECT_100 +
+ MULTI_TIMEOUT_INACCURACY / 1000);
}
else {
if(data->state.expect100header)