Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Sending Request using HTTPS in C++

My C++ application consists of posting out through an HTTP connection directly to the Weblogic App server. Need to change it to post using HTTPS.

*Im running this application through Visual Studio. *

Any kind of suggestions are welcome. Coding updates are most helpful

The below is the code i have for HTTP connectivity works fine.

What i need to do it to work with HTTPS?

      strFormData = sFile;

strHeaders  = _T("Content-Type: application/x-www-form-urlencoded");

CInternetSession session;
CHttpConnection* pConnection =  session.GetHttpConnection(_T(Server), Port);

CHttpFile* pFile =  pConnection->OpenRequest(CHttpConnection::HTTP_VERB_POST,   _T(Action));                

result = pFile->SendRequest(strHeaders,(LPVOID)(LPCTSTR)strFormData,  
                                          Data.GetLength());
like image 879
Shalem Avatar asked Apr 03 '13 13:04

Shalem


People also ask

What is HTTP in C?

The Hypertext Transfer Protocol (HTTP) is a stateless application layer protocol for distributed, collaborative, hypermedia information systems. In this article, I will explain, how you can create an HTTP get post request in C without using the library.

What is HTTP response?

An HTTP response is made by a server to a client. The aim of the response is to provide the client with the resource it requested, or inform the client that the action it requested has been carried out; or else to inform the client that an error occurred in processing its request.


1 Answers

CHttpFile* pFile = pConnection->OpenRequest(CHttpConnection::HTTP_VERB_POST, _T(Action), NULL, 1, NULL, NULL, INTERNET_FLAG_SECURE);

I tried this code and it worked out for HTTPS posting. I found that parametric values (Internet secure flag) varies with HTTP & HTTPS posting.

like image 94
Shalem Avatar answered Sep 28 '22 11:09

Shalem