mirror of
https://github.com/cesanta/mongoose.git
synced 2026-10-31 13:00:49 +00:00
Add mg_url_encode_opt()
CL: Add `mg_url_encode_opt()` - a parametrized version of `mg_url_encode()` PUBLISHED_FROM=17fa57a7a5325b51b6e3aef3855eac4e82c35782
This commit is contained in:
1 parent
c2fbff6d0e
commit
e89be2e944
6 files changed
+81
-18
No files matched your search
+8
-1
@@ -196,10 +196,17 @@ void mg_basic_auth_header(const struct mg_str user, const struct mg_str pass,
|
||||
|
||||
/*
|
||||
* URL-escape the specified string.
|
||||
* All non-printable characters are escaped, plus `._-$,;~()/`.
|
||||
* All characters acept letters, numbers and characters listed in
|
||||
* `safe` are escaped. If `hex_upper`is true, `A-F` are used for hex digits.
|
||||
* Input need not be NUL-terminated, but the returned string is.
|
||||
* Returned string is heap-allocated and must be free()'d.
|
||||
*/
|
||||
#define MG_URL_ENCODE_F_SPACE_AS_PLUS (1 << 0)
|
||||
#define MG_URL_ENCODE_F_UPPERCASE_HEX (1 << 1)
|
||||
struct mg_str mg_url_encode_opt(const struct mg_str src,
|
||||
const struct mg_str safe, unsigned int flags);
|
||||
|
||||
/* Same as `mg_url_encode_opt(src, "._-$,;~()/", 0)`. */
|
||||
struct mg_str mg_url_encode(const struct mg_str src);
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
||||
Reference in new issue
Block a user