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
7ff8326c
Commit
7ff8326c
authored
Jun 15, 2016
by
Jonathan Karras
Committed by
Marcel Stör
Jun 15, 2016
Browse files
Skip passing port in Host header if standard port. (#1362)
Some virtual hosts break if the port is added in the headers.
parent
0d3e0bbb
Changes
1
Show whitespace changes
Inline
Side-by-side
app/http/httpclient.c
View file @
7ff8326c
...
...
@@ -181,7 +181,7 @@ static void ICACHE_FLASH_ATTR http_connect_callback( void * arg )
HTTPCLIENT_DEBUG
(
"Connected
\n
"
);
struct
espconn
*
conn
=
(
struct
espconn
*
)
arg
;
request_args_t
*
req
=
(
request_args_t
*
)
conn
->
reverse
;
int
len
;
espconn_regist_recvcb
(
conn
,
http_receive_callback
);
espconn_regist_sentcb
(
conn
,
http_send_callback
);
...
...
@@ -200,7 +200,20 @@ static void ICACHE_FLASH_ATTR http_connect_callback( void * arg )
char
buf
[
69
+
strlen
(
req
->
method
)
+
strlen
(
req
->
path
)
+
strlen
(
req
->
hostname
)
+
strlen
(
req
->
headers
)
+
strlen
(
post_headers
)];
int
len
=
os_sprintf
(
buf
,
if
((
req
->
port
==
80
)
||
((
req
->
port
==
443
)
&&
(
req
->
secure
)))
{
len
=
os_sprintf
(
buf
,
"%s %s HTTP/1.1
\r\n
"
"Host: %s
\r\n
"
"Connection: close
\r\n
"
"User-Agent: ESP8266
\r\n
"
"%s"
"%s"
"
\r\n
"
,
req
->
method
,
req
->
path
,
req
->
hostname
,
req
->
headers
,
post_headers
);
}
else
{
len
=
os_sprintf
(
buf
,
"%s %s HTTP/1.1
\r\n
"
"Host: %s:%d
\r\n
"
"Connection: close
\r\n
"
...
...
@@ -209,7 +222,7 @@ static void ICACHE_FLASH_ATTR http_connect_callback( void * arg )
"%s"
"
\r\n
"
,
req
->
method
,
req
->
path
,
req
->
hostname
,
req
->
port
,
req
->
headers
,
post_headers
);
}
if
(
req
->
secure
)
espconn_secure_send
(
conn
,
(
uint8_t
*
)
buf
,
len
);
else
...
...
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