mirror of
https://github.com/cesanta/mongoose.git
synced 2026-10-27 12:26:24 +00:00
Add mg_remove_double_dots(), hide mg_http_upload()
This commit is contained in:
1 parent
c5751b0bd3
commit
56412193e7
6 files changed
+69
-95
No files matched your search
@@ -196,7 +196,6 @@ void mg_unhex(const char *buf, size_t len, unsigned char *to) {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
uint64_t mg_tou64(struct mg_str str) {
|
||||
uint64_t result = 0;
|
||||
size_t i = 0;
|
||||
@@ -222,3 +221,24 @@ int64_t mg_to64(struct mg_str str) {
|
||||
}
|
||||
return result * neg;
|
||||
}
|
||||
|
||||
char *mg_remove_double_dots(char *s) {
|
||||
char *p = s;
|
||||
while (*s != '\0') {
|
||||
*p++ = *s++;
|
||||
if (s[-1] == '/' || s[-1] == '\\') {
|
||||
while (s[0] != '\0') {
|
||||
if (s[0] == '/' || s[0] == '\\') {
|
||||
s++;
|
||||
} else if (s[0] == '.' && s[1] == '.' &&
|
||||
(s[2] == '/' || s[2] == '\\')) {
|
||||
s += 2;
|
||||
} else {
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
*p = '\0';
|
||||
return s;
|
||||
}
|
||||
Reference in new issue
Block a user