Modified daemon code and build.sh script to use version v0.7.0 of cpp-httplib
This commit is contained in:
parent
098cebd056
commit
6449524ed5
2
build.sh
2
build.sh
@ -28,7 +28,7 @@ fi
|
|||||||
if [ ! -d cpp-httplib.git ]; then
|
if [ ! -d cpp-httplib.git ]; then
|
||||||
git clone https://github.com/yhirose/cpp-httplib.git
|
git clone https://github.com/yhirose/cpp-httplib.git
|
||||||
cd cpp-httplib
|
cd cpp-httplib
|
||||||
git checkout 301a419c0243d3ab843e5fc2bb9fa56a9daa7bcd
|
git checkout 42f9f9107f87ad2ee04be117dbbadd621c449552
|
||||||
cd ..
|
cd ..
|
||||||
fi
|
fi
|
||||||
cd ..
|
cd ..
|
||||||
|
@ -83,7 +83,7 @@ bool HttpServer::init() {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
svr_.set_base_dir(config_->get_http_base_dir().c_str());
|
svr_.set_mount_point(nullptr, config_->get_http_base_dir().c_str());
|
||||||
|
|
||||||
svr_.Get("(/|/Config|/PTP|/Sources|/Sinks|/Browser)",
|
svr_.Get("(/|/Config|/PTP|/Sources|/Sinks|/Browser)",
|
||||||
[&](const Request& req, Response& res) {
|
[&](const Request& req, Response& res) {
|
||||||
|
@ -18,7 +18,6 @@
|
|||||||
//
|
//
|
||||||
|
|
||||||
#define CPPHTTPLIB_PAYLOAD_MAX_LENGTH 4096 // max for SDP file
|
#define CPPHTTPLIB_PAYLOAD_MAX_LENGTH 4096 // max for SDP file
|
||||||
#define CPPHTTPLIB_READ_TIMEOUT_SECOND 10
|
|
||||||
|
|
||||||
#include <httplib.h>
|
#include <httplib.h>
|
||||||
|
|
||||||
@ -683,7 +682,9 @@ std::error_code SessionManager::add_sink(const StreamSink& sink) {
|
|||||||
if (boost::iequals(protocol, "http")) {
|
if (boost::iequals(protocol, "http")) {
|
||||||
httplib::Client cli(host.c_str(),
|
httplib::Client cli(host.c_str(),
|
||||||
!atoi(port.c_str()) ? 80 : atoi(port.c_str()));
|
!atoi(port.c_str()) ? 80 : atoi(port.c_str()));
|
||||||
cli.set_timeout_sec(10);
|
cli.set_connection_timeout(10);
|
||||||
|
cli.set_read_timeout(10);
|
||||||
|
cli.set_write_timeout(10);
|
||||||
auto res = cli.Get(path.c_str());
|
auto res = cli.Get(path.c_str());
|
||||||
if (!res) {
|
if (!res) {
|
||||||
BOOST_LOG_TRIVIAL(error)
|
BOOST_LOG_TRIVIAL(error)
|
||||||
|
@ -18,7 +18,6 @@
|
|||||||
//
|
//
|
||||||
|
|
||||||
#define CPPHTTPLIB_PAYLOAD_MAX_LENGTH 4096 // max for SDP file
|
#define CPPHTTPLIB_PAYLOAD_MAX_LENGTH 4096 // max for SDP file
|
||||||
#define CPPHTTPLIB_READ_TIMEOUT_SECOND 30
|
|
||||||
#include <httplib.h>
|
#include <httplib.h>
|
||||||
#include <boost/foreach.hpp>
|
#include <boost/foreach.hpp>
|
||||||
#include <boost/asio.hpp>
|
#include <boost/asio.hpp>
|
||||||
@ -83,7 +82,7 @@ struct DaemonInstance {
|
|||||||
#if defined _MEMORY_CHECK_
|
#if defined _MEMORY_CHECK_
|
||||||
search_path("valgrind"),
|
search_path("valgrind"),
|
||||||
#endif
|
#endif
|
||||||
"../aes67-daemon", "-c", "daemon.conf", "-p", "9999", "-i", "lo"
|
"../aes67-daemon", "-c", "daemon.conf", "-p", "9999"
|
||||||
};
|
};
|
||||||
inline static bool ok{false};
|
inline static bool ok{false};
|
||||||
};
|
};
|
||||||
@ -99,7 +98,9 @@ struct Client {
|
|||||||
multicast::join_group(address::from_string(g_sap_address).to_v4(),
|
multicast::join_group(address::from_string(g_sap_address).to_v4(),
|
||||||
address::from_string(g_daemon_address).to_v4()));
|
address::from_string(g_daemon_address).to_v4()));
|
||||||
|
|
||||||
cli_.set_timeout_sec(30);
|
cli_.set_connection_timeout(30);
|
||||||
|
cli_.set_read_timeout(30);
|
||||||
|
cli_.set_write_timeout(30);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool is_alive() {
|
bool is_alive() {
|
||||||
|
@ -42,7 +42,7 @@ std::tuple<bool /* res */,
|
|||||||
std::string /* port */,
|
std::string /* port */,
|
||||||
std::string /* path */>
|
std::string /* path */>
|
||||||
parse_url(const std::string& _url) {
|
parse_url(const std::string& _url) {
|
||||||
std::string url = httplib::detail::decode_url(_url);
|
std::string url = httplib::detail::decode_url(_url, false);
|
||||||
size_t protocol_sep_pos = url.find_first_of("://");
|
size_t protocol_sep_pos = url.find_first_of("://");
|
||||||
if (protocol_sep_pos == std::string::npos) {
|
if (protocol_sep_pos == std::string::npos) {
|
||||||
/* no protocol, invalid URL */
|
/* no protocol, invalid URL */
|
||||||
|
Loading…
x
Reference in New Issue
Block a user