From 0475d783825a6f649853da581df5d812cf5f3bae Mon Sep 17 00:00:00 2001 From: Mauro Sardara Date: Wed, 9 Aug 2017 13:24:33 +0200 Subject: Removed sequential content forward when acting as http proxy. Change-Id: I19a146a9b306b3504cd40d15b909b3a923af8840 Signed-off-by: Mauro Sardara --- http-client/http_client.cc | 7 ++----- main.cc | 8 ++++---- 2 files changed, 6 insertions(+), 9 deletions(-) diff --git a/http-client/http_client.cc b/http-client/http_client.cc index a2e9800b..221e7bbe 100644 --- a/http-client/http_client.cc +++ b/http-client/http_client.cc @@ -13,7 +13,6 @@ * limitations under the License. */ -#include "response.h" #include "http_client.h" #include @@ -21,11 +20,9 @@ #include using namespace std; -using namespace icn_httpserver; size_t write_data(void *ptr, size_t size, size_t nmemb, void *stream) { - ((Response*) stream)->write((const char*)ptr, size * nmemb); - ((Response*) stream)->send(); + ((ostream*) stream)->write((const char*)ptr, size * nmemb); return size * nmemb; } @@ -59,4 +56,4 @@ bool HTTPClient::download(const std::string& url, std::ostream& out) { } return true; -} +} \ No newline at end of file diff --git a/main.cc b/main.cc index 56e8fedc..e3b6e078 100644 --- a/main.cc +++ b/main.cc @@ -153,14 +153,14 @@ int main(int argc, char **argv) { boost::filesystem::path path = web_root_path; path /= request->getPath(); + if (path.extension().string() == ".mpd") { + response->setResponseLifetime(std::chrono::milliseconds(1000)); + } + if (boost::filesystem::exists(path)) { path = boost::filesystem::canonical(path); - if (path.extension().string() == ".mpd") { - response->setResponseLifetime(std::chrono::milliseconds(1000)); - } - //Check if path is within web_root_path if (distance(web_root_path.begin(), web_root_path.end()) <= distance(path.begin(), path.end()) && equal(web_root_path.begin(), web_root_path.end(), path.begin())) { -- cgit 1.2.3-korg