diff options
Diffstat (limited to 'http.c')
| -rw-r--r-- | http.c | 13 |
1 files changed, 13 insertions, 0 deletions
| @@ -223,6 +223,19 @@ int check_signature(xs_dict *req, xs_str **err) | |||
| 223 | if (strcmp(v, "(expires)") == 0) { | 223 | if (strcmp(v, "(expires)") == 0) { |
| 224 | ss = xs_fmt("%s: %s", v, expires); | 224 | ss = xs_fmt("%s: %s", v, expires); |
| 225 | } | 225 | } |
| 226 | else | ||
| 227 | if (strcmp(v, "host") == 0) { | ||
| 228 | hc = xs_dict_get(req, "host"); | ||
| 229 | |||
| 230 | /* if there is no host header or some garbage like | ||
| 231 | address:host has arrived here due to misconfiguration, | ||
| 232 | signature verify will totally fail, so let's Leroy Jenkins | ||
| 233 | with the global server hostname instead */ | ||
| 234 | if (hc == NULL || xs_str_in(hc, ":") != -1) | ||
| 235 | hc = xs_dict_get(srv_config, "host"); | ||
| 236 | |||
| 237 | ss = xs_fmt("host: %s", hc); | ||
| 238 | } | ||
| 226 | else { | 239 | else { |
| 227 | /* add the header */ | 240 | /* add the header */ |
| 228 | if ((hc = xs_dict_get(req, v)) == NULL) { | 241 | if ((hc = xs_dict_get(req, v)) == NULL) { |