Ejemplo n.º 1
0
  void Client::send(Request_ptr req, Host host, Response_handler cb, Options options)
  {
    Expects(cb != nullptr);
    using namespace std;
    auto& conn = get_connection(host);

    auto&& header = req->header();
    // Set Host if not already set
    if(! header.has_field(header::Host))
      header.set_field(header::Host, host.to_string());

    debug("<http::Client> Sending Request:\n%s\n", req->to_string().c_str());

    conn.send(move(req), move(cb), options.bufsize, options.timeout);
  }