From 55ca3e827c0d9691d55b05d51ad1ae9eb10129c9 Mon Sep 17 00:00:00 2001 From: Marc Singer Date: Wed, 4 Apr 2012 13:53:14 -0700 Subject: [PATCH] Revert "Issue 167: Accept connections in subfolders" This reverts commit 1139b09b62507f8f554b0965742c45dab2b2f455. o Revert this commit in order to revise it. --- shellinabox/shellinaboxd.c | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/shellinabox/shellinaboxd.c b/shellinabox/shellinaboxd.c index de20769..f508c66 100644 --- a/shellinabox/shellinaboxd.c +++ b/shellinabox/shellinaboxd.c @@ -613,15 +613,17 @@ static int shellInABoxHttpHandler(HttpConnection *http, void *arg, const HashMap *headers = httpGetHeaders(http); const char *contentType = getFromHashMap(headers, "content-type"); - // Normalize the path info, present the final path element + // Normalize the path info const char *pathInfo = urlGetPathInfo(url); - int pathInfoLength = 0; - pathInfo = rindex (pathInfo, '/'); - if (pathInfo) - ++pathInfo; - else - pathInfo = ""; /* Cheap way to get an empty string */ - pathInfoLength = strlen (pathInfo); + while (*pathInfo == '/') { + pathInfo++; + } + const char *endPathInfo; + for (endPathInfo = pathInfo; + *endPathInfo && *endPathInfo != '/'; + endPathInfo++) { + } + int pathInfoLength = endPathInfo - pathInfo; if (!pathInfoLength || (pathInfoLength == 5 && !memcmp(pathInfo, "plain", 5)) ||