* 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;
}
}
return true;
-}
+}
\ No newline at end of file
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())) {