summaryrefslogtreecommitdiff
path: root/url.c
diff options
context:
space:
mode:
Diffstat (limited to 'url.c')
-rw-r--r--url.c11
1 files changed, 9 insertions, 2 deletions
diff --git a/url.c b/url.c
index 72c02a0..228efeb 100644
--- a/url.c
+++ b/url.c
@@ -38,9 +38,9 @@
#include "url.h"
bool
-check_request_path(char *path)
+check_request_path(char *path, char *suffix)
{
- char p [PATH_MAX], resolved[PATH_MAX];
+ char p[PATH_MAX], resolved[PATH_MAX];
char *rp;
/* build absolute path from DATA_DIR */
@@ -50,6 +50,13 @@ check_request_path(char *path)
return false;
if (strlcat(p, path, sizeof(p)) >= sizeof(p))
return false;
+ if (strlen(suffix) > 0) {
+ /* add suffix */
+ if(strlcat(p, ".", sizeof(p)) >= sizeof(p))
+ return false;
+ if(strlcat(p, suffix, sizeof(p)) >= sizeof(p))
+ return false;
+ }
/* canonicalize the path */
rp = realpath(p, resolved);