summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGravatar grunfink2026-02-03 07:15:22 +0100
committerGravatar grunfink2026-02-03 07:15:22 +0100
commit083a3387fcdc74b737117a018a59a3c2e6f158bd (patch)
tree6eb576f2a4a35c7642ff8bdf994002e91c9e15f8
parentUse the translated month names in date labels. (diff)
downloadsnac2-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.c18
1 files changed, 13 insertions, 5 deletions
diff --git a/http.c b/http.c
index 4f0b2fa..125d346 100644
--- a/http.c
+++ b/http.c
@@ -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 }