cURL / Mailing Lists / curl-library / Single Mail

curl-library

issue with SMTP through HTTP proxy (using curl v 7.20.0)

From: Chandran, Naveen <naveen.chandran_at_hp.com>
Date: Thu, 1 Dec 2011 12:58:32 +0000

Dear curl library users,

I am trying to implement a minimal mailing mechanism using curl v7.20.0 and hence trying to connect to (and subsequently send mail) to an SMTP server through a HTTP proxy.
Therefore, among the options (to curl_easy_setopt), I am using:

* CURLOPT_PROXY (to talk to a HTTP proxy) and

* CURLOPT_HTTPPROXYTUNNEL (to tunnel through the proxy to reach the SMTP server)

Please note that with this setup:

* The initial connection to the SMTP server is successful since the http CONNECT request sends back a "HTTP/1.1 200 Connection Established" header.

* The SMTP server subsequently also identifies itself with a 220 <SMTP_server_name> ESMTP response

However, following this, there is an unwanted "GET / HTTP/1.1" header request to the SMTP server that gets sent
and hence the SMTP server at the other end terminates the connection with the following error messages:

500 Command unrecognized: "GET / HTTP/1.1"
500 Command unrecognized: "User-Agent: xxxxxxxxxxxxxxxxx"
500 Command unrecognized: "Host: xxxxxxxxxxxxxxxxxxxxxxx"
500 Command unrecognized: "GET / HTTP/1.1"
500 Command unrecognized: "User-Agent: xxxxxxxxxxxxxxxxx"
500 Command unrecognized: "Host: xx.xx.xx.xx"
500 Command unrecognized: "Accept: */*"

On the other hand, also please note that the mailing mechanism works perfectly fine if I turn the CURLOPT_PROXY option off.

Kindly let me know if I am missing anything here and if there is a way to talk SMTP via an HTTP proxy without the unwanted "GET /HTTP" header coming in the way of things.
Any help is greatly appreciated. Thanks for your patience.

Regards,
Naveen

-------------------------------------------------------------------
List admin: http://cool.haxx.se/list/listinfo/curl-library
Etiquette: http://curl.haxx.se/mail/etiquette.html
Received on 2011-12-01