Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
ruanhaishen
Nodemcu Firmware
Commits
5073c199
Unverified
Commit
5073c199
authored
Dec 24, 2017
by
Marcel Stör
Committed by
GitHub
Dec 24, 2017
Browse files
Revert "host field in HTTP header is no longer limited to 31 charcters (#2205)" (#2208)
This reverts commit
d8d7381a
.
parent
d8d7381a
Changes
1
Hide whitespace changes
Inline
Side-by-side
app/http/httpclient.c
View file @
5073c199
...
...
@@ -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
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment