diff --git a/lib/dict.c b/lib/dict.c index 1deab76ec..d86923a9f 100644 --- a/lib/dict.c +++ b/lib/dict.c @@ -5,7 +5,7 @@ * | (__| |_| | _ <| |___ * \___|\___/|_| \_\_____| * - * Copyright (C) 1998 - 2009, Daniel Stenberg, , et al. + * Copyright (C) 1998 - 2010, Daniel Stenberg, , et al. * * This software is licensed as described in the file COPYING, which * 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); - if(result) + if(result) { failf(data, "Failed sending DICT request"); - else - result = Curl_setup_transfer(conn, FIRSTSOCKET, -1, FALSE, bytecount, - -1, NULL); /* no upload */ - if(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) || 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); - if(result) + if(result) { failf(data, "Failed sending DICT request"); - else - result = Curl_setup_transfer(conn, FIRSTSOCKET, -1, FALSE, bytecount, - -1, NULL); /* no upload */ - - if(result) return result; - + } + Curl_setup_transfer(conn, FIRSTSOCKET, -1, FALSE, bytecount, + -1, NULL); /* no upload */ } else { @@ -290,13 +286,12 @@ static CURLcode dict_do(struct connectdata *conn, bool *done) "CLIENT " LIBCURL_NAME " " LIBCURL_VERSION "\r\n" "%s\r\n" "QUIT\r\n", ppath); - if(result) + if(result) { failf(data, "Failed sending DICT request"); - else - result = Curl_setup_transfer(conn, FIRSTSOCKET, -1, FALSE, bytecount, - -1, NULL); - if(result) return result; + } + + Curl_setup_transfer(conn, FIRSTSOCKET, -1, FALSE, bytecount, -1, NULL); } } diff --git a/lib/ftp.c b/lib/ftp.c index 9df4e23bc..11bd80fd6 100644 --- a/lib/ftp.c +++ b/lib/ftp.c @@ -1378,7 +1378,7 @@ static CURLcode ftp_state_ul_setup(struct connectdata *conn, infof(data, "File already completely uploaded\n"); /* 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 * 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) { /* 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"); /* 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 */ Curl_sndbufset(conn->sock[SECONDARYSOCKET]); - result = Curl_setup_transfer(conn, -1, -1, FALSE, NULL, /* no download */ - SECONDARYSOCKET, ftp->bytecountp); + Curl_setup_transfer(conn, -1, -1, FALSE, NULL, /* no download */ + SECONDARYSOCKET, ftp->bytecountp); state(conn, FTP_STOP); 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); /* FTP download: */ - result=Curl_setup_transfer(conn, SECONDARYSOCKET, size, FALSE, - ftp->bytecountp, - -1, NULL); /* no upload here */ - if(result) - return result; + Curl_setup_transfer(conn, SECONDARYSOCKET, size, FALSE, + ftp->bytecountp, -1, NULL); /* no upload here */ conn->proto.ftpc.pp.pending_resp = TRUE; /* expect server response */ state(conn, FTP_STOP); @@ -3391,7 +3388,7 @@ static CURLcode ftp_nextconnect(struct connectdata *conn) if((result == CURLE_OK) && (ftp->transfer != FTPTRANSFER_BODY)) /* no data to transfer. FIX: it feels like a kludge to have this here 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 */ 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) /* 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) /* since we didn't connect now, we want do_more to get called */ conn->bits.do_more = TRUE; diff --git a/lib/http.c b/lib/http.c index 99d34e661..cfc09cd5e 100644 --- a/lib/http.c +++ b/lib/http.c @@ -2653,14 +2653,13 @@ CURLcode Curl_http(struct connectdata *conn, bool *done) return result; result = Curl_add_buffer_send(req_buffer, conn, - &data->info.request_size, 0, FIRSTSOCKET); + &data->info.request_size, 0, FIRSTSOCKET); if(result) failf(data, "Failed sending POST request"); else /* setup variables for the upcoming transfer */ - result = Curl_setup_transfer(conn, FIRSTSOCKET, -1, TRUE, - &http->readbytecount, - -1, NULL); + Curl_setup_transfer(conn, FIRSTSOCKET, -1, TRUE, &http->readbytecount, + -1, NULL); break; } @@ -2728,10 +2727,9 @@ CURLcode Curl_http(struct connectdata *conn, bool *done) failf(data, "Failed sending POST request"); else /* setup variables for the upcoming transfer */ - result = Curl_setup_transfer(conn, FIRSTSOCKET, -1, TRUE, - &http->readbytecount, - FIRSTSOCKET, - &http->writebytecount); + Curl_setup_transfer(conn, FIRSTSOCKET, -1, TRUE, + &http->readbytecount, FIRSTSOCKET, + &http->writebytecount); if(result) { 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"); else /* prepare for transfer */ - result = Curl_setup_transfer(conn, FIRSTSOCKET, -1, TRUE, - &http->readbytecount, - postsize?FIRSTSOCKET:-1, - postsize?&http->writebytecount:NULL); + Curl_setup_transfer(conn, FIRSTSOCKET, -1, TRUE, + &http->readbytecount, postsize?FIRSTSOCKET:-1, + postsize?&http->writebytecount:NULL); if(result) return result; break; @@ -2931,11 +2928,9 @@ CURLcode Curl_http(struct connectdata *conn, bool *done) if(result) failf(data, "Failed sending HTTP POST request"); else - result = - Curl_setup_transfer(conn, FIRSTSOCKET, -1, TRUE, - &http->readbytecount, - http->postdata?FIRSTSOCKET:-1, - http->postdata?&http->writebytecount:NULL); + Curl_setup_transfer(conn, FIRSTSOCKET, -1, TRUE, + &http->readbytecount, http->postdata?FIRSTSOCKET:-1, + http->postdata?&http->writebytecount:NULL); break; default: @@ -2951,10 +2946,9 @@ CURLcode Curl_http(struct connectdata *conn, bool *done) failf(data, "Failed sending HTTP request"); else /* HTTP GET/HEAD download: */ - result = Curl_setup_transfer(conn, FIRSTSOCKET, -1, TRUE, - &http->readbytecount, - http->postdata?FIRSTSOCKET:-1, - http->postdata?&http->writebytecount:NULL); + Curl_setup_transfer(conn, FIRSTSOCKET, -1, TRUE, &http->readbytecount, + http->postdata?FIRSTSOCKET:-1, + http->postdata?&http->writebytecount:NULL); } if(result) return result; diff --git a/lib/imap.c b/lib/imap.c index f7b895dde..cdadd1713 100644 --- a/lib/imap.c +++ b/lib/imap.c @@ -436,12 +436,11 @@ static CURLcode imap_state_fetch_resp(struct connectdata *conn, if(!filesize) /* 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 /* IMAP download */ - result=Curl_setup_transfer(conn, FIRSTSOCKET, filesize, FALSE, - imap->bytecountp, - -1, NULL); /* no upload here */ + Curl_setup_transfer(conn, FIRSTSOCKET, filesize, FALSE, + imap->bytecountp, -1, NULL); /* no upload here */ 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, bool connected) { - CURLcode result = CURLE_OK; struct FTP *imap = conn->data->state.proto.imap; (void)connected; if(imap->transfer != FTPTRANSFER_BODY) /* 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 */ diff --git a/lib/pop3.c b/lib/pop3.c index 34c6fdfb1..4d79eebb2 100644 --- a/lib/pop3.c +++ b/lib/pop3.c @@ -359,9 +359,8 @@ static CURLcode pop3_state_retr_resp(struct connectdata *conn, } /* POP3 download */ - result=Curl_setup_transfer(conn, FIRSTSOCKET, -1, FALSE, - pop3->bytecountp, - -1, NULL); /* no upload here */ + Curl_setup_transfer(conn, FIRSTSOCKET, -1, FALSE, + pop3->bytecountp, -1, NULL); /* no upload here */ if(pp->cache) { /* 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 */ - result=Curl_setup_transfer(conn, FIRSTSOCKET, -1, FALSE, - pop3->bytecountp, - -1, NULL); /* no upload here */ + Curl_setup_transfer(conn, FIRSTSOCKET, -1, FALSE, pop3->bytecountp, + -1, NULL); /* no upload here */ if(pp->cache) { /* 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, bool connected) { - CURLcode result = CURLE_OK; struct FTP *pop3 = conn->data->state.proto.pop3; struct pop3_conn *pop3c = &conn->proto.pop3c; - (void)connected; + (void)connected; if(pop3->transfer != FTPTRANSFER_BODY) /* 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); - return result; + return CURLE_OK; } /* called from multi.c while DOing */ diff --git a/lib/rtsp.c b/lib/rtsp.c index 8cc200bda..032f58f7e 100644 --- a/lib/rtsp.c +++ b/lib/rtsp.c @@ -254,8 +254,8 @@ CURLcode Curl_rtsp(struct connectdata *conn, bool *done) } if(rtspreq == RTSPREQ_RECEIVE) { - result = Curl_setup_transfer(conn, FIRSTSOCKET, -1, TRUE, - &http->readbytecount, -1, NULL); + Curl_setup_transfer(conn, FIRSTSOCKET, -1, TRUE, + &http->readbytecount, -1, NULL); return result; } @@ -503,15 +503,9 @@ CURLcode Curl_rtsp(struct connectdata *conn, bool *done) return result; } - result = Curl_setup_transfer(conn, FIRSTSOCKET, -1, TRUE, - &http->readbytecount, - putsize?FIRSTSOCKET:-1, - putsize?&http->writebytecount:NULL); - - if(result) { - failf(data, "Failed RTSP transfer"); - return result; - } + Curl_setup_transfer(conn, FIRSTSOCKET, -1, TRUE, &http->readbytecount, + putsize?FIRSTSOCKET:-1, + putsize?&http->writebytecount:NULL); /* Increment the CSeq on success */ data->state.rtsp_next_client_CSeq++; diff --git a/lib/smtp.c b/lib/smtp.c index 654f43505..b4fa58f95 100644 --- a/lib/smtp.c +++ b/lib/smtp.c @@ -465,7 +465,6 @@ static CURLcode smtp_state_data_resp(struct connectdata *conn, int smtpcode, smtpstate instate) { - CURLcode result = CURLE_OK; struct SessionHandle *data = conn->data; struct FTP *smtp = data->state.proto.smtp; @@ -477,11 +476,11 @@ static CURLcode smtp_state_data_resp(struct connectdata *conn, } /* SMTP upload */ - result = Curl_setup_transfer(conn, -1, -1, FALSE, NULL, /* no download */ - FIRSTSOCKET, smtp->bytecountp); + Curl_setup_transfer(conn, -1, -1, FALSE, NULL, /* no download */ + FIRSTSOCKET, smtp->bytecountp); state(conn, SMTP_STOP); - return result; + return CURLE_OK; } /* 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, bool connected) { - CURLcode result = CURLE_OK; struct FTP *smtp = conn->data->state.proto.smtp; struct smtp_conn *smtpc= &conn->proto.smtpc; (void)connected; if(smtp->transfer != FTPTRANSFER_BODY) /* 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); - return result; + return CURLE_OK; } /* called from multi.c while DOing */ diff --git a/lib/ssh.c b/lib/ssh.c index b3da65562..e4e5767c7 100644 --- a/lib/ssh.c +++ b/lib/ssh.c @@ -1556,8 +1556,7 @@ static CURLcode ssh_statemach_act(struct connectdata *conn, bool *block) Curl_pgrsSetUploadSize(data, data->set.infilesize); } /* upload data */ - result = Curl_setup_transfer(conn, -1, -1, FALSE, NULL, - FIRSTSOCKET, NULL); + Curl_setup_transfer(conn, -1, -1, FALSE, NULL, FIRSTSOCKET, NULL); /* not set by Curl_setup_transfer to preserve keepon bits */ conn->sockfd = conn->writesockfd; @@ -1850,7 +1849,7 @@ static CURLcode ssh_statemach_act(struct connectdata *conn, bool *block) sshc->readdir_longentry = NULL; /* 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); break; @@ -1975,14 +1974,14 @@ static CURLcode ssh_statemach_act(struct connectdata *conn, bool *block) /* Setup the actual download */ if(data->req.size == 0) { /* 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"); state(conn, SSH_STOP); break; } else { - result = Curl_setup_transfer(conn, FIRSTSOCKET, data->req.size, - FALSE, NULL, -1, NULL); + Curl_setup_transfer(conn, FIRSTSOCKET, data->req.size, + FALSE, NULL, -1, NULL); /* not set by Curl_setup_transfer to preserve keepon bits */ conn->writesockfd = conn->sockfd; @@ -2107,8 +2106,8 @@ static CURLcode ssh_statemach_act(struct connectdata *conn, bool *block) } /* upload data */ - result = Curl_setup_transfer(conn, -1, data->req.size, FALSE, NULL, - FIRSTSOCKET, NULL); + Curl_setup_transfer(conn, -1, data->req.size, FALSE, NULL, + FIRSTSOCKET, NULL); /* not set by Curl_setup_transfer to preserve keepon bits */ conn->sockfd = conn->writesockfd; @@ -2159,8 +2158,7 @@ static CURLcode ssh_statemach_act(struct connectdata *conn, bool *block) /* download data */ bytecount = (curl_off_t)sb.st_size; data->req.maxdownload = (curl_off_t)sb.st_size; - result = Curl_setup_transfer(conn, FIRSTSOCKET, - bytecount, FALSE, NULL, -1, NULL); + Curl_setup_transfer(conn, FIRSTSOCKET, bytecount, FALSE, NULL, -1, NULL); /* not set by Curl_setup_transfer to preserve keepon bits */ conn->writesockfd = conn->sockfd; diff --git a/lib/tftp.c b/lib/tftp.c index 564de4916..3c288b66e 100644 --- a/lib/tftp.c +++ b/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; setpacketevent(&state->spacket, TFTP_EVENT_ERROR); setpacketblock(&state->spacket, state->block); - sbytes = sendto(state->sockfd, (void *)state->spacket.data, - 4, SEND_4TH_ARG, - (struct sockaddr *)&state->remote_addr, - state->remote_addrlen); + (void)sendto(state->sockfd, (void *)state->spacket.data, 4, SEND_4TH_ARG, + (struct sockaddr *)&state->remote_addr, + state->remote_addrlen); /* 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 */ state->state = TFTP_STATE_FIN; @@ -1295,7 +1294,7 @@ static CURLcode tftp_easy_statemach(struct connectdata *conn) } /* 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); } @@ -1329,7 +1328,7 @@ static CURLcode tftp_multi_statemach(struct connectdata *conn, bool *done) *done = (bool)(state->state == TFTP_STATE_FIN); if(*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 { /* 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); if(*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 */ } diff --git a/lib/transfer.c b/lib/transfer.c index 8985892df..92a59d038 100644 --- a/lib/transfer.c +++ b/lib/transfer.c @@ -2169,7 +2169,7 @@ CURLcode Curl_perform(struct SessionHandle *data) * Curl_setup_transfer() is called to setup some basic properties for the * upcoming transfer. */ -CURLcode +void Curl_setup_transfer( struct connectdata *conn, /* connection data */ 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! */ if(k->getheader || !data->set.opt_no_body) { - if(conn->sockfd != CURL_SOCKET_BAD) { + if(conn->sockfd != CURL_SOCKET_BAD) k->keepon |= KEEP_RECV; - } if(conn->writesockfd != CURL_SOCKET_BAD) { /* HTTP 1.1 magic: @@ -2246,5 +2245,4 @@ Curl_setup_transfer( } /* if(conn->writesockfd != CURL_SOCKET_BAD) */ } /* if(k->getheader || !data->set.opt_no_body) */ - return CURLE_OK; } diff --git a/lib/transfer.h b/lib/transfer.h index 4c2bc9e02..790e1e3ef 100644 --- a/lib/transfer.h +++ b/lib/transfer.h @@ -7,7 +7,7 @@ * | (__| |_| | _ <| |___ * \___|\___/|_| \_\_____| * - * Copyright (C) 1998 - 2009, Daniel Stenberg, , et al. + * Copyright (C) 1998 - 2010, Daniel Stenberg, , et al. * * This software is licensed as described in the file COPYING, which * 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); /* This sets up a forthcoming transfer */ -CURLcode +void Curl_setup_transfer (struct connectdata *data, int sockindex, /* socket index to read from or -1 */ curl_off_t size, /* -1 if unknown at this point */ diff --git a/lib/url.c b/lib/url.c index 6dc267204..a84e69d35 100644 --- a/lib/url.c +++ b/lib/url.c @@ -4779,9 +4779,8 @@ static CURLcode create_conn(struct SessionHandle *data, return result; } - result = Curl_setup_transfer(conn, -1, -1, FALSE, - NULL, /* no download */ - -1, NULL); /* no upload */ + Curl_setup_transfer(conn, -1, -1, FALSE, NULL, /* no download */ + -1, NULL); /* no upload */ } return result;