From 5c3a2be00db30f1158386e1f12adeb44af4450c0 Mon Sep 17 00:00:00 2001 From: Andy Green Date: Fri, 22 Mar 2019 18:52:08 +0800 Subject: [PATCH] http proxy: proxy Authorization header Sai notifications are signed using Authorization: and "sai" auth type. After the auth type, the format is, eg, "sha256=" . --- lib/roles/http/client/client.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/lib/roles/http/client/client.c b/lib/roles/http/client/client.c index 4ad69ccbb..414972ec1 100644 --- a/lib/roles/http/client/client.c +++ b/lib/roles/http/client/client.c @@ -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; }