winlin

update http stream. change to 0.9.49

@@ -52,9 +52,8 @@ SrsHttpRoot::~SrsHttpRoot() @@ -52,9 +52,8 @@ SrsHttpRoot::~SrsHttpRoot()
52 int SrsHttpRoot::initialize() 52 int SrsHttpRoot::initialize()
53 { 53 {
54 int ret = ERROR_SUCCESS; 54 int ret = ERROR_SUCCESS;
55 -  
56 - // add root  
57 - handlers.push_back(new SrsHttpVhost("__http__", "/", _srs_config->get_http_stream_dir())); 55 +
  56 + bool default_root_exists = false;
58 57
59 // add other virtual path 58 // add other virtual path
60 SrsConfDirective* root = _srs_config->get_root(); 59 SrsConfDirective* root = _srs_config->get_root();
@@ -74,6 +73,16 @@ int SrsHttpRoot::initialize() @@ -74,6 +73,16 @@ int SrsHttpRoot::initialize()
74 std::string dir = _srs_config->get_vhost_http_dir(vhost); 73 std::string dir = _srs_config->get_vhost_http_dir(vhost);
75 74
76 handlers.push_back(new SrsHttpVhost(vhost, mount, dir)); 75 handlers.push_back(new SrsHttpVhost(vhost, mount, dir));
  76 +
  77 + if (mount == "/") {
  78 + default_root_exists = true;
  79 + }
  80 + }
  81 +
  82 + if (!default_root_exists) {
  83 + // add root
  84 + handlers.push_back(new SrsHttpVhost(
  85 + "__http__", "/", _srs_config->get_http_stream_dir()));
77 } 86 }
78 87
79 return ret; 88 return ret;
@@ -86,7 +95,7 @@ bool SrsHttpRoot::can_handle(const char* path, int length, const char** pchild) @@ -86,7 +95,7 @@ bool SrsHttpRoot::can_handle(const char* path, int length, const char** pchild)
86 *pchild = path; 95 *pchild = path;
87 96
88 // never handle request for root. 97 // never handle request for root.
89 - return false; 98 + return true;
90 } 99 }
91 100
92 bool SrsHttpRoot::is_handler_valid(SrsHttpMessage* req, int& status_code, std::string& reason_phrase) 101 bool SrsHttpRoot::is_handler_valid(SrsHttpMessage* req, int& status_code, std::string& reason_phrase)