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);

                                      ^
sehe
  • 374,641
  • 47
  • 450
  • 633
Vittorio Apicella
  • 381
  • 1
  • 2
  • 14

1 Answers1

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

sehe
  • 374,641
  • 47
  • 450
  • 633
  • 1
    thanks, actually I was looking here http://cpp-netlib.org/0.9.1/reference_http_client.html and just realized that the syntax has changed from 0.9...+1 thanks again! – Vittorio Apicella Nov 15 '14 at 00:21
  • 1
    @VittorioApicella nice. I didn't know that. It's just the second pair of eyes that sometimes does the trick :) – sehe Nov 15 '14 at 00:25