aboutsummaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorSteve Holme <steve_holme@hotmail.com>2012-02-14 14:21:21 +0000
committerDaniel Stenberg <daniel@haxx.se>2012-02-14 19:12:28 +0100
commit69406f0be7ba15a14683ef98eba4b1fe7e7f14c8 (patch)
tree5c807b377a76e5094473584fe3875186ff65022e /lib
parentea4ceca2222aa5c49198d42678437a4f5ded6f3f (diff)
SMTP: Fixed error when using CURLOPT_CONNECT_ONLY
Fixed incorrect behavior in smtp_done() which would cause the end of block data to be sent to the SMTP server if libcurl was operating in connect only mode. This would cause the server to return an error as data would not be expected which in turn caused libcurl to return CURLE_RECV_ERROR.
Diffstat (limited to 'lib')
-rw-r--r--lib/smtp.c18
1 files changed, 9 insertions, 9 deletions
diff --git a/lib/smtp.c b/lib/smtp.c
index 553c697d0..95e71d75a 100644
--- a/lib/smtp.c
+++ b/lib/smtp.c
@@ -5,7 +5,7 @@
* | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____|
*
- * Copyright (C) 1998 - 2011, Daniel Stenberg, <daniel@haxx.se>, et al.
+ * Copyright (C) 1998 - 2012, Daniel Stenberg, <daniel@haxx.se>, et al.
*
* This software is licensed as described in the file COPYING, which
* you should have received as part of this distribution. The terms
@@ -1364,25 +1364,25 @@ static CURLcode smtp_done(struct connectdata *conn, CURLcode status,
conn->bits.close = TRUE; /* marked for closure */
result = status; /* use the already set error code */
}
- else
+ else if(!data->set.connect_only) {
+ struct smtp_conn *smtpc = &conn->proto.smtpc;
+ struct pingpong *pp = &smtpc->pp;
+
/* TODO: make this work even when the socket is EWOULDBLOCK in this
call! */
- /* write to socket (send away data) */
+ /* Send the end of block data */
result = Curl_write(conn,
conn->writesockfd, /* socket to send to */
SMTP_EOB, /* buffer pointer */
SMTP_EOB_LEN, /* buffer size */
&bytes_written); /* actually sent away */
-
- if(status == CURLE_OK) {
- struct smtp_conn *smtpc = &conn->proto.smtpc;
- struct pingpong *pp = &smtpc->pp;
pp->response = Curl_tvnow(); /* timeout relative now */
state(conn, SMTP_POSTDATA);
- /* run the state-machine
+
+ /* Run the state-machine
TODO: when the multi interface is used, this _really_ should be using
the smtp_multi_statemach function but we have no general support for
@@ -1392,7 +1392,7 @@ static CURLcode smtp_done(struct connectdata *conn, CURLcode status,
result = smtp_easy_statemach(conn);
}
- /* clear these for next connection */
+ /* Clear the transfer mode for the next connection */
smtp->transfer = FTPTRANSFER_BODY;
return result;