Curl_setup_transfer: no longer returns anything
This function could only return CURLE_OK and by changing it to a void instead, we can simplify code all over.
This commit is contained in:
parent
93981bb9b5
commit
c0111460b0
31
lib/dict.c
31
lib/dict.c
@ -5,7 +5,7 @@
|
|||||||
* | (__| |_| | _ <| |___
|
* | (__| |_| | _ <| |___
|
||||||
* \___|\___/|_| \_\_____|
|
* \___|\___/|_| \_\_____|
|
||||||
*
|
*
|
||||||
* Copyright (C) 1998 - 2009, Daniel Stenberg, <daniel@haxx.se>, et al.
|
* Copyright (C) 1998 - 2010, Daniel Stenberg, <daniel@haxx.se>, et al.
|
||||||
*
|
*
|
||||||
* This software is licensed as described in the file COPYING, which
|
* This software is licensed as described in the file COPYING, which
|
||||||
* you should have received as part of this distribution. The terms
|
* you should have received as part of this distribution. The terms
|
||||||
@ -217,13 +217,12 @@ static CURLcode dict_do(struct connectdata *conn, bool *done)
|
|||||||
|
|
||||||
free(eword);
|
free(eword);
|
||||||
|
|
||||||
if(result)
|
if(result) {
|
||||||
failf(data, "Failed sending DICT request");
|
failf(data, "Failed sending DICT request");
|
||||||
else
|
|
||||||
result = Curl_setup_transfer(conn, FIRSTSOCKET, -1, FALSE, bytecount,
|
|
||||||
-1, NULL); /* no upload */
|
|
||||||
if(result)
|
|
||||||
return result;
|
return result;
|
||||||
|
}
|
||||||
|
Curl_setup_transfer(conn, FIRSTSOCKET, -1, FALSE, bytecount,
|
||||||
|
-1, NULL); /* no upload */
|
||||||
}
|
}
|
||||||
else if(Curl_raw_nequal(path, DICT_DEFINE, sizeof(DICT_DEFINE)-1) ||
|
else if(Curl_raw_nequal(path, DICT_DEFINE, sizeof(DICT_DEFINE)-1) ||
|
||||||
Curl_raw_nequal(path, DICT_DEFINE2, sizeof(DICT_DEFINE2)-1) ||
|
Curl_raw_nequal(path, DICT_DEFINE2, sizeof(DICT_DEFINE2)-1) ||
|
||||||
@ -265,15 +264,12 @@ static CURLcode dict_do(struct connectdata *conn, bool *done)
|
|||||||
|
|
||||||
free(eword);
|
free(eword);
|
||||||
|
|
||||||
if(result)
|
if(result) {
|
||||||
failf(data, "Failed sending DICT request");
|
failf(data, "Failed sending DICT request");
|
||||||
else
|
|
||||||
result = Curl_setup_transfer(conn, FIRSTSOCKET, -1, FALSE, bytecount,
|
|
||||||
-1, NULL); /* no upload */
|
|
||||||
|
|
||||||
if(result)
|
|
||||||
return result;
|
return result;
|
||||||
|
}
|
||||||
|
Curl_setup_transfer(conn, FIRSTSOCKET, -1, FALSE, bytecount,
|
||||||
|
-1, NULL); /* no upload */
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
|
||||||
@ -290,13 +286,12 @@ static CURLcode dict_do(struct connectdata *conn, bool *done)
|
|||||||
"CLIENT " LIBCURL_NAME " " LIBCURL_VERSION "\r\n"
|
"CLIENT " LIBCURL_NAME " " LIBCURL_VERSION "\r\n"
|
||||||
"%s\r\n"
|
"%s\r\n"
|
||||||
"QUIT\r\n", ppath);
|
"QUIT\r\n", ppath);
|
||||||
if(result)
|
if(result) {
|
||||||
failf(data, "Failed sending DICT request");
|
failf(data, "Failed sending DICT request");
|
||||||
else
|
|
||||||
result = Curl_setup_transfer(conn, FIRSTSOCKET, -1, FALSE, bytecount,
|
|
||||||
-1, NULL);
|
|
||||||
if(result)
|
|
||||||
return result;
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
Curl_setup_transfer(conn, FIRSTSOCKET, -1, FALSE, bytecount, -1, NULL);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
19
lib/ftp.c
19
lib/ftp.c
@ -1378,7 +1378,7 @@ static CURLcode ftp_state_ul_setup(struct connectdata *conn,
|
|||||||
infof(data, "File already completely uploaded\n");
|
infof(data, "File already completely uploaded\n");
|
||||||
|
|
||||||
/* no data to transfer */
|
/* no data to transfer */
|
||||||
result=Curl_setup_transfer(conn, -1, -1, FALSE, NULL, -1, NULL);
|
Curl_setup_transfer(conn, -1, -1, FALSE, NULL, -1, NULL);
|
||||||
|
|
||||||
/* Set ->transfer so that we won't get any error in
|
/* Set ->transfer so that we won't get any error in
|
||||||
* ftp_done() because we didn't transfer anything! */
|
* ftp_done() because we didn't transfer anything! */
|
||||||
@ -1974,7 +1974,7 @@ static CURLcode ftp_state_post_retr_size(struct connectdata *conn,
|
|||||||
|
|
||||||
if(ftp->downloadsize == 0) {
|
if(ftp->downloadsize == 0) {
|
||||||
/* no data to transfer */
|
/* no data to transfer */
|
||||||
result = Curl_setup_transfer(conn, -1, -1, FALSE, NULL, -1, NULL);
|
Curl_setup_transfer(conn, -1, -1, FALSE, NULL, -1, NULL);
|
||||||
infof(data, "File already completely downloaded\n");
|
infof(data, "File already completely downloaded\n");
|
||||||
|
|
||||||
/* Set ->transfer so that we won't get any error in ftp_done()
|
/* Set ->transfer so that we won't get any error in ftp_done()
|
||||||
@ -2116,8 +2116,8 @@ static CURLcode ftp_state_stor_resp(struct connectdata *conn,
|
|||||||
/* set the SO_SNDBUF for the secondary socket for those who need it */
|
/* set the SO_SNDBUF for the secondary socket for those who need it */
|
||||||
Curl_sndbufset(conn->sock[SECONDARYSOCKET]);
|
Curl_sndbufset(conn->sock[SECONDARYSOCKET]);
|
||||||
|
|
||||||
result = Curl_setup_transfer(conn, -1, -1, FALSE, NULL, /* no download */
|
Curl_setup_transfer(conn, -1, -1, FALSE, NULL, /* no download */
|
||||||
SECONDARYSOCKET, ftp->bytecountp);
|
SECONDARYSOCKET, ftp->bytecountp);
|
||||||
state(conn, FTP_STOP);
|
state(conn, FTP_STOP);
|
||||||
|
|
||||||
conn->proto.ftpc.pp.pending_resp = TRUE; /* expect a server response */
|
conn->proto.ftpc.pp.pending_resp = TRUE; /* expect a server response */
|
||||||
@ -2230,11 +2230,8 @@ static CURLcode ftp_state_get_resp(struct connectdata *conn,
|
|||||||
infof(data, "Getting file with size: %" FORMAT_OFF_T "\n", size);
|
infof(data, "Getting file with size: %" FORMAT_OFF_T "\n", size);
|
||||||
|
|
||||||
/* FTP download: */
|
/* FTP download: */
|
||||||
result=Curl_setup_transfer(conn, SECONDARYSOCKET, size, FALSE,
|
Curl_setup_transfer(conn, SECONDARYSOCKET, size, FALSE,
|
||||||
ftp->bytecountp,
|
ftp->bytecountp, -1, NULL); /* no upload here */
|
||||||
-1, NULL); /* no upload here */
|
|
||||||
if(result)
|
|
||||||
return result;
|
|
||||||
|
|
||||||
conn->proto.ftpc.pp.pending_resp = TRUE; /* expect server response */
|
conn->proto.ftpc.pp.pending_resp = TRUE; /* expect server response */
|
||||||
state(conn, FTP_STOP);
|
state(conn, FTP_STOP);
|
||||||
@ -3391,7 +3388,7 @@ static CURLcode ftp_nextconnect(struct connectdata *conn)
|
|||||||
if((result == CURLE_OK) && (ftp->transfer != FTPTRANSFER_BODY))
|
if((result == CURLE_OK) && (ftp->transfer != FTPTRANSFER_BODY))
|
||||||
/* no data to transfer. FIX: it feels like a kludge to have this here
|
/* no data to transfer. FIX: it feels like a kludge to have this here
|
||||||
too! */
|
too! */
|
||||||
result = Curl_setup_transfer(conn, -1, -1, FALSE, NULL, -1, NULL);
|
Curl_setup_transfer(conn, -1, -1, FALSE, NULL, -1, NULL);
|
||||||
|
|
||||||
/* end of transfer */
|
/* end of transfer */
|
||||||
DEBUGF(infof(data, "DO-MORE phase ends with %d\n", (int)result));
|
DEBUGF(infof(data, "DO-MORE phase ends with %d\n", (int)result));
|
||||||
@ -3818,7 +3815,7 @@ static CURLcode ftp_dophase_done(struct connectdata *conn,
|
|||||||
|
|
||||||
if(ftp->transfer != FTPTRANSFER_BODY)
|
if(ftp->transfer != FTPTRANSFER_BODY)
|
||||||
/* no data to transfer */
|
/* no data to transfer */
|
||||||
result=Curl_setup_transfer(conn, -1, -1, FALSE, NULL, -1, NULL);
|
Curl_setup_transfer(conn, -1, -1, FALSE, NULL, -1, NULL);
|
||||||
else if(!connected)
|
else if(!connected)
|
||||||
/* since we didn't connect now, we want do_more to get called */
|
/* since we didn't connect now, we want do_more to get called */
|
||||||
conn->bits.do_more = TRUE;
|
conn->bits.do_more = TRUE;
|
||||||
|
36
lib/http.c
36
lib/http.c
@ -2653,14 +2653,13 @@ CURLcode Curl_http(struct connectdata *conn, bool *done)
|
|||||||
return result;
|
return result;
|
||||||
|
|
||||||
result = Curl_add_buffer_send(req_buffer, conn,
|
result = Curl_add_buffer_send(req_buffer, conn,
|
||||||
&data->info.request_size, 0, FIRSTSOCKET);
|
&data->info.request_size, 0, FIRSTSOCKET);
|
||||||
if(result)
|
if(result)
|
||||||
failf(data, "Failed sending POST request");
|
failf(data, "Failed sending POST request");
|
||||||
else
|
else
|
||||||
/* setup variables for the upcoming transfer */
|
/* setup variables for the upcoming transfer */
|
||||||
result = Curl_setup_transfer(conn, FIRSTSOCKET, -1, TRUE,
|
Curl_setup_transfer(conn, FIRSTSOCKET, -1, TRUE, &http->readbytecount,
|
||||||
&http->readbytecount,
|
-1, NULL);
|
||||||
-1, NULL);
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2728,10 +2727,9 @@ CURLcode Curl_http(struct connectdata *conn, bool *done)
|
|||||||
failf(data, "Failed sending POST request");
|
failf(data, "Failed sending POST request");
|
||||||
else
|
else
|
||||||
/* setup variables for the upcoming transfer */
|
/* setup variables for the upcoming transfer */
|
||||||
result = Curl_setup_transfer(conn, FIRSTSOCKET, -1, TRUE,
|
Curl_setup_transfer(conn, FIRSTSOCKET, -1, TRUE,
|
||||||
&http->readbytecount,
|
&http->readbytecount, FIRSTSOCKET,
|
||||||
FIRSTSOCKET,
|
&http->writebytecount);
|
||||||
&http->writebytecount);
|
|
||||||
|
|
||||||
if(result) {
|
if(result) {
|
||||||
Curl_formclean(&http->sendit); /* free that whole lot */
|
Curl_formclean(&http->sendit); /* free that whole lot */
|
||||||
@ -2781,10 +2779,9 @@ CURLcode Curl_http(struct connectdata *conn, bool *done)
|
|||||||
failf(data, "Failed sending PUT request");
|
failf(data, "Failed sending PUT request");
|
||||||
else
|
else
|
||||||
/* prepare for transfer */
|
/* prepare for transfer */
|
||||||
result = Curl_setup_transfer(conn, FIRSTSOCKET, -1, TRUE,
|
Curl_setup_transfer(conn, FIRSTSOCKET, -1, TRUE,
|
||||||
&http->readbytecount,
|
&http->readbytecount, postsize?FIRSTSOCKET:-1,
|
||||||
postsize?FIRSTSOCKET:-1,
|
postsize?&http->writebytecount:NULL);
|
||||||
postsize?&http->writebytecount:NULL);
|
|
||||||
if(result)
|
if(result)
|
||||||
return result;
|
return result;
|
||||||
break;
|
break;
|
||||||
@ -2931,11 +2928,9 @@ CURLcode Curl_http(struct connectdata *conn, bool *done)
|
|||||||
if(result)
|
if(result)
|
||||||
failf(data, "Failed sending HTTP POST request");
|
failf(data, "Failed sending HTTP POST request");
|
||||||
else
|
else
|
||||||
result =
|
Curl_setup_transfer(conn, FIRSTSOCKET, -1, TRUE,
|
||||||
Curl_setup_transfer(conn, FIRSTSOCKET, -1, TRUE,
|
&http->readbytecount, http->postdata?FIRSTSOCKET:-1,
|
||||||
&http->readbytecount,
|
http->postdata?&http->writebytecount:NULL);
|
||||||
http->postdata?FIRSTSOCKET:-1,
|
|
||||||
http->postdata?&http->writebytecount:NULL);
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
@ -2951,10 +2946,9 @@ CURLcode Curl_http(struct connectdata *conn, bool *done)
|
|||||||
failf(data, "Failed sending HTTP request");
|
failf(data, "Failed sending HTTP request");
|
||||||
else
|
else
|
||||||
/* HTTP GET/HEAD download: */
|
/* HTTP GET/HEAD download: */
|
||||||
result = Curl_setup_transfer(conn, FIRSTSOCKET, -1, TRUE,
|
Curl_setup_transfer(conn, FIRSTSOCKET, -1, TRUE, &http->readbytecount,
|
||||||
&http->readbytecount,
|
http->postdata?FIRSTSOCKET:-1,
|
||||||
http->postdata?FIRSTSOCKET:-1,
|
http->postdata?&http->writebytecount:NULL);
|
||||||
http->postdata?&http->writebytecount:NULL);
|
|
||||||
}
|
}
|
||||||
if(result)
|
if(result)
|
||||||
return result;
|
return result;
|
||||||
|
12
lib/imap.c
12
lib/imap.c
@ -436,12 +436,11 @@ static CURLcode imap_state_fetch_resp(struct connectdata *conn,
|
|||||||
|
|
||||||
if(!filesize)
|
if(!filesize)
|
||||||
/* the entire data is already transfered! */
|
/* the entire data is already transfered! */
|
||||||
result=Curl_setup_transfer(conn, -1, -1, FALSE, NULL, -1, NULL);
|
Curl_setup_transfer(conn, -1, -1, FALSE, NULL, -1, NULL);
|
||||||
else
|
else
|
||||||
/* IMAP download */
|
/* IMAP download */
|
||||||
result=Curl_setup_transfer(conn, FIRSTSOCKET, filesize, FALSE,
|
Curl_setup_transfer(conn, FIRSTSOCKET, filesize, FALSE,
|
||||||
imap->bytecountp,
|
imap->bytecountp, -1, NULL); /* no upload here */
|
||||||
-1, NULL); /* no upload here */
|
|
||||||
|
|
||||||
data->req.maxdownload = filesize;
|
data->req.maxdownload = filesize;
|
||||||
}
|
}
|
||||||
@ -924,15 +923,14 @@ static CURLcode imap_parse_url_path(struct connectdata *conn)
|
|||||||
static CURLcode imap_dophase_done(struct connectdata *conn,
|
static CURLcode imap_dophase_done(struct connectdata *conn,
|
||||||
bool connected)
|
bool connected)
|
||||||
{
|
{
|
||||||
CURLcode result = CURLE_OK;
|
|
||||||
struct FTP *imap = conn->data->state.proto.imap;
|
struct FTP *imap = conn->data->state.proto.imap;
|
||||||
(void)connected;
|
(void)connected;
|
||||||
|
|
||||||
if(imap->transfer != FTPTRANSFER_BODY)
|
if(imap->transfer != FTPTRANSFER_BODY)
|
||||||
/* no data to transfer */
|
/* no data to transfer */
|
||||||
result=Curl_setup_transfer(conn, -1, -1, FALSE, NULL, -1, NULL);
|
Curl_setup_transfer(conn, -1, -1, FALSE, NULL, -1, NULL);
|
||||||
|
|
||||||
return result;
|
return CURLE_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* called from multi.c while DOing */
|
/* called from multi.c while DOing */
|
||||||
|
17
lib/pop3.c
17
lib/pop3.c
@ -359,9 +359,8 @@ static CURLcode pop3_state_retr_resp(struct connectdata *conn,
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* POP3 download */
|
/* POP3 download */
|
||||||
result=Curl_setup_transfer(conn, FIRSTSOCKET, -1, FALSE,
|
Curl_setup_transfer(conn, FIRSTSOCKET, -1, FALSE,
|
||||||
pop3->bytecountp,
|
pop3->bytecountp, -1, NULL); /* no upload here */
|
||||||
-1, NULL); /* no upload here */
|
|
||||||
|
|
||||||
if(pp->cache) {
|
if(pp->cache) {
|
||||||
/* At this point there is a bunch of data in the header "cache" that is
|
/* At this point there is a bunch of data in the header "cache" that is
|
||||||
@ -403,9 +402,8 @@ static CURLcode pop3_state_list_resp(struct connectdata *conn,
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* POP3 download */
|
/* POP3 download */
|
||||||
result=Curl_setup_transfer(conn, FIRSTSOCKET, -1, FALSE,
|
Curl_setup_transfer(conn, FIRSTSOCKET, -1, FALSE, pop3->bytecountp,
|
||||||
pop3->bytecountp,
|
-1, NULL); /* no upload here */
|
||||||
-1, NULL); /* no upload here */
|
|
||||||
|
|
||||||
if(pp->cache) {
|
if(pp->cache) {
|
||||||
/* cache holds the email ID listing */
|
/* cache holds the email ID listing */
|
||||||
@ -863,18 +861,17 @@ static CURLcode pop3_parse_url_path(struct connectdata *conn)
|
|||||||
static CURLcode pop3_dophase_done(struct connectdata *conn,
|
static CURLcode pop3_dophase_done(struct connectdata *conn,
|
||||||
bool connected)
|
bool connected)
|
||||||
{
|
{
|
||||||
CURLcode result = CURLE_OK;
|
|
||||||
struct FTP *pop3 = conn->data->state.proto.pop3;
|
struct FTP *pop3 = conn->data->state.proto.pop3;
|
||||||
struct pop3_conn *pop3c = &conn->proto.pop3c;
|
struct pop3_conn *pop3c = &conn->proto.pop3c;
|
||||||
(void)connected;
|
(void)connected;
|
||||||
|
|
||||||
if(pop3->transfer != FTPTRANSFER_BODY)
|
if(pop3->transfer != FTPTRANSFER_BODY)
|
||||||
/* no data to transfer */
|
/* no data to transfer */
|
||||||
result=Curl_setup_transfer(conn, -1, -1, FALSE, NULL, -1, NULL);
|
Curl_setup_transfer(conn, -1, -1, FALSE, NULL, -1, NULL);
|
||||||
|
|
||||||
free(pop3c->mailbox);
|
free(pop3c->mailbox);
|
||||||
|
|
||||||
return result;
|
return CURLE_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* called from multi.c while DOing */
|
/* called from multi.c while DOing */
|
||||||
|
16
lib/rtsp.c
16
lib/rtsp.c
@ -254,8 +254,8 @@ CURLcode Curl_rtsp(struct connectdata *conn, bool *done)
|
|||||||
}
|
}
|
||||||
|
|
||||||
if(rtspreq == RTSPREQ_RECEIVE) {
|
if(rtspreq == RTSPREQ_RECEIVE) {
|
||||||
result = Curl_setup_transfer(conn, FIRSTSOCKET, -1, TRUE,
|
Curl_setup_transfer(conn, FIRSTSOCKET, -1, TRUE,
|
||||||
&http->readbytecount, -1, NULL);
|
&http->readbytecount, -1, NULL);
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
@ -503,15 +503,9 @@ CURLcode Curl_rtsp(struct connectdata *conn, bool *done)
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
result = Curl_setup_transfer(conn, FIRSTSOCKET, -1, TRUE,
|
Curl_setup_transfer(conn, FIRSTSOCKET, -1, TRUE, &http->readbytecount,
|
||||||
&http->readbytecount,
|
putsize?FIRSTSOCKET:-1,
|
||||||
putsize?FIRSTSOCKET:-1,
|
putsize?&http->writebytecount:NULL);
|
||||||
putsize?&http->writebytecount:NULL);
|
|
||||||
|
|
||||||
if(result) {
|
|
||||||
failf(data, "Failed RTSP transfer");
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Increment the CSeq on success */
|
/* Increment the CSeq on success */
|
||||||
data->state.rtsp_next_client_CSeq++;
|
data->state.rtsp_next_client_CSeq++;
|
||||||
|
12
lib/smtp.c
12
lib/smtp.c
@ -465,7 +465,6 @@ static CURLcode smtp_state_data_resp(struct connectdata *conn,
|
|||||||
int smtpcode,
|
int smtpcode,
|
||||||
smtpstate instate)
|
smtpstate instate)
|
||||||
{
|
{
|
||||||
CURLcode result = CURLE_OK;
|
|
||||||
struct SessionHandle *data = conn->data;
|
struct SessionHandle *data = conn->data;
|
||||||
struct FTP *smtp = data->state.proto.smtp;
|
struct FTP *smtp = data->state.proto.smtp;
|
||||||
|
|
||||||
@ -477,11 +476,11 @@ static CURLcode smtp_state_data_resp(struct connectdata *conn,
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* SMTP upload */
|
/* SMTP upload */
|
||||||
result = Curl_setup_transfer(conn, -1, -1, FALSE, NULL, /* no download */
|
Curl_setup_transfer(conn, -1, -1, FALSE, NULL, /* no download */
|
||||||
FIRSTSOCKET, smtp->bytecountp);
|
FIRSTSOCKET, smtp->bytecountp);
|
||||||
|
|
||||||
state(conn, SMTP_STOP);
|
state(conn, SMTP_STOP);
|
||||||
return result;
|
return CURLE_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* for the POSTDATA response, which is received after the entire DATA
|
/* for the POSTDATA response, which is received after the entire DATA
|
||||||
@ -934,18 +933,17 @@ static CURLcode smtp_disconnect(struct connectdata *conn)
|
|||||||
static CURLcode smtp_dophase_done(struct connectdata *conn,
|
static CURLcode smtp_dophase_done(struct connectdata *conn,
|
||||||
bool connected)
|
bool connected)
|
||||||
{
|
{
|
||||||
CURLcode result = CURLE_OK;
|
|
||||||
struct FTP *smtp = conn->data->state.proto.smtp;
|
struct FTP *smtp = conn->data->state.proto.smtp;
|
||||||
struct smtp_conn *smtpc= &conn->proto.smtpc;
|
struct smtp_conn *smtpc= &conn->proto.smtpc;
|
||||||
(void)connected;
|
(void)connected;
|
||||||
|
|
||||||
if(smtp->transfer != FTPTRANSFER_BODY)
|
if(smtp->transfer != FTPTRANSFER_BODY)
|
||||||
/* no data to transfer */
|
/* no data to transfer */
|
||||||
result=Curl_setup_transfer(conn, -1, -1, FALSE, NULL, -1, NULL);
|
Curl_setup_transfer(conn, -1, -1, FALSE, NULL, -1, NULL);
|
||||||
|
|
||||||
free(smtpc->domain);
|
free(smtpc->domain);
|
||||||
|
|
||||||
return result;
|
return CURLE_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* called from multi.c while DOing */
|
/* called from multi.c while DOing */
|
||||||
|
18
lib/ssh.c
18
lib/ssh.c
@ -1556,8 +1556,7 @@ static CURLcode ssh_statemach_act(struct connectdata *conn, bool *block)
|
|||||||
Curl_pgrsSetUploadSize(data, data->set.infilesize);
|
Curl_pgrsSetUploadSize(data, data->set.infilesize);
|
||||||
}
|
}
|
||||||
/* upload data */
|
/* upload data */
|
||||||
result = Curl_setup_transfer(conn, -1, -1, FALSE, NULL,
|
Curl_setup_transfer(conn, -1, -1, FALSE, NULL, FIRSTSOCKET, NULL);
|
||||||
FIRSTSOCKET, NULL);
|
|
||||||
|
|
||||||
/* not set by Curl_setup_transfer to preserve keepon bits */
|
/* not set by Curl_setup_transfer to preserve keepon bits */
|
||||||
conn->sockfd = conn->writesockfd;
|
conn->sockfd = conn->writesockfd;
|
||||||
@ -1850,7 +1849,7 @@ static CURLcode ssh_statemach_act(struct connectdata *conn, bool *block)
|
|||||||
sshc->readdir_longentry = NULL;
|
sshc->readdir_longentry = NULL;
|
||||||
|
|
||||||
/* no data to transfer */
|
/* no data to transfer */
|
||||||
result = Curl_setup_transfer(conn, -1, -1, FALSE, NULL, -1, NULL);
|
Curl_setup_transfer(conn, -1, -1, FALSE, NULL, -1, NULL);
|
||||||
state(conn, SSH_STOP);
|
state(conn, SSH_STOP);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
@ -1975,14 +1974,14 @@ static CURLcode ssh_statemach_act(struct connectdata *conn, bool *block)
|
|||||||
/* Setup the actual download */
|
/* Setup the actual download */
|
||||||
if(data->req.size == 0) {
|
if(data->req.size == 0) {
|
||||||
/* no data to transfer */
|
/* no data to transfer */
|
||||||
result = Curl_setup_transfer(conn, -1, -1, FALSE, NULL, -1, NULL);
|
Curl_setup_transfer(conn, -1, -1, FALSE, NULL, -1, NULL);
|
||||||
infof(data, "File already completely downloaded\n");
|
infof(data, "File already completely downloaded\n");
|
||||||
state(conn, SSH_STOP);
|
state(conn, SSH_STOP);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
result = Curl_setup_transfer(conn, FIRSTSOCKET, data->req.size,
|
Curl_setup_transfer(conn, FIRSTSOCKET, data->req.size,
|
||||||
FALSE, NULL, -1, NULL);
|
FALSE, NULL, -1, NULL);
|
||||||
|
|
||||||
/* not set by Curl_setup_transfer to preserve keepon bits */
|
/* not set by Curl_setup_transfer to preserve keepon bits */
|
||||||
conn->writesockfd = conn->sockfd;
|
conn->writesockfd = conn->sockfd;
|
||||||
@ -2107,8 +2106,8 @@ static CURLcode ssh_statemach_act(struct connectdata *conn, bool *block)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* upload data */
|
/* upload data */
|
||||||
result = Curl_setup_transfer(conn, -1, data->req.size, FALSE, NULL,
|
Curl_setup_transfer(conn, -1, data->req.size, FALSE, NULL,
|
||||||
FIRSTSOCKET, NULL);
|
FIRSTSOCKET, NULL);
|
||||||
|
|
||||||
/* not set by Curl_setup_transfer to preserve keepon bits */
|
/* not set by Curl_setup_transfer to preserve keepon bits */
|
||||||
conn->sockfd = conn->writesockfd;
|
conn->sockfd = conn->writesockfd;
|
||||||
@ -2159,8 +2158,7 @@ static CURLcode ssh_statemach_act(struct connectdata *conn, bool *block)
|
|||||||
/* download data */
|
/* download data */
|
||||||
bytecount = (curl_off_t)sb.st_size;
|
bytecount = (curl_off_t)sb.st_size;
|
||||||
data->req.maxdownload = (curl_off_t)sb.st_size;
|
data->req.maxdownload = (curl_off_t)sb.st_size;
|
||||||
result = Curl_setup_transfer(conn, FIRSTSOCKET,
|
Curl_setup_transfer(conn, FIRSTSOCKET, bytecount, FALSE, NULL, -1, NULL);
|
||||||
bytecount, FALSE, NULL, -1, NULL);
|
|
||||||
|
|
||||||
/* not set by Curl_setup_transfer to preserve keepon bits */
|
/* not set by Curl_setup_transfer to preserve keepon bits */
|
||||||
conn->writesockfd = conn->sockfd;
|
conn->writesockfd = conn->sockfd;
|
||||||
|
13
lib/tftp.c
13
lib/tftp.c
@ -797,10 +797,9 @@ static CURLcode tftp_tx(tftp_state_data_t *state, tftp_event_t event)
|
|||||||
state->state = TFTP_STATE_FIN;
|
state->state = TFTP_STATE_FIN;
|
||||||
setpacketevent(&state->spacket, TFTP_EVENT_ERROR);
|
setpacketevent(&state->spacket, TFTP_EVENT_ERROR);
|
||||||
setpacketblock(&state->spacket, state->block);
|
setpacketblock(&state->spacket, state->block);
|
||||||
sbytes = sendto(state->sockfd, (void *)state->spacket.data,
|
(void)sendto(state->sockfd, (void *)state->spacket.data, 4, SEND_4TH_ARG,
|
||||||
4, SEND_4TH_ARG,
|
(struct sockaddr *)&state->remote_addr,
|
||||||
(struct sockaddr *)&state->remote_addr,
|
state->remote_addrlen);
|
||||||
state->remote_addrlen);
|
|
||||||
/* don't bother with the return code, but if the socket is still up we
|
/* don't bother with the return code, but if the socket is still up we
|
||||||
* should be a good TFTP client and let the server know we're done */
|
* should be a good TFTP client and let the server know we're done */
|
||||||
state->state = TFTP_STATE_FIN;
|
state->state = TFTP_STATE_FIN;
|
||||||
@ -1295,7 +1294,7 @@ static CURLcode tftp_easy_statemach(struct connectdata *conn)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* Tell curl we're done */
|
/* Tell curl we're done */
|
||||||
result = Curl_setup_transfer(conn, -1, -1, FALSE, NULL, -1, NULL);
|
Curl_setup_transfer(conn, -1, -1, FALSE, NULL, -1, NULL);
|
||||||
|
|
||||||
return(result);
|
return(result);
|
||||||
}
|
}
|
||||||
@ -1329,7 +1328,7 @@ static CURLcode tftp_multi_statemach(struct connectdata *conn, bool *done)
|
|||||||
*done = (bool)(state->state == TFTP_STATE_FIN);
|
*done = (bool)(state->state == TFTP_STATE_FIN);
|
||||||
if(*done)
|
if(*done)
|
||||||
/* Tell curl we're done */
|
/* Tell curl we're done */
|
||||||
result = Curl_setup_transfer(conn, -1, -1, FALSE, NULL, -1, NULL);
|
Curl_setup_transfer(conn, -1, -1, FALSE, NULL, -1, NULL);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
/* no timeouts to handle, check our socket */
|
/* no timeouts to handle, check our socket */
|
||||||
@ -1351,7 +1350,7 @@ static CURLcode tftp_multi_statemach(struct connectdata *conn, bool *done)
|
|||||||
*done = (bool)(state->state == TFTP_STATE_FIN);
|
*done = (bool)(state->state == TFTP_STATE_FIN);
|
||||||
if(*done)
|
if(*done)
|
||||||
/* Tell curl we're done */
|
/* Tell curl we're done */
|
||||||
result = Curl_setup_transfer(conn, -1, -1, FALSE, NULL, -1, NULL);
|
Curl_setup_transfer(conn, -1, -1, FALSE, NULL, -1, NULL);
|
||||||
}
|
}
|
||||||
/* if rc == 0, then select() timed out */
|
/* if rc == 0, then select() timed out */
|
||||||
}
|
}
|
||||||
|
@ -2169,7 +2169,7 @@ CURLcode Curl_perform(struct SessionHandle *data)
|
|||||||
* Curl_setup_transfer() is called to setup some basic properties for the
|
* Curl_setup_transfer() is called to setup some basic properties for the
|
||||||
* upcoming transfer.
|
* upcoming transfer.
|
||||||
*/
|
*/
|
||||||
CURLcode
|
void
|
||||||
Curl_setup_transfer(
|
Curl_setup_transfer(
|
||||||
struct connectdata *conn, /* connection data */
|
struct connectdata *conn, /* connection data */
|
||||||
int sockindex, /* socket index to read from or -1 */
|
int sockindex, /* socket index to read from or -1 */
|
||||||
@ -2214,9 +2214,8 @@ Curl_setup_transfer(
|
|||||||
/* we want header and/or body, if neither then don't do this! */
|
/* we want header and/or body, if neither then don't do this! */
|
||||||
if(k->getheader || !data->set.opt_no_body) {
|
if(k->getheader || !data->set.opt_no_body) {
|
||||||
|
|
||||||
if(conn->sockfd != CURL_SOCKET_BAD) {
|
if(conn->sockfd != CURL_SOCKET_BAD)
|
||||||
k->keepon |= KEEP_RECV;
|
k->keepon |= KEEP_RECV;
|
||||||
}
|
|
||||||
|
|
||||||
if(conn->writesockfd != CURL_SOCKET_BAD) {
|
if(conn->writesockfd != CURL_SOCKET_BAD) {
|
||||||
/* HTTP 1.1 magic:
|
/* HTTP 1.1 magic:
|
||||||
@ -2246,5 +2245,4 @@ Curl_setup_transfer(
|
|||||||
} /* if(conn->writesockfd != CURL_SOCKET_BAD) */
|
} /* if(conn->writesockfd != CURL_SOCKET_BAD) */
|
||||||
} /* if(k->getheader || !data->set.opt_no_body) */
|
} /* if(k->getheader || !data->set.opt_no_body) */
|
||||||
|
|
||||||
return CURLE_OK;
|
|
||||||
}
|
}
|
||||||
|
@ -7,7 +7,7 @@
|
|||||||
* | (__| |_| | _ <| |___
|
* | (__| |_| | _ <| |___
|
||||||
* \___|\___/|_| \_\_____|
|
* \___|\___/|_| \_\_____|
|
||||||
*
|
*
|
||||||
* Copyright (C) 1998 - 2009, Daniel Stenberg, <daniel@haxx.se>, et al.
|
* Copyright (C) 1998 - 2010, Daniel Stenberg, <daniel@haxx.se>, et al.
|
||||||
*
|
*
|
||||||
* This software is licensed as described in the file COPYING, which
|
* This software is licensed as described in the file COPYING, which
|
||||||
* you should have received as part of this distribution. The terms
|
* you should have received as part of this distribution. The terms
|
||||||
@ -49,7 +49,7 @@ CURLcode Curl_reconnect_request(struct connectdata **connp);
|
|||||||
CURLcode Curl_retry_request(struct connectdata *conn, char **url);
|
CURLcode Curl_retry_request(struct connectdata *conn, char **url);
|
||||||
|
|
||||||
/* This sets up a forthcoming transfer */
|
/* This sets up a forthcoming transfer */
|
||||||
CURLcode
|
void
|
||||||
Curl_setup_transfer (struct connectdata *data,
|
Curl_setup_transfer (struct connectdata *data,
|
||||||
int sockindex, /* socket index to read from or -1 */
|
int sockindex, /* socket index to read from or -1 */
|
||||||
curl_off_t size, /* -1 if unknown at this point */
|
curl_off_t size, /* -1 if unknown at this point */
|
||||||
|
@ -4779,9 +4779,8 @@ static CURLcode create_conn(struct SessionHandle *data,
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
result = Curl_setup_transfer(conn, -1, -1, FALSE,
|
Curl_setup_transfer(conn, -1, -1, FALSE, NULL, /* no download */
|
||||||
NULL, /* no download */
|
-1, NULL); /* no upload */
|
||||||
-1, NULL); /* no upload */
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user