"boost asio ignore header" Code Answer's
You're definitely familiar with the best coding language Whatever that developers use to develop their projects and they get all their queries like "boost asio ignore header" answered properly. Developers are finding an appropriate answer about boost asio ignore header related to the Whatever coding language. By visiting this online portal developers get answers concerning Whatever codes question like boost asio ignore header. Enter your desired code related query in the search bar and get every piece of information about Whatever code related question on boost asio ignore header.
boost asio ignore header
int do_get(std::string &host_,std::string &port_, std::string url_path,std::ostream &out_,std::vector<std::string> &headers, unsigned int timeout)
{
try{
using namespace boost::asio::ip;
tcp::iostream request_stream;
if (timeout>0){
request_stream.expires_from_now(boost::posix_time::milliseconds(timeout));
}
request_stream.connect(host_,port_);
if(!request_stream){
return -1;
}
request_stream << "GET " << url_path << " HTTP/1.0\r\n";
request_stream << "Host: " << host_ << "\r\n";
request_stream << "Accept: */*\r\n";
request_stream << "Cache-Control: no-cache\r\n";
request_stream << "Connection: close\r\n\r\n";
request_stream.flush();
std::string line1;
std::getline(request_stream,line1);
if (!request_stream)
{
return -2;
}
std::stringstream response_stream(line1);
std::string http_version;
response_stream >> http_version;
unsigned int status_code;
response_stream >> status_code;
std::string status_message;
std::getline(response_stream,status_message);
if (!response_stream||http_version.substr(0,5)!="HTTP/")
{
return -1;
}
if (status_code!=200)
{
return (int)status_code;
}
std::string header;
while (std::getline(request_stream, header) && header != "\r")
headers.push_back(header);
out_ << request_stream.rdbuf();
return status_code;
}catch(std::exception &e){
std::cout << e.what() << std::endl;
return -3;
}
}
Source: stackoverflow.com
All those coders who are working on the Whatever based application and are stuck on boost asio ignore header can get a collection of related answers to their query. Programmers need to enter their query on boost asio ignore header related to Whatever code and they'll get their ambiguities clear immediately. On our webpage, there are tutorials about boost asio ignore header for the programmers working on Whatever code while coding their module. Coders are also allowed to rectify already present answers of boost asio ignore header while working on the Whatever language code. Developers can add up suggestions if they deem fit any other answer relating to "boost asio ignore header". Visit this developer's friendly online web community, CodeProZone, and get your queries like boost asio ignore header resolved professionally and stay updated to the latest Whatever updates.