Post tO HTTPS

Discussion to talk about software related topics only.
Post Reply
fredy-gutierrez
Posts: 12
Joined: Fri Dec 11, 2020 8:27 am

Post tO HTTPS

Post by fredy-gutierrez »

Hi,
I need some help, I´m making a post to an URL which is uses HTTPS, previously I was using POST in a HTTP but
when it changed to HTTPS the POST couldn´t be send, what should I change or add to my POST code?
Kind Regards,
Fredy

/*********************************Post Code*************************************************/
bool sendStatus() {
char postObjStr[1024];
ParsedJsonDataSet JsonOutObject;
ParsedJsonDataSet JsonInObject;

JsonOutObject.StartBuilding();
JsonOutObject.Add("action", "aeiCommand");
JsonOutObject.Add("command", "integraAeiProcessLogData");
JsonOutObject.Add("userId", "Integra");
JsonOutObject.DoneBuilding();
logg.newPrint("\nStatus out: ");
JsonOutObject.PrintObjectToBuffer(postObjStr, 1024);
logg.newPrint(postObjStr);

ParsedURI uri(getUrl("integraAeiProcessLogData"));//get the server url

//send the post Object (JsonOutObject) and obteins the server answer into JsonInObject
bool result = DoJsonPost(uri, JsonOutObject, JsonInObject, NULL,10 * TICKS_PER_SECOND);

//print JSON result
logg.newPrint("\nStatus in: ");
if(result){
memset(postObjStr,'\0',1024);
JsonInObject.PrintObjectToBuffer(postObjStr, 1024);
logg.newPrint(postObjStr);
}else{
logg.newPrint("POST could not be sent\n");
}
return result;
}
User avatar
pbreed
Posts: 1088
Joined: Thu Apr 24, 2008 3:58 pm

Re: Post tO HTTPS

Post by pbreed »

Several things...
Does the url returned form GetUrl have http or https at the begining?

Are you on the 2.X or 3.X platform?

Make sure SSL support is turned on in the predef.h file...
Make sure #define WEB_CLIENT_SSL_SUPPORT (1) Is also turned on....

nburn\include\predef.h //2.X
nburn\nbrtos\include\predef.h //3.x


We have been doing a bunch of work in this space so make sure you have the very latest release.
Post Reply