Include the Host in the HTTP header (mqtt) (#17731)
Add Host: header
Stelios Fragkakis committed
May 23, 2024 at 00:39 UTC
271bf8fd10468e18d64f5ac9dca2f9f802f6d239
1 file changed
+2
-1
src/aclk/mqtt_websockets/mqtt_wss_client.c
+2
-1
@@ -441,7 +441,8 @@ static int http_proxy_connect(mqtt_wss_client client)
441
poll_fd.events = POLLIN;
442
443
r_buf_ptr = rbuf_get_linear_insert_range(r_buf, &r_buf_linear_insert_capacity);
444
- snprintf(r_buf_ptr, r_buf_linear_insert_capacity,"%s %s:%d %s" HTTP_ENDLINE, PROXY_CONNECT, client->target_host, client->target_port, PROXY_HTTP);
444
+ snprintf(r_buf_ptr, r_buf_linear_insert_capacity,"%s %s:%d %s" HTTP_ENDLINE "Host: %s" HTTP_ENDLINE, PROXY_CONNECT,
445
+ client->target_host, client->target_port, PROXY_HTTP, client->target_host);
446
write(client->sockfd, r_buf_ptr, strlen(r_buf_ptr));
447
448
if (client->proxy_uname) {