Removed sequential content forward when acting as http proxy. 57/7957/1
authorMauro Sardara <[email protected]>
Wed, 9 Aug 2017 11:24:33 +0000 (13:24 +0200)
committerMauro Sardara <[email protected]>
Wed, 9 Aug 2017 11:24:33 +0000 (13:24 +0200)
Change-Id: I19a146a9b306b3504cd40d15b909b3a923af8840
Signed-off-by: Mauro Sardara <[email protected]>
http-client/http_client.cc
main.cc

index a2e9800..221e7bb 100644 (file)
@@ -13,7 +13,6 @@
  * limitations under the License.
  */
 
-#include "response.h"
 #include "http_client.h"
 
 #include <curl/curl.h>
 #include <iostream>
 
 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 56e8fed..e3b6e07 100644 (file)
--- 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())) {