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

New Post: Auto Redirect

$
0
0
Hi all

Hi all

I looked harder at the source code and discovered a very nice capability within the existing http_client_config class which worked a treat:
    whttp::client::http_client_config config;
    config.set_nativehandle_options([](web::http::client::native_handle handle) {
        DWORD data = WINHTTP_DISABLE_REDIRECTS;
        BOOL result = ::WinHttpSetOption(handle, WINHTTP_OPTION_DISABLE_FEATURE, &data, sizeof(data));
        if (!result)
        {
            DWORD error = GetLastError();
        }
    });

    utility::string_t baseUrl = _XPLATSTR("https://media.windows.net/api/");

    whttp::client::http_client client(baseUrl, config);
Obviously this will only work for windows but if I face the same problem on linux then I guess I will use a similar technique to turn off automatic redirect.

Very nice casablanca dev team - well done!

Jame

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>