2

I'm using the cpp-netlib version 0.11 with boost 1.55 and want to create a request object with these lines:

#include <iostream>

#include <boost/network/protocol/http/client.hpp>
#include <boost/network/uri.hpp>
#include <boost/network/uri/uri_io.hpp>

using namespace boost::network;
typedef http::basic_client< http::tags::http_default_8bit_tcp_resolve ,1,1> httpClient;

int main() {
   uri::uri url = std::string("http://www.abcs.de/");

   httpClient::request req;
   req << header("Content-Type", "application/x-www-form-urlencoded");

   req << url; // THIS LINE DOESN'T COMPILE
}

If I read the documentation (here) right, that line to set the request url should work, but I only get

/usr/local/include/boost/network/protocol/http/request.hpp: In instantiation of ‘boost::network::http::basic_request<Tag>& boost::network::http::operator<<(boost::network::http::basic_request<Tag>&, const Directive&) [with Tag = boost::network::http::tags::http_default_8bit_tcp_resolve; Directive = boost::network::uri::uri]’:
src/receiver.h:33:11:   required from here
/usr/local/include/boost/network/protocol/http/request.hpp:71:26: error: no match for call to ‘(const boost::network::uri::uri) (boost::network::http::basic_request<boost::network::http::tags::http_default_8bit_tcp_resolve>&)’
         directive(message);
3
  • can you post a SSCCE? Commented Oct 3, 2014 at 13:32
  • codepad.org/6Z5tg2QV link against boost Commented Oct 3, 2014 at 13:40
  • @Roby, since you've found the solution to your problem, please add it as an answer to your question (and accept it). Commented Oct 3, 2014 at 14:23

1 Answer 1

0

To httpClient::request object has a member method to set the url req.uri( url ) works

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

Comments

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.