diff options
| author | 2025-02-04 18:38:41 +0000 | |
|---|---|---|
| committer | 2025-02-04 18:38:41 +0000 | |
| commit | 114ed37f9c3e57a840155b9b71fa9cdf0d7ec8d6 (patch) | |
| tree | 2a7747beb4d10fef57653ac1b91aed9469819dcd /xs_url.h | |
| parent | Merge branch 'master' into master (diff) | |
| parent | Only split real strings in xs_split_n(). (diff) | |
| download | snac2-114ed37f9c3e57a840155b9b71fa9cdf0d7ec8d6.tar.gz snac2-114ed37f9c3e57a840155b9b71fa9cdf0d7ec8d6.tar.xz snac2-114ed37f9c3e57a840155b9b71fa9cdf0d7ec8d6.zip | |
Merge branch 'master' into master
Diffstat (limited to 'xs_url.h')
| -rw-r--r-- | xs_url.h | 8 |
1 files changed, 7 insertions, 1 deletions
| @@ -17,12 +17,18 @@ xs_str *xs_url_dec(const char *str) | |||
| 17 | xs_str *s = xs_str_new(NULL); | 17 | xs_str *s = xs_str_new(NULL); |
| 18 | 18 | ||
| 19 | while (*str) { | 19 | while (*str) { |
| 20 | if (!xs_is_string(str)) | ||
| 21 | break; | ||
| 22 | |||
| 20 | if (*str == '%') { | 23 | if (*str == '%') { |
| 21 | unsigned int i; | 24 | unsigned int i; |
| 22 | 25 | ||
| 23 | if (sscanf(str + 1, "%02x", &i) == 1) { | 26 | if (sscanf(str + 1, "%02x", &i) == 1) { |
| 24 | unsigned char uc = i; | 27 | unsigned char uc = i; |
| 25 | 28 | ||
| 29 | if (!xs_is_string((char *)&uc)) | ||
| 30 | break; | ||
| 31 | |||
| 26 | s = xs_append_m(s, (char *)&uc, 1); | 32 | s = xs_append_m(s, (char *)&uc, 1); |
| 27 | str += 2; | 33 | str += 2; |
| 28 | } | 34 | } |
| @@ -69,7 +75,7 @@ xs_dict *xs_url_vars(const char *str) | |||
| 69 | 75 | ||
| 70 | vars = xs_dict_new(); | 76 | vars = xs_dict_new(); |
| 71 | 77 | ||
| 72 | if (str != NULL) { | 78 | if (xs_is_string(str)) { |
| 73 | /* split by arguments */ | 79 | /* split by arguments */ |
| 74 | xs *args = xs_split(str, "&"); | 80 | xs *args = xs_split(str, "&"); |
| 75 | 81 | ||