4

I think my question is really trivial, but I can't get it to work nonetheless

std::string url="www.google.it";

boost::network::http::client client1_(_follow_redirects=true, _cache_resolved=true);
boost::network::http::client::request req(url);
boost::network::http::client::response resp = client1_.get(req);
std::cout << "Body: " << body(resp) << std::endl;

return 0;

the error of course refers to the declaration of the flags...but how can I set them?

/home/snake91/cpp_pricing/underlying.cpp:67: error: C++ requires a type specifier for all declarations
    boost::network::http::client client1_(_follow_redirects=true, _cache_resolved=true);

^

1 Answer 1

3
client::options options;
options.follow_redirects(true)
       .cache_resolved(true);

client client1_(options);

From this page of the docs: http://cpp-netlib.org/0.11.0/reference/http_client.html#general

Sign up to request clarification or add additional context in comments.

2 Comments

thanks, actually I was looking here cpp-netlib.org/0.9.1/reference_http_client.html and just realized that the syntax has changed from 0.9...+1 thanks again!
@VittorioApicella nice. I didn't know that. It's just the second pair of eyes that sometimes does the trick :)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.