Skip to content

Commit

Permalink
Ensure signature is calculated with '+' instead of a space
Browse files Browse the repository at this point in the history
  • Loading branch information
Jeremy Collins committed Nov 11, 2019
1 parent 94ce663 commit 292c2d9
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion src/mod_dims.c
Original file line number Diff line number Diff line change
Expand Up @@ -1194,8 +1194,19 @@ dims_handle_request(dims_request_rec *d)
}
}

// Convert %20 (space) back to '+' in commands. This is fixes an issue with "+" being encoded as %20 by some clients.
char *commands = apr_pstrdup(d->r->pool, d->unparsed_commands);
char *s = commands;
while (*s) {
if (*s == ' ') {
*s = '+';
}

s++;
}

// Standard signature params.
char *signature_params = apr_pstrcat(d->pool, expires_str, d->client_config->secret_key, d->unparsed_commands, d->image_url, NULL);
char *signature_params = apr_pstrcat(d->pool, expires_str, d->client_config->secret_key, commands, d->image_url, NULL);

// Concatenate additional params.
char *token;
Expand Down

0 comments on commit 292c2d9

Please sign in to comment.