Quantcast
Channel: WE MOVED to github.com/microsoft/cpprestsdk. This site is not monitored!
Viewing all articles
Browse latest Browse all 4845

New Post: Problem with https

$
0
0
I have developed a listener application using Casablanca SDK, in VS 2012. The details I have mentioned this thread.

https://casablanca.codeplex.com/discussions/564796

I have recently discovered a new problem. In Windows 8.1,
 Mixed Content: The page at 'https://www.google.co.in/?gfe_rd=cr&ei=S7S0VJGqO4LV8gev84HICw&gws_rd=ssl' was loaded over HTTPS, but requested an insecure XMLHttpRequest endpoint 'http://localhost:2001/?name='. This request has been blocked; the content must be served over HTTPS.chrome-extension://kbeoccojlmfnigpcnkjedepgjdhpdmkn/jquery.js:4 send
chrome-extension://kbeoccojlmfnigpcnkjedepgjdhpdmkn/jquery.js:4 Mixed Content: The page at 'https://www.google.co.in/?gfe_rd=cr&ei=S7S0VJGqO4LV8gev84HICw&gws_rd=ssl' was loaded over HTTPS, but requested an insecure XMLHttpRequest endpoint 'http://localhost:2001/'. This request has been blocked; the content must be served over HTTPS.
chrome-extension://kbeoccojlmfnigpcnkjedepgjdhpdmkn/jquery.js:4 Mixed Content: The page at 'https://www.google.co.in/?gfe_rd=cr&ei=S7S0VJGqO4LV8gev84HICw&gws_rd=ssl#q=maverick+meaning' was loaded over HTTPS, but requested an insecure XMLHttpRequest endpoint 'http://localhost:2001/?name=maverick+meaning'. This request has been blocked; the content must be served over HTTPS.
chrome-extension://kbeoccojlmfnigpcnkjedepgjdhpdmkn/jquery.js:4 Mixed Content: The page at 'https://www.google.co.in/?gfe_rd=cr&ei=S7S0VJGqO4LV8gev84HICw&gws_rd=ssl#q=maverick+meaning' was loaded over HTTPS, but requested an insecure XMLHttpRequest endpoint 'http://localhost:2001/'. This request has been blocked; the content must be served over HTTPS.
chrome-extension://kbeoccojlmfnigpcnkjedepgjdhpdmkn/jquery.js:4 Mixed Content: The page at 'https://www.google.co.in/?gfe_rd=cr&ei=S7S0VJGqO4LV8gev84HICw&gws_rd=ssl#q=maverick+meaning' was loaded over HTTPS, but requested an insecure XMLHttpRequest endpoint 'http://localhost:2001/?name=maverick+meaning'. This request has been blocked; the content must be served over HTTPS.
chrome-extension://kbeoccojlmfnigpcnkjedepgjdhpdmkn/jquery.js:4 Mixed Content: The page at 'https://www.google.co.in/?gfe_rd=cr&ei=S7S0VJGqO4LV8gev84HICw&gws_rd=ssl#q=maverick+meaning' was loaded over HTTPS, but requested an insecure XMLHttpRequest endpoint 'http://localhost:2001/'. This request has been blocked; the content must be served over HTTPS.
This problem happens in Windows 8.1 because instead of http, it takes https. Now in the original source code.
int _tmain(int argc, _TCHAR* argv[])
{
    __uri_builder uri(L"http://localhost:2001/");__
    http_listener listener(uri.to_uri());
    std::cout << "Welcome to Casablanca" << std::endl;

    CheckOSVersion();

    listener.support(methods::GET, [](http_request req)
    {
        HKEY hKey;
        LONG lRes = RegOpenKeyExW(HKEY_CURRENT_USER, L"SOFTWARE\\Casablanca", 0, KEY_READ, &hKey);

        bool bExistsAndSuccess (lRes == ERROR_SUCCESS);
        bool bDoesNotExistsSpecifically (lRes == ERROR_FILE_NOT_FOUND);

        std::wstring strValueOfBinDir;
        GetStringRegKey(hKey, L"Encryption", strValueOfBinDir, L"1");

        GIDSdkWriteXML();

        http_response response (status_codes::OK);

        response.headers().add(U("Access-Control-Allow-Origin"), U("*"));
        response.set_body(strValueOfBinDir, U("text/html"));

        req.set_request_uri(L"requestpath");
        req.reply(response);
    });

    listener.support(methods::PUT,[](http_request req)
    {
        std::cout << "Serving PUT" << std::endl;
        req.reply(status_codes::OK, U("<html><body><h1>It works!</h1>(Casablanca, that is a POST Request.)</body></html>"), 
            U("text/html"));
    });

    listener.support(methods::POST,[](http_request req)
    {
        std::cout << "Serving POST" << std::endl;
        req.extract_string(true).then([req](utility::string_t body)
        {
            std::wcout << body << std::endl;
            //req.reply(status_codes::OK, U("<html><body>Received.</body></html>"), U("text/html"));
        });
    }); 

    listener.open().wait();
    fgetc(stdin);
    listener.close().wait();
}
When I change from

uri_builder uri(L"http://localhost:2001/"); to uri_builder uri(L"https://localhost:2001/");, It simply doesn't work. Can someone tell me a solution to this?

Viewing all articles
Browse latest Browse all 4845

Latest Images

Trending Articles



Latest Images

<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>