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

New Post: How to open http_listener (error -> Address 'http://www.somesite.com/' is already in use)

$
0
0
hi roschuma,

you have definitely right, i'm new in rsdk so many thing seems confused to me. I just realize that i need something like interceptor. My goal is to display in browser that site status is Forbidden when i get to the google.com. (like in this example http://blogs.msdn.com/b/vcblog/archive/2013/07/10/intercepting-http-request_2f00_response-using-c_2b002b00_-rest-http-library.aspx) ->butt i can get it work.

This is what i already try to intercept google and display in browser that site is Forbidden
void IntercetGoogle()
{
auto testAuthStage =
    [](http_request request, std::shared_ptr<http_pipeline_stage> next_stage) -> pplx::task < http_response >
{
    http_response response;
    response.set_status_code(status_codes::Forbidden);
    wcout << response.extract_string().get() << endl;
    return pplx::task_from_result(response);
};

http_client client(L"http://google.com");
client.add_handler(testAuthStage);
}
``` This code don't work it want display in browser that site is Forbidden, why?

Viewing all articles
Browse latest Browse all 4845

Trending Articles



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