mirror of
https://github.com/ossrs/srs.git
synced 2025-03-09 15:49:59 +00:00
for bug #277, use http not found when no file.
This commit is contained in:
parent
398b212bfa
commit
f1393ee43f
2 changed files with 10 additions and 1 deletions
|
@ -26,7 +26,7 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|||
#ifdef SRS_AUTO_HTTP_PARSER
|
||||
|
||||
#include <stdlib.h>
|
||||
|
||||
#include <sys/stat.h>
|
||||
using namespace std;
|
||||
|
||||
#include <srs_kernel_error.hpp>
|
||||
|
@ -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());
|
||||
|
||||
|
|
|
@ -265,6 +265,7 @@ public:
|
|||
class SrsGoHttpServeMux
|
||||
{
|
||||
private:
|
||||
// the pattern handler.
|
||||
std::map<std::string, SrsGoHttpMuxEntry*> entries;
|
||||
// the vhost handler.
|
||||
std::map<std::string, ISrsGoHttpHandler*> vhosts;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue