curl / Mailing Lists / curl-library / Single Mail
Buy commercial curl support from WolfSSL. We help you work out your issues, debug your libcurl applications, use the API, port to new platforms, add new features and more. With a team lead by the curl founder himself.

Re: Connecting to IMAP server using libcurl

From: Daniel Stenberg via curl-library <curl-library_at_cool.haxx.se>
Date: Sat, 5 Sep 2020 23:02:24 +0200 (CEST)

On Tue, 1 Sep 2020, Jeffrey McKay via curl-library wrote:

> In my program, I can connect to my test server (outlook.office365.com), and
> if I use port 143, the insecure IMAP port, I can receive the response. But
> if I use secure port 993, the program hangs on the select() command, timing
> out after 60 seconds.

If you want TLS already in the connect procedure, you need to use a URL that
says so. Your code:

     strcpy_s(imap_host, "outlook.office365.com");
     curl_easy_setopt(curl, CURLOPT_URL, imap_host);

... uses no protocol scheme at all which will make curl guess, and in this
case it thinks it is "http" - in clear text. It won't try to do any TLS
negotiation on a clear text connection.

-- 
  / daniel.haxx.se | Commercial curl support up to 24x7 is available!
                   | Private help, bug fixes, support, ports, new features
                   | https://www.wolfssl.com/contact/
-------------------------------------------------------------------
Unsubscribe: https://cool.haxx.se/list/listinfo/curl-library
Etiquette:   https://curl.haxx.se/mail/etiquette.html
Received on 2020-09-05