summaryrefslogtreecommitdiff
path: root/src/response.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/response.c')
-rw-r--r--src/response.c28
1 files changed, 25 insertions, 3 deletions
diff --git a/src/response.c b/src/response.c
index 4f23ea9..45a1782 100644
--- a/src/response.c
+++ b/src/response.c
@@ -261,7 +261,13 @@ handler_t http_response_prepare(server *srv, connection *con) {
*/
config_patch_connection(srv, con, COMP_HTTP_URL); /* HTTPurl */
-
+ config_patch_connection(srv, con, COMP_HTTP_QUERYSTRING); /* HTTPqs */
+
+ /* do we have to downgrade to 1.0 ? */
+ if (!con->conf.allow_http11) {
+ con->request.http_version = HTTP_VERSION_1_0;
+ }
+
switch(r = plugins_call_handle_uri_clean(srv, con)) {
case HANDLER_GO_ON:
break;
@@ -451,7 +457,7 @@ handler_t http_response_prepare(server *srv, connection *con) {
log_error_write(srv, __FILE__, __LINE__, "s", "-- handling physical path");
log_error_write(srv, __FILE__, __LINE__, "sb", "Path :", con->physical.path);
}
-
+
if (HANDLER_ERROR != stat_cache_get_entry(srv, con, con->physical.path, &sce)) {
/* file exists */
@@ -459,7 +465,19 @@ handler_t http_response_prepare(server *srv, connection *con) {
log_error_write(srv, __FILE__, __LINE__, "s", "-- file found");
log_error_write(srv, __FILE__, __LINE__, "sb", "Path :", con->physical.path);
}
-
+#ifdef HAVE_LSTAT
+ if ((sce->is_symlink != 0) && !con->conf.follow_symlink) {
+ con->http_status = 403;
+
+ if (con->conf.log_request_handling) {
+ log_error_write(srv, __FILE__, __LINE__, "s", "-- access denied due symlink restriction");
+ log_error_write(srv, __FILE__, __LINE__, "sb", "Path :", con->physical.path);
+ }
+
+ buffer_reset(con->physical.path);
+ return HANDLER_FINISHED;
+ };
+#endif
if (S_ISDIR(sce->st.st_mode)) {
if (con->physical.path->ptr[con->physical.path->used - 2] != '/') {
/* redirect to .../ */
@@ -468,7 +486,11 @@ handler_t http_response_prepare(server *srv, connection *con) {
return HANDLER_FINISHED;
}
+#ifdef HAVE_LSTAT
+ } else if (!S_ISREG(sce->st.st_mode) && !sce->is_symlink) {
+#else
} else if (!S_ISREG(sce->st.st_mode)) {
+#endif
/* any special handling of non-reg files ?*/