Issue 167: Accept connections in subfolders
o According to the poster, the desired feature it supporting arbitrary paths in the request URL s.t. proxying doesn't break SIAB. o Rewrote poster's patch to void pointer arithmetic. o Integrating comments from Markus.
This commit is contained in:
parent
55ca3e827c
commit
52feb7abac
1 changed files with 8 additions and 9 deletions
|
@ -613,17 +613,16 @@ static int shellInABoxHttpHandler(HttpConnection *http, void *arg,
|
||||||
const HashMap *headers = httpGetHeaders(http);
|
const HashMap *headers = httpGetHeaders(http);
|
||||||
const char *contentType = getFromHashMap(headers, "content-type");
|
const char *contentType = getFromHashMap(headers, "content-type");
|
||||||
|
|
||||||
// Normalize the path info
|
// Normalize the path info, present the final path element
|
||||||
const char *pathInfo = urlGetPathInfo(url);
|
const char *pathInfo = urlGetPathInfo(url);
|
||||||
while (*pathInfo == '/') {
|
int pathInfoLength = 0;
|
||||||
pathInfo++;
|
pathInfo = strrchr (pathInfo, '/');
|
||||||
|
if (pathInfo) {
|
||||||
|
++pathInfo;
|
||||||
|
} else {
|
||||||
|
pathInfo = ""; // Cheap way to get an empty string
|
||||||
}
|
}
|
||||||
const char *endPathInfo;
|
pathInfoLength = strlen (pathInfo);
|
||||||
for (endPathInfo = pathInfo;
|
|
||||||
*endPathInfo && *endPathInfo != '/';
|
|
||||||
endPathInfo++) {
|
|
||||||
}
|
|
||||||
int pathInfoLength = endPathInfo - pathInfo;
|
|
||||||
|
|
||||||
if (!pathInfoLength ||
|
if (!pathInfoLength ||
|
||||||
(pathInfoLength == 5 && !memcmp(pathInfo, "plain", 5)) ||
|
(pathInfoLength == 5 && !memcmp(pathInfo, "plain", 5)) ||
|
||||||
|
|
Loading…
Reference in a new issue