cURL / Mailing Lists / curl-library / Single Mail

curl-library

[PATCH] SMTP: Fixed error when using CURLOPT_CONNECT_ONLY

From: Steve Holme <steve_holme_at_hotmail.com>
Date: Tue, 14 Feb 2012 16:07:12 +0000

Dear all,

Firstly I must apologise for being quiet over the last couple of weeks. but
unfortunately I joined the "Four Zero" club so have been away from my PC
drowning my sorrows ;-)

I'm now back and if anyone needs my input into anything POP3 / SMTP related
please feel free to give me a nudge.

Anyway, back to the subject of this email.

I noticed today when I tried to use the CURLOPT_CONNECT_ONLY parameter on
SMTP that it doesn't work - instead curl_easy_perform() returns
CURLE_RECV_ERROR.

The reason for this is that an EOB "CRLF.CRLF" is sent by smtp_done() as
part of the POSTDATA process, however, when using CURLOPT_CONNECT_ONLY no
data is sent but the EOB still is. This means the server will typically
respond with a 5.3.3 causing smtp_state_postdata_resp() to set the result to
CURLE_RECV_ERROR.

As such I have enclosed a patch to fix this which prevents smtp_done() from
sending the EOB if CURLOPT_CONNECT_ONLY has been specified.

Kind Regards

Steve

Received on 2012-02-14