diff options
| author | 2026-02-03 07:15:22 +0100 | |
|---|---|---|
| committer | 2026-02-03 07:15:22 +0100 | |
| commit | 083a3387fcdc74b737117a018a59a3c2e6f158bd (patch) | |
| tree | 6eb576f2a4a35c7642ff8bdf994002e91c9e15f8 | |
| parent | Use the translated month names in date labels. (diff) | |
| download | snac2-083a3387fcdc74b737117a018a59a3c2e6f158bd.tar.gz snac2-083a3387fcdc74b737117a018a59a3c2e6f158bd.tar.xz snac2-083a3387fcdc74b737117a018a59a3c2e6f158bd.zip | |
Tweaked check_signature() for GET variables.
Instead of unconditionally stripping ? variables when retrieving the keyId,
try first calling actor_request() directly, and only strip them and retry
if it fails.
| -rw-r--r-- | http.c | 18 |
1 files changed, 13 insertions, 5 deletions
| @@ -182,14 +182,22 @@ int check_signature(const xs_dict *req, xs_str **err) | |||
| 182 | if ((p = strchr(keyId, '#')) != NULL) | 182 | if ((p = strchr(keyId, '#')) != NULL) |
| 183 | *p = '\0'; | 183 | *p = '\0'; |
| 184 | 184 | ||
| 185 | /* also strip cgi variables */ | ||
| 186 | if ((p = strchr(keyId, '?')) != NULL) | ||
| 187 | *p = '\0'; | ||
| 188 | |||
| 189 | xs *actor = NULL; | 185 | xs *actor = NULL; |
| 190 | int status; | 186 | int status; |
| 191 | 187 | ||
| 192 | if (!valid_status((status = actor_request(NULL, keyId, &actor)))) { | 188 | /* does it have ? variables? */ |
| 189 | if ((p = strchr(keyId, '?')) != NULL) { | ||
| 190 | /* try first with them */ | ||
| 191 | if (!valid_status((status = actor_request(NULL, keyId, &actor)))) { | ||
| 192 | *p = '\0'; | ||
| 193 | /* retry stripping them */ | ||
| 194 | status = actor_request(NULL, keyId, &actor); | ||
| 195 | } | ||
| 196 | } | ||
| 197 | else | ||
| 198 | status = actor_request(NULL, keyId, &actor); | ||
| 199 | |||
| 200 | if (!valid_status(status)) { | ||
| 193 | *err = xs_fmt("actor request error %s %d", keyId, status); | 201 | *err = xs_fmt("actor request error %s %d", keyId, status); |
| 194 | return 0; | 202 | return 0; |
| 195 | } | 203 | } |