[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[myserver-commit] [SCM] GNU MyServer branch, master, updated. 0_9_2-190-
From: |
Giuseppe Scrivano |
Subject: |
[myserver-commit] [SCM] GNU MyServer branch, master, updated. 0_9_2-190-g9cb5674 |
Date: |
Mon, 26 Apr 2010 00:07:01 +0000 |
This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "GNU MyServer".
The branch, master has been updated
via 9cb5674a5d98bf1243c89222ca375cbf42ce31b1 (commit)
via ba2d54f65056063ac8024d92fe2d2bac756e9682 (commit)
from bee7894ad4585bca94d75cd71570d123dafad41e (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 9cb5674a5d98bf1243c89222ca375cbf42ce31b1
Author: Giuseppe Scrivano <address@hidden>
Date: Mon Apr 26 02:02:34 2010 +0200
Avoid a premature 404 with resources not mapped directly to the file system
A handler can be registered to handle requests to resources that are not
present on the file system, hence avoid to return immediately a 404 error
status.
diff --git a/myserver/src/protocol/http/http.cpp
b/myserver/src/protocol/http/http.cpp
index 6ce88b0..22799cb 100644
--- a/myserver/src/protocol/http/http.cpp
+++ b/myserver/src/protocol/http/http.cpp
@@ -128,7 +128,6 @@ int Http::optionsHTTPRESOURCE (string& filename, int
yetmapped)
}
ret = Http::preprocessHttpRequest (filename, yetmapped, &permissions);
-
if (ret != 200)
return raiseHTTPError (ret);
@@ -293,16 +292,24 @@ int Http::getFilePermissions (string& filename, string&
directory, string& file,
return ret;
}
- if (FilesUtility::isLink (td->filenamePath.c_str ()))
+ bool isDirectory = false;
+ try
{
- const char *perm = td->securityToken.getData ("symlinks.follow",
+ if (FilesUtility::isLink (td->filenamePath.c_str ()))
+ {
+ const char *perm = td->securityToken.getData ("symlinks.follow",
MYSERVER_VHOST_CONF | MYSERVER_SERVER_CONF,
"NO");
- if (!perm || strcasecmp (perm, "YES"))
- return raiseHTTPError (401);
+ if (!perm || strcasecmp (perm, "YES"))
+ return 401;
+ }
+
+ isDirectory = FilesUtility::isDirectory (filenamePath.c_str ());
}
+ catch (FileNotFoundException & e)
+ {}
- if (FilesUtility::isDirectory (filenamePath.c_str ()))
+ if (isDirectory)
directory.assign (filenamePath);
else
FilesUtility::splitPath (filenamePath, directory, file);
@@ -524,14 +531,10 @@ int Http::preprocessHttpRequest (string& filename, int
yetmapped,
td->mime = mimeLoc ? mimeLoc : getMIME (td->filenamePath);
}
- catch (FileNotFoundException & e)
- {
- return 404;
- }
catch (exception & e)
{
td->connection->host->warningsLogWrite (_E ("HTTP: internal error"), &e);
- return 404;
+ return 500;
}
catch (...)
{
@@ -690,7 +693,16 @@ Http::sendHTTPResource (string& uri, int systemrequest,
int onlyHeader,
if (systemrequest)
td->filenamePath.assign (uri);
- if (!td->mime && FilesUtility::isDirectory (td->filenamePath.c_str ()))
+ bool isDirectory = false;
+
+ try
+ {
+ isDirectory = FilesUtility::isDirectory (td->filenamePath.c_str ());
+ }
+ catch (FileNotFoundException & e)
+ {}
+
+ if (!td->mime && isDirectory)
return processDefaultFile (uri, td->permissions, onlyHeader);
/* If not specified differently, set the default content type to
text/html. */
commit ba2d54f65056063ac8024d92fe2d2bac756e9682
Author: Giuseppe Scrivano <address@hidden>
Date: Mon Apr 26 01:48:57 2010 +0200
Remove arbitrary limit to don't parse nodes without children
diff --git a/myserver/src/conf/vhost/xml_vhost_handler.cpp
b/myserver/src/conf/vhost/xml_vhost_handler.cpp
index 539aca3..32fa61b 100644
--- a/myserver/src/conf/vhost/xml_vhost_handler.cpp
+++ b/myserver/src/conf/vhost/xml_vhost_handler.cpp
@@ -332,12 +332,6 @@ int XmlVhostHandler::load (const char *filename)
XmlConf::build (lcur, vh->getHashedDataTrees (),
vh->getHashedData ());
- if (!lcur->children || !lcur->children->content)
- {
- lcur = lcur->next;
- continue;
- }
-
if (!xmlStrcmp (lcur->name, (const xmlChar *) "HOST"))
{
int useRegex = 0;
-----------------------------------------------------------------------
Summary of changes:
myserver/src/conf/vhost/xml_vhost_handler.cpp | 6 ----
myserver/src/protocol/http/http.cpp | 36 ++++++++++++++++--------
2 files changed, 24 insertions(+), 18 deletions(-)
hooks/post-receive
--
GNU MyServer
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [myserver-commit] [SCM] GNU MyServer branch, master, updated. 0_9_2-190-g9cb5674,
Giuseppe Scrivano <=