Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

HTTPS and C++ - Not an easy match?

Tags:

c++

https

mfc

I need to access a HTTPS protected website (HTML or XML) from an C++ MFC application and I would like an easy solution. But I did a little research and it's seems to me HTTPS and C++ don't play nice and easy together.

Is there any recommended class library for HTTPS web access? Should be easy to use and not too expensive.

like image 555
TalkingCode Avatar asked Apr 23 '10 14:04

TalkingCode


People also ask

How do I fix SSL name mismatch?

If you purchased a dedicated IP address and an SSL certificate was installed immediately afterward, the domain can still be associated with the previous IP address. To solve the problem, just wait a while. As soon as the DNS records are updated, the error will disappear.

Why is HTTPS not used for all web traffic?

Another problem with running an HTTPS site is the cost of operations. "Although servers are faster and implementations of SSL more optimized, it still costs more than doing plain http," writes Lafon.

Which is faster HTTP or HTTPS?

HTTP vs HTTPS Performance. In general, HTTP is faster than HTTPS due to its simplicity. In HTTPS, we have an additional step of SSL handshake unlike in HTTP. This additional step slightly delays the page load speed of the website.


2 Answers

libcurl has https support. Check out this example.

like image 181
Marcelo Cantos Avatar answered Sep 19 '22 10:09

Marcelo Cantos


WinInet

See sample below

  ...
   hOpen = InternetOpen (...);
   Connect = InternetConnect (
                hOpen,                      // InternetOpen handle
                "MyHttpServer",             // Server  name
      INTERNET_DEFAULT_HTTPS_PORT,// Default HTTPS port - 443
                "",                         // User name
                "",                         //  User password
                INTERNET_SERVICE_HTTP,      // Service
      0,                          // Flags
      0                           // Context
                   );
   hReq = HttpOpenRequest (
                hConnect,                   // InternetConnect handle
      "GET",                      // Method
      "",                         // Object name
      HTTP_VERSION,               // Version
      "",                         // Referrer
                NULL,                       // Extra headers
      INTERNET_FLAG_SECURE,       // Flags
      0                           // Context
                );
   ...
like image 37
Romain Hippeau Avatar answered Sep 21 '22 10:09

Romain Hippeau