aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorgrunfink <grunfink@comam.es>2026-02-03 07:15:22 +0100
committergrunfink <grunfink@comam.es>2026-02-03 07:15:22 +0100
commit083a3387fcdc74b737117a018a59a3c2e6f158bd (patch)
tree6eb576f2a4a35c7642ff8bdf994002e91c9e15f8
parent8dd51011df7b8dc44673c61ee67ebdbc7690b6a4 (diff)
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)
if ((p = strchr(keyId, '#')) != NULL)
*p = '\0';
- /* also strip cgi variables */
- if ((p = strchr(keyId, '?')) != NULL)
- *p = '\0';
-
xs *actor = NULL;
int status;
- if (!valid_status((status = actor_request(NULL, keyId, &actor)))) {
+ /* does it have ? variables? */
+ if ((p = strchr(keyId, '?')) != NULL) {
+ /* try first with them */
+ if (!valid_status((status = actor_request(NULL, keyId, &actor)))) {
+ *p = '\0';
+ /* retry stripping them */
+ status = actor_request(NULL, keyId, &actor);
+ }
+ }
+ else
+ status = actor_request(NULL, keyId, &actor);
+
+ if (!valid_status(status)) {
*err = xs_fmt("actor request error %s %d", keyId, status);
return 0;
}