Project "Tuxbox-GIT: apps": The branch, master has been updated via dbefdbf5bfd0644e17687fadfe2540891cedbc2d (commit) from de72609832873b066be967e924bda85711f57b1f (commit)
Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commit dbefdbf5bfd0644e17687fadfe2540891cedbc2d Author: svenhoefer <svenhoe...@svenhoefer.com> Date: Sat Apr 18 17:54:05 2015 +0200 yWeb: re-introduce 'WebsiteMain.hosted_directory' * this directory can be used to host some of your cracy stuff. It is reachable with <boxip>/hosted/ Signed-off-by: GetAway <get-a...@t-online.de> diff --git a/tuxbox/neutrino/daemons/nhttpd/web/Y_Settings_nhttpd.yhtm b/tuxbox/neutrino/daemons/nhttpd/web/Y_Settings_nhttpd.yhtm index db8d7a7..27bdf6d 100644 --- a/tuxbox/neutrino/daemons/nhttpd/web/Y_Settings_nhttpd.yhtm +++ b/tuxbox/neutrino/daemons/nhttpd/web/Y_Settings_nhttpd.yhtm @@ -73,7 +73,12 @@ function do_submit() <tr> <td>{=L:1507=}</td> <td><input type="text" name="override_directory" size="20" value="{=ini-get:/var/tuxbox/config/nhttpd.conf;WebsiteMain.override_directory~cache=}" title="{=L:1507=}" /> {=L:1504=} - <input type="hidden" name="HostedDocRoot" size="60" value="{=ini-get:/var/tuxbox/config/nhttpd.conf;WebsiteMain.hosted_directory~cache=}" title="{=L:1509=}" /></td> + </td> + </tr> + <tr> + <td>{=L:1508=}</td> + <td><input type="text" name="hosted_directory" size="20" value="{=ini-get:/var/tuxbox/config/nhttpd.conf;WebsiteMain.hosted_directory~cache=}" title="{=L:1509=}" /> {=L:1504=} + </td> </tr> <tr> <td>{=L:1510=}</td> diff --git a/tuxbox/neutrino/daemons/nhttpd/web/Y_Version.txt b/tuxbox/neutrino/daemons/nhttpd/web/Y_Version.txt index efe1e79..240e189 100644 --- a/tuxbox/neutrino/daemons/nhttpd/web/Y_Version.txt +++ b/tuxbox/neutrino/daemons/nhttpd/web/Y_Version.txt @@ -1,4 +1,4 @@ -version=2.8.2.2 -date=17.04.2015 +version=2.8.2.21 +date=18.04.2015 type=Release info=Tuxbox diff --git a/tuxbox/neutrino/daemons/nhttpd/yconfig.h b/tuxbox/neutrino/daemons/nhttpd/yconfig.h index ccd4656..c5355aa 100644 --- a/tuxbox/neutrino/daemons/nhttpd/yconfig.h +++ b/tuxbox/neutrino/daemons/nhttpd/yconfig.h @@ -115,6 +115,7 @@ #define PRIVATEDOCUMENTROOT "/home/y/nhttpd-y" #define PUBLICDOCUMENTROOT "/var/httpd" #define HOSTEDDOCUMENTROOT "/mnt/hosted" +#define HOSTEDDOCUMENTURL "/hosted/" #define SSL_PEMFILE HTTPD_CONFIGDIR "/server.pem" #define SSL_CA_FILE HTTPD_CONFIGDIR "/cacert.pem" @@ -142,6 +143,7 @@ #define PRIVATEDOCUMENTROOT "/cygdrive/d/Work/y/ws/nhttpd30/web" #define PUBLICDOCUMENTROOT "/var/httpd" #define HOSTEDDOCUMENTROOT "/mnt/hosted" +#define HOSTEDDOCUMENTURL "/hosted/" #define SSL_PEMFILE HTTPD_CONFIGDIR "/server.pem" #define SSL_CA_FILE HTTPD_CONFIGDIR "/cacert.pem" @@ -175,6 +177,7 @@ #define PUBLICDOCUMENTROOT "/var/httpd" #define NEUTRINO_CONFIGFILE CONFIGDIR "/neutrino.conf" #define HOSTEDDOCUMENTROOT "/mnt/hosted" +#define HOSTEDDOCUMENTURL "/hosted/" #define EXTRASDOCUMENTROOT "/mnt/hosted/extras" #define EXTRASDOCUMENTURL "/hosted/extras" #define ZAPITXMLPATH CONFIGDIR "/zapit" @@ -211,6 +214,7 @@ #define PRIVATEDOCUMENTROOT "/tmp/web" //FIXME: Test #define PUBLICDOCUMENTROOT "/var/httpd" #define HOSTEDDOCUMENTROOT "/mnt/hosted" +#define HOSTEDDOCUMENTURL "/hosted/" #define SSL_PEMFILE HTTPD_CONFIGDIR "/server.pem" #define SSL_CA_FILE HTTPD_CONFIGDIR "/cacert.pem" diff --git a/tuxbox/neutrino/daemons/nhttpd/yhttpd_core/yresponse.cpp b/tuxbox/neutrino/daemons/nhttpd/yhttpd_core/yresponse.cpp index 981edd5..b8dfff2 100644 --- a/tuxbox/neutrino/daemons/nhttpd/yhttpd_core/yresponse.cpp +++ b/tuxbox/neutrino/daemons/nhttpd/yhttpd_core/yresponse.cpp @@ -65,16 +65,6 @@ bool CWebserverResponse::SendResponse() // Checking and Preperation: Auth, static, cache, ... //-------------------------------------------------------------- -// move to mod_sendfile ??? -#ifdef Y_CONFIG_USE_HOSTEDWEB - // for hosted webs: rewrite URL - std::string _hosted="/hosted/"; - if((Connection->Request.UrlData["path"]).compare(0,_hosted.length(),"/hosted/") == 0) // hosted Web ? - Connection->Request.UrlData["path"]=Cyhttpd::ConfigList["WebsiteMain.hosted_directory"] - +(Connection->Request.UrlData["path"]).substr(_hosted.length()-1); -#endif //Y_CONFIG_USE_HOSTEDWEB - log_level_printf(5,"UrlPath:%s\n",(Connection->Request.UrlData["path"]).c_str()); - do { if(Connection->RequestCanceled) diff --git a/tuxbox/neutrino/daemons/nhttpd/yhttpd_mods/mod_sendfile.cpp b/tuxbox/neutrino/daemons/nhttpd/yhttpd_mods/mod_sendfile.cpp index c8f15b2..a98a8bf 100644 --- a/tuxbox/neutrino/daemons/nhttpd/yhttpd_mods/mod_sendfile.cpp +++ b/tuxbox/neutrino/daemons/nhttpd/yhttpd_mods/mod_sendfile.cpp @@ -69,16 +69,23 @@ THandleStatus CmodSendfile::Hook_PrepareResponse(CyhookHandler *hh) { hh->status = HANDLED_NONE; - int filed; log_level_printf(4,"mod_sendfile prepare hook start url:%s\n",hh->UrlData["fullurl"].c_str()); + +#ifdef Y_CONFIG_USE_HOSTEDWEB + // for hosted webs: rewrite URL + std::string _hosted=HOSTEDDOCUMENTURL; + if((hh->UrlData["path"]).compare(0,_hosted.length(),HOSTEDDOCUMENTURL) == 0) // hosted Web ? + hh->UrlData["path"]=hh->WebserverConfigList["WebsiteMain.hosted_directory"]+(hh->UrlData["path"]).substr(_hosted.length()-1); +#endif //Y_CONFIG_USE_HOSTEDWEB + std::string mime = sendfileTypes[hh->UrlData["fileext"]]; if(!mime.empty() || (hh->WebserverConfigList["mod_sendfile.sendAll"] == "true") && hh->UrlData["fileext"] != "yhtm") { //TODO: Check allowed directories / actually in GetFileName // build filename std::string fullfilename = GetFileName(hh, hh->UrlData["path"], hh->UrlData["filename"]); - filed = OpenFile(hh, fullfilename); - if( filed != -1 ) //can access file? + int filed; + if ((filed = OpenFile(hh, fullfilename)) != -1) //can access file? { struct stat statbuf; hh->LastModified = (time_t)0; @@ -120,7 +127,8 @@ THandleStatus CmodSendfile::Hook_PrepareResponse(CyhookHandler *hh) } else { - aprintf("mod_sendfile: File not found. url:(%s)\n", hh->UrlData["url"].c_str()); + aprintf("mod_sendfile: File not found. url:(%s) fullfilename:(%s)\n", + hh->UrlData["url"].c_str(), fullfilename.c_str()); hh->SetError(HTTP_NOT_FOUND); } } diff --git a/tuxbox/neutrino/daemons/nhttpd/yhttpd_mods/mod_yparser.cpp b/tuxbox/neutrino/daemons/nhttpd/yhttpd_mods/mod_yparser.cpp index 7d12e95..d2957e9 100644 --- a/tuxbox/neutrino/daemons/nhttpd/yhttpd_mods/mod_yparser.cpp +++ b/tuxbox/neutrino/daemons/nhttpd/yhttpd_mods/mod_yparser.cpp @@ -285,19 +285,26 @@ std::string CyParser::cgi_file_parsing(CyhookHandler *hh, std::string htmlfilena bool found = false; std::string htmlfullfilename, yresult, html_template; - for (unsigned int i=0;i<HTML_DIR_COUNT && !found;i++) - { - htmlfullfilename = HTML_DIRS[i]+"/"+htmlfilename; + bool isHosted = false; +#ifdef Y_CONFIG_USE_HOSTEDWEB + // for hosted webs: search in hosted_directory only + std::string _hosted=hh->WebserverConfigList["WebsiteMain.hosted_directory"]; + if((hh->UrlData["path"]).compare(0,_hosted.length(),hh->WebserverConfigList["WebsiteMain.hosted_directory"]) == 0) // hosted Web ? + isHosted = true; +#endif //Y_CONFIG_USE_HOSTEDWEB + + char cwd[255]; + getcwd(cwd, 254); + for (unsigned int i = 0; i < (isHosted ? 1 : HTML_DIR_COUNT) && !found; i++) { + htmlfullfilename = (isHosted ? "" : HTML_DIRS[i]) + "/" + htmlfilename; std::fstream fin(htmlfullfilename.c_str(), std::fstream::in); - if(fin.good()) - { + if (fin.good()) { found = true; chdir(HTML_DIRS[i].c_str()); // set working dir // read whole file into html_template std::string ytmp; - while (!fin.eof()) - { + while (!fin.eof()) { getline(fin, ytmp); html_template = html_template + ytmp + "\r\n"; } @@ -305,12 +312,13 @@ std::string CyParser::cgi_file_parsing(CyhookHandler *hh, std::string htmlfilena fin.close(); } } - if (!found) - { - printf("[CyParser] Y-cgi:template %s not found in\n",htmlfilename.c_str()); - for (unsigned int i=0;i<HTML_DIR_COUNT;i++) { - printf("%s\n",HTML_DIRS[i].c_str()); - } + chdir(cwd); + if (!found) { + printf("[CyParser] Y-cgi:template %s not found %s\n", htmlfilename.c_str(), isHosted ? "" : "in"); + if (!isHosted) + for (unsigned int i = 0; i < HTML_DIR_COUNT; i++) { + printf("%s\n", HTML_DIRS[i].c_str()); + } } return yresult; } ----------------------------------------------------------------------- Summary of changes: .../daemons/nhttpd/web/Y_Settings_nhttpd.yhtm | 7 +++- tuxbox/neutrino/daemons/nhttpd/web/Y_Version.txt | 4 +- tuxbox/neutrino/daemons/nhttpd/yconfig.h | 4 ++ .../daemons/nhttpd/yhttpd_core/yresponse.cpp | 10 ------ .../daemons/nhttpd/yhttpd_mods/mod_sendfile.cpp | 16 +++++++-- .../daemons/nhttpd/yhttpd_mods/mod_yparser.cpp | 34 ++++++++++++------- 6 files changed, 45 insertions(+), 30 deletions(-) -- Tuxbox-GIT: apps ------------------------------------------------------------------------------ BPM Camp - Free Virtual Workshop May 6th at 10am PDT/1PM EDT Develop your own process in accordance with the BPMN 2 standard Learn Process modeling best practices with Bonita BPM through live exercises http://www.bonitasoft.com/be-part-of-it/events/bpm-camp-virtual- event?utm_ source=Sourceforge_BPM_Camp_5_6_15&utm_medium=email&utm_campaign=VA_SF _______________________________________________ Tuxbox-cvs-commits mailing list Tuxbox-cvs-commits@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/tuxbox-cvs-commits