Skip to content

Commit 5073c19

Browse files
authored
Revert "host field in HTTP header is no longer limited to 31 charcters (#2205)" (#2208)
This reverts commit d8d7381.
1 parent d8d7381 commit 5073c19

File tree

1 file changed

+1
-4
lines changed

1 file changed

+1
-4
lines changed

app/http/httpclient.c

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -215,23 +215,20 @@ static void ICACHE_FLASH_ATTR http_connect_callback( void * arg )
215215
ua_len = strlen(ua_header);
216216
}
217217

218-
char * host_header = "";
218+
char host_header[32] = "";
219219
int host_len = 0;
220220
if ( os_strstr( req->headers, "Host:" ) == NULL && os_strstr( req->headers, "host:" ) == NULL)
221221
{
222-
int max_header_len = 9 + strlen(req->hostname); // 9 is fixed size of "Host:[space][cr][lf]\0"
223222
if ((req->port == 80)
224223
#ifdef CLIENT_SSL_ENABLE
225224
|| ((req->port == 443) && ( req->secure ))
226225
#endif
227226
)
228227
{
229-
host_header = alloca(max_header_len);
230228
os_sprintf( host_header, "Host: %s\r\n", req->hostname );
231229
}
232230
else
233231
{
234-
host_header = alloca(max_header_len + 6); // 6 is worst case of ":port" where port is maximum 5 digits
235232
os_sprintf( host_header, "Host: %s:%d\r\n", req->hostname, req->port );
236233
}
237234
host_len = strlen(host_header);

0 commit comments

Comments
 (0)