1
0
Fork 0
mirror of https://github.com/warmcat/libwebsockets.git synced 2025-03-09 00:00:04 +01:00

http proxy: proxy Authorization header

Sai notifications are signed using Authorization: and "sai" auth type.

After the auth type, the format is, eg, "sha256=<hash>" .
This commit is contained in:
Andy Green 2019-03-22 18:52:08 +08:00
parent 588cf0b8db
commit 5c3a2be00d

View file

@ -1103,6 +1103,11 @@ lws_generate_client_handshake(struct lws *wsi, char *pkt)
if (atoi(lws_hdr_simple_ptr(wsi->parent, WSI_TOKEN_HTTP_CONTENT_LENGTH)))
wsi->client_http_body_pending = 1;
}
if (wsi->parent &&
lws_hdr_total_length(wsi->parent, WSI_TOKEN_HTTP_AUTHORIZATION)) {
p += snprintf(p, 128, "Authorization: %s\x0d\x0a",
lws_hdr_simple_ptr(wsi->parent, WSI_TOKEN_HTTP_AUTHORIZATION));
}
if (wsi->parent &&
lws_hdr_total_length(wsi->parent, WSI_TOKEN_HTTP_CONTENT_TYPE)) {
p += snprintf(p, 128, "Content-Type: %s\x0d\x0a",
@ -1131,6 +1136,8 @@ lws_generate_client_handshake(struct lws *wsi, char *pkt)
p += snprintf(p, 4, "\x0d\x0a");
// puts(pkt);
return p;
}