c++ rest sdk https server implemention (Windows)

Jul 20, 2015 at 5:32 AM
Edited Jul 20, 2015 at 5:34 AM
below is my https listener implementation and i am trying to connect this server from browser by using "https://localhost:8082" URL but i am not able to connect to it:
/* handlers implementation */
void search(http_request request)
    ucout << "search in google call and query is " << request.absolute_uri().to_string() << endl;
auto q = request.relative_uri().query();

int length = q.length();
int loc = q.find(U("="));
utility::string_t ss = q.substr(loc + 1, length);
ucout << "Search string is = " << ss << endl;

http_client client(U("https://ajax.googleapis.com/ajax/services/search/web"));
auto query = uri_builder()
    .append_query(L"q", ss)
    .append_query(L"v", L"1.0")
    .append_query(L"rsz", 5)
client.request(methods::GET, query)
    .then([=](http_response res){
    request.reply(status_codes::OK, res.extract_json().get());

int main()
http_listener listener(L"https://localhost:8082");
//http_listener listener;

listener.support(methods::GET, search);

        .then([&listener](){wcout << "\nServer ready\n"; })
    while (true);
catch (exception const & e)
    wcout << e.what() << endl;

return 0;
Could you please point out the problem in this code??

Jul 20, 2015 at 5:02 PM
Hi Pooja,

On Windows if you need to handle requests coming from off the machine you need to run the program with administrative privileges. Can you please try that and see if everything works. Another option is to have the system administrator register and reserve the URL, more information can be found here in the documentation for the Windows HTTP Server API.