2 #include "async_web_server_cpp/http_reply.hpp" 8 async_web_server_cpp::HttpConnectionPtr& connection,
9 const std::string& boundry,
10 std::size_t max_queue_size)
11 : connection_(connection), boundry_(boundry), max_queue_size_(max_queue_size)
15 async_web_server_cpp::HttpReply::builder(async_web_server_cpp::HttpReply::ok).header(
"Connection",
"close").header(
16 "Server",
"web_video_server").header(
"Cache-Control",
17 "no-cache, no-store, must-revalidate, pre-check=0, post-check=0, max-age=0").header(
18 "Pragma",
"no-cache").header(
"Content-type",
"multipart/x-mixed-replace;boundary="+
boundry_).header(
19 "Access-Control-Allow-Origin",
"*").write(
connection_);
25 sprintf(stamp,
"%.06lf", time.
toSec());
27 new std::vector<async_web_server_cpp::HttpHeader>());
28 headers->push_back(async_web_server_cpp::HttpHeader(
"Content-type", type));
29 headers->push_back(async_web_server_cpp::HttpHeader(
"X-Timestamp", stamp));
31 async_web_server_cpp::HttpHeader(
"Content-Length", boost::lexical_cast<std::string>(payload_size)));
32 connection_->write(async_web_server_cpp::HttpReply::to_buffers(*headers), headers);
45 std::vector<unsigned char> &data) {
55 const boost::asio::const_buffer &buffer,
56 async_web_server_cpp::HttpConnection::ResourcePtr resource) {
73 if ((currentTime - footerTime).toSec() > 0.5) {
void sendPartHeader(const ros::Time &time, const std::string &type, size_t payload_size)
async_web_server_cpp::HttpConnectionPtr connection_
MultipartStream(async_web_server_cpp::HttpConnectionPtr &connection, const std::string &boundry="boundarydonotcross", std::size_t max_queue_size=1)
void sendPartAndClear(const ros::Time &time, const std::string &type, std::vector< unsigned char > &data)
void sendPart(const ros::Time &time, const std::string &type, const boost::asio::const_buffer &buffer, async_web_server_cpp::HttpConnection::ResourcePtr resource)
void sendPartFooter(const ros::Time &time)
std::queue< PendingFooter > pending_footers_
const std::size_t max_queue_size_