C++ REST SDK throw error when use https

Jan 19, 2015 at 2:49 AM

When I use IE to open this url:
https://myip/rest/aaa/updatePassword/13770675082/123456, I can get the right result, the response is a jason struct.
but when i run this simple program, it will throw an error:
    http_client client(U("https://myip/rest/aaa/updatePassword/13770675082/123456"));
    http_request request(methods::GET);
    http_response response = client.request(request).get();  //Throws Assert!
Could you help me out here on how to get it working for me?
Jan 19, 2015 at 10:13 AM
I have found the topic in here:

This is the problem I have encountered,

If I want to ignore the exception, do I need to add this code yet?
Jan 19, 2015 at 5:30 PM
Hi ylongwu,

Yes if any error occurs an exception will be thrown, not an assert, out of the task returned from http_client::request. You didn't mention any information about what the exception information is so I don't know what the problem is. If the problem is verifying the server certificate you can turn this off as mentioned in the discussion thread you referenced, by using http_client_config::set_validate_certificates(false) and passing the config to the http_client constructor. However I would strongly advise being careful about this, if the certificate contains errors or is invalid and you blindly choose to ignore it then you are putting yourself at risk for security issues.

Marked as answer by roschuma on 1/27/2015 at 5:04 PM
Jan 27, 2015 at 8:57 AM

you are right, It is an exception , not an assert!

When I open this url in IE , It will show red for certificate safety warings,

If I turn the set_validate_certificates off in my c++ program, I will get the right result!