summaryrefslogtreecommitdiff
path: root/server_http.c
diff options
context:
space:
mode:
authorReyk Floeter <reyk@esdenera.com>2015-01-05 11:52:20 +0100
committerReyk Floeter <reyk@esdenera.com>2015-01-05 11:52:20 +0100
commit101ee3483346ad2f557a74f7268f9331a383567e (patch)
tree51e2cd823ce9bc2676b08ea9d6dfa1188fe8ab10 /server_http.c
parentb3c443d887736739b9866fb07958b8a845e48474 (diff)
downloadhttpd-101ee3483346ad2f557a74f7268f9331a383567e.tar.gz
httpd-101ee3483346ad2f557a74f7268f9331a383567e.zip
sync with -current
Diffstat (limited to 'server_http.c')
-rw-r--r--server_http.c17
1 files changed, 16 insertions, 1 deletions
diff --git a/server_http.c b/server_http.c
index 3a5d84e..d83c7b4 100644
--- a/server_http.c
+++ b/server_http.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: server_http.c,v 1.58 2015/01/01 14:15:02 reyk Exp $ */
+/* $OpenBSD: server_http.c,v 1.59 2015/01/04 22:23:58 chrisz Exp $ */
/*
* Copyright (c) 2006 - 2014 Reyk Floeter <reyk@openbsd.org>
@@ -887,6 +887,21 @@ server_response(struct httpd *httpd, struct client *clt)
return (-1);
}
+const char *
+server_root_strip(const char *path, int n)
+{
+ const char *p;
+
+ /* Strip strip leading directories. Leading '/' is ignored. */
+ for (; n > 0 && *path != '\0'; n--)
+ if ((p = strchr(++path, '/')) == NULL)
+ path = strchr(path, '\0');
+ else
+ path = p;
+
+ return (path);
+}
+
struct server_config *
server_getlocation(struct client *clt, const char *path)
{