From fc3a4683755470f883351c56b9ac47b94d029915 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marcel=20St=C3=B6r?= Date: Sun, 24 Dec 2017 23:21:49 +0100 Subject: [PATCH] Revert "host field in HTTP header is no longer limited to 31 charcters (#2205)" This reverts commit d8d7381a38befec96803984735a378e8dd7b8cdd. --- app/http/httpclient.c | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/app/http/httpclient.c b/app/http/httpclient.c index 6c8d97c064..094c5ece13 100644 --- a/app/http/httpclient.c +++ b/app/http/httpclient.c @@ -215,23 +215,20 @@ static void ICACHE_FLASH_ATTR http_connect_callback( void * arg ) ua_len = strlen(ua_header); } - char * host_header = ""; + char host_header[32] = ""; int host_len = 0; if ( os_strstr( req->headers, "Host:" ) == NULL && os_strstr( req->headers, "host:" ) == NULL) { - int max_header_len = 9 + strlen(req->hostname); // 9 is fixed size of "Host:[space][cr][lf]\0" if ((req->port == 80) #ifdef CLIENT_SSL_ENABLE || ((req->port == 443) && ( req->secure )) #endif ) { - host_header = alloca(max_header_len); os_sprintf( host_header, "Host: %s\r\n", req->hostname ); } else { - host_header = alloca(max_header_len + 6); // 6 is worst case of ":port" where port is maximum 5 digits os_sprintf( host_header, "Host: %s:%d\r\n", req->hostname, req->port ); } host_len = strlen(host_header);