diff options
| author | Felix Domke <tmbinc@elitedvb.net> | 2005-01-09 16:29:34 +0000 |
|---|---|---|
| committer | Felix Domke <tmbinc@elitedvb.net> | 2005-01-09 16:29:34 +0000 |
| commit | ba02fb4aced5868d047a5bffbd2ed87583daee4d (patch) | |
| tree | bcfea66b1f7fd2212539a99abc074de1424ac9a0 /lib/network/http_file.cpp | |
| parent | 2494509cd031727d92c6556089c99711d16d8af9 (diff) | |
| download | enigma2-ba02fb4aced5868d047a5bffbd2ed87583daee4d.tar.gz enigma2-ba02fb4aced5868d047a5bffbd2ed87583daee4d.zip | |
- add more python stuff
- fix some gui/gdi
- add eslider
- improve windowstyle
Diffstat (limited to 'lib/network/http_file.cpp')
| -rw-r--r-- | lib/network/http_file.cpp | 25 |
1 files changed, 19 insertions, 6 deletions
diff --git a/lib/network/http_file.cpp b/lib/network/http_file.cpp index 2b47d63c..6c6abc83 100644 --- a/lib/network/http_file.cpp +++ b/lib/network/http_file.cpp @@ -6,6 +6,8 @@ #include <shadow.h> #include <pwd.h> +DEFINE_REF(eHTTPFile); + eHTTPFile::eHTTPFile(eHTTPConnection *c, int _fd, int method, const char *mime): eHTTPDataSource(c), method(method) { fd=_fd; @@ -58,7 +60,6 @@ eHTTPFile::~eHTTPFile() eHTTPFilePathResolver::eHTTPFilePathResolver() { -#warning autodelete removed } @@ -138,7 +139,9 @@ static int checkAuth(const std::string cauth) return 0; } -eHTTPDataSource *eHTTPFilePathResolver::getDataSource(std::string request, std::string path, eHTTPConnection *conn) +DEFINE_REF(eHTTPFilePathResolver); + +RESULT eHTTPFilePathResolver::getDataSource(eHTTPDataSourcePtr &ptr, std::string request, std::string path, eHTTPConnection *conn) { int method; eDebug("request = %s, path = %s", request.c_str(), path.c_str()); @@ -147,9 +150,15 @@ eHTTPDataSource *eHTTPFilePathResolver::getDataSource(std::string request, std:: else if (request == "PUT") method=eHTTPFile::methodPUT; else - return new eHTTPError(conn, 405); // method not allowed + { + ptr = new eHTTPError(conn, 405); // method not allowed + return 0; + } if (path.find("../")!=std::string::npos) // evil hax0r - return new eHTTPError(conn, 403); + { + ptr = new eHTTPError(conn, 403); + return 0; + } if (path[0] != '/') // prepend '/' path.insert(0,"/"); if (path[path.length()-1]=='/') @@ -171,7 +180,8 @@ eHTTPDataSource *eHTTPFilePathResolver::getDataSource(std::string request, std:: if ((i == conn->remote_header.end()) || checkAuth(i->second)) { conn->local_header["WWW-Authenticate"]="Basic realm=\"dreambox\""; - return new eHTTPError(conn, 401); // auth req'ed + ptr = new eHTTPError(conn, 401); // auth req'ed + return 0; } } @@ -215,7 +225,10 @@ eHTTPDataSource *eHTTPFilePathResolver::getDataSource(std::string request, std:: break; } } - return data; + if (!data) + return -1; + ptr = data; + return 0; } void eHTTPFilePathResolver::addTranslation(std::string path, std::string root, int authorized) |
