From c5d3b11a6eb38c6dbac6bc70c5596d004fb151a0 Mon Sep 17 00:00:00 2001 From: winlin Date: Fri, 4 Apr 2014 23:16:31 +0800 Subject: [PATCH] update http stream. change to 0.9.49 --- trunk/src/app/srs_app_http_conn.cpp | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/trunk/src/app/srs_app_http_conn.cpp b/trunk/src/app/srs_app_http_conn.cpp index a6d691d07..c73c76306 100644 --- a/trunk/src/app/srs_app_http_conn.cpp +++ b/trunk/src/app/srs_app_http_conn.cpp @@ -52,9 +52,8 @@ SrsHttpRoot::~SrsHttpRoot() int SrsHttpRoot::initialize() { int ret = ERROR_SUCCESS; - - // add root - handlers.push_back(new SrsHttpVhost("__http__", "/", _srs_config->get_http_stream_dir())); + + bool default_root_exists = false; // add other virtual path SrsConfDirective* root = _srs_config->get_root(); @@ -74,6 +73,16 @@ int SrsHttpRoot::initialize() std::string dir = _srs_config->get_vhost_http_dir(vhost); handlers.push_back(new SrsHttpVhost(vhost, mount, dir)); + + if (mount == "/") { + default_root_exists = true; + } + } + + if (!default_root_exists) { + // add root + handlers.push_back(new SrsHttpVhost( + "__http__", "/", _srs_config->get_http_stream_dir())); } return ret; @@ -86,7 +95,7 @@ bool SrsHttpRoot::can_handle(const char* path, int length, const char** pchild) *pchild = path; // never handle request for root. - return false; + return true; } bool SrsHttpRoot::is_handler_valid(SrsHttpMessage* req, int& status_code, std::string& reason_phrase)