Subject: [Boost-bugs] [Boost C++ Libraries] #12875: ip::tcp::iostream flush() doesn't clear the buffer. Neither does clear();
From: Boost C++ Libraries (noreply_at_[hidden])
Date: 2017-02-28 17:27:02
#12875: ip::tcp::iostream flush() doesn't clear the buffer. Neither does clear();
---------------------------+--------------------------------------
Reporter: ericrsoldan@⦠| Type: Bugs
Status: new | Milestone: To Be Determined
Component: None | Version: Boost 1.63.0
Severity: Problem | Keywords: tcp iostream flush clear
---------------------------+--------------------------------------
Code something like the below shows the issue:
std::string postData = "This is my post data.";
ip::tcp::iostream stream;
stream.expires_from_now(boost::posix_time::seconds(10));
stream.connect("192.168.1.128", "http");
stream << "POST /myRestfulPath HTTP/1.1\r\n";
stream << "Content-Type: application/x-www-form-urlencoded\r\n";
stream << "Host: 192.168.1.128:8080\r\n";
stream << "Content-Length: " << postData.size() << "\r\n";
stream << "Connection: Close\r\n\r\n";
stream.flush();
stream << postData.c_str();
stream.flush();
Using Wireshark, the headers show up with the first flush,
but also show up from the second, with the postData appended.
I understand that I do not need the first flush in this example.
However, the server requires an "Expect: 100-Continue" so
therefore I need to send before the postData, and then receive
the "Continue", and then send the postData. (Not shown.)
stream.clear() doesn't clear what flush left behind, either.
-- Ticket URL: <https://svn.boost.org/trac/boost/ticket/12875> Boost C++ Libraries <http://www.boost.org/> Boost provides free peer-reviewed portable C++ source libraries.
This archive was generated by hypermail 2.1.7 : 2017-02-28 17:31:29 UTC