diff options
Diffstat (limited to 'http.c')
| -rw-r--r-- | http.c | 31 |
1 files changed, 19 insertions, 12 deletions
| @@ -140,25 +140,32 @@ int check_signature(xs_dict *req, xs_str **err) | |||
| 140 | { | 140 | { |
| 141 | /* extract the values */ | 141 | /* extract the values */ |
| 142 | xs *l = xs_split(sig_hdr, ","); | 142 | xs *l = xs_split(sig_hdr, ","); |
| 143 | xs_list *p; | 143 | xs_list *p = l; |
| 144 | xs_val *v; | 144 | xs_val *v; |
| 145 | 145 | ||
| 146 | p = l; | ||
| 147 | while (xs_list_iter(&p, &v)) { | 146 | while (xs_list_iter(&p, &v)) { |
| 148 | if (xs_startswith(v, "keyId")) | 147 | xs *kv = xs_split_n(v, "=", 1); |
| 149 | keyId = xs_crop_i(xs_dup(v), 7, -1); | 148 | |
| 149 | if (xs_list_len(kv) != 2) | ||
| 150 | continue; | ||
| 151 | |||
| 152 | xs *k1 = xs_strip_i(xs_dup(xs_list_get(kv, 0))); | ||
| 153 | xs *v1 = xs_strip_chars_i(xs_dup(xs_list_get(kv, 1)), " \""); | ||
| 154 | |||
| 155 | if (!strcmp(k1, "keyId")) | ||
| 156 | keyId = xs_dup(v1); | ||
| 150 | else | 157 | else |
| 151 | if (xs_startswith(v, "headers")) | 158 | if (!strcmp(k1, "headers")) |
| 152 | headers = xs_crop_i(xs_dup(v), 9, -1); | 159 | headers = xs_dup(v1); |
| 153 | else | 160 | else |
| 154 | if (xs_startswith(v, "signature")) | 161 | if (!strcmp(k1, "signature")) |
| 155 | signature = xs_crop_i(xs_dup(v), 11, -1); | 162 | signature = xs_dup(v1); |
| 156 | else | 163 | else |
| 157 | if (xs_startswith(v, "created")) | 164 | if (!strcmp(k1, "created")) |
| 158 | created = xs_crop_i(xs_dup(v), 9, -1); | 165 | created = xs_dup(v1); |
| 159 | else | 166 | else |
| 160 | if (xs_startswith(v, "expires")) | 167 | if (!strcmp(k1, "expires")) |
| 161 | expires = xs_crop_i(xs_dup(v), 9, -1); | 168 | expires = xs_dup(v1); |
| 162 | } | 169 | } |
| 163 | } | 170 | } |
| 164 | 171 | ||