diff --git a/trunk/src/app/srs_app_http.cpp b/trunk/src/app/srs_app_http.cpp index c5014ce0d..91a48763c 100644 --- a/trunk/src/app/srs_app_http.cpp +++ b/trunk/src/app/srs_app_http.cpp @@ -26,7 +26,7 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. #ifdef SRS_AUTO_HTTP_PARSER #include - +#include using namespace std; #include @@ -294,6 +294,14 @@ int SrsGoHttpFileServer::serve_http(ISrsGoHttpResponseWriter* w, SrsHttpMessage* } else { fullpath += upath; } + + // stat current dir, if exists, return error. + struct stat st; + if (stat(fullpath.c_str(), &st) != 0) { + srs_warn("http miss file=%s, pattern=%s, upath=%s", + fullpath.c_str(), entry->pattern.c_str(), upath.c_str()); + return SrsGoHttpNotFoundHandler().serve_http(w, r); + } srs_trace("http match file=%s, pattern=%s, upath=%s", fullpath.c_str(), entry->pattern.c_str(), upath.c_str()); diff --git a/trunk/src/app/srs_app_http.hpp b/trunk/src/app/srs_app_http.hpp index df8906834..2a39bec69 100644 --- a/trunk/src/app/srs_app_http.hpp +++ b/trunk/src/app/srs_app_http.hpp @@ -265,6 +265,7 @@ public: class SrsGoHttpServeMux { private: + // the pattern handler. std::map entries; // the vhost handler. std::map vhosts;