projects
/
project
/
uhttpd.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
47627fa
)
add uh_path_match()
author
Felix Fietkau
<nbd@openwrt.org>
Tue, 1 Jan 2013 19:08:13 +0000
(20:08 +0100)
committer
Felix Fietkau
<nbd@openwrt.org>
Tue, 1 Jan 2013 19:08:13 +0000
(20:08 +0100)
utils.c
patch
|
blob
|
history
utils.h
patch
|
blob
|
history
diff --git
a/utils.c
b/utils.c
index
847ff34
..
477296f
100644
(file)
--- a/
utils.c
+++ b/
utils.c
@@
-189,3
+189,13
@@
int uh_b64decode(char *buf, int blen, const unsigned char *src, int slen)
buf[len++] = 0;
return len;
}
buf[len++] = 0;
return len;
}
+
+bool uh_path_match(const char *prefix, const char *url)
+{
+ int len = strlen(prefix);
+
+ if (strncmp(url, prefix, len) != 0)
+ return false;
+
+ return url[len] == '/' || url[len] == 0;
+}
diff --git
a/utils.h
b/utils.h
index
4f74f5c
..
07db0cf
100644
(file)
--- a/
utils.h
+++ b/
utils.h
@@
-55,4
+55,6
@@
static inline void clearenv(void)
int uh_urldecode(char *buf, int blen, const char *src, int slen);
int uh_urlencode(char *buf, int blen, const char *src, int slen);
int uh_b64decode(char *buf, int blen, const unsigned char *src, int slen);
int uh_urldecode(char *buf, int blen, const char *src, int slen);
int uh_urlencode(char *buf, int blen, const char *src, int slen);
int uh_b64decode(char *buf, int blen, const unsigned char *src, int slen);
+bool uh_path_match(const char *prefix, const char *url);
+
#endif
#endif