Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
ruanhaishen
Nodemcu Firmware
Commits
1a20f2ed
Commit
1a20f2ed
authored
Jan 26, 2016
by
Huang Rui
Browse files
Fix HTTP response bug while server response HTTP/1.0
Signed-off-by:
Huang Rui
<
vowstar@gmail.com
>
parent
5e2eb358
Changes
2
Show whitespace changes
Inline
Side-by-side
app/http/httpclient.c
View file @
1a20f2ed
...
...
@@ -354,14 +354,16 @@ static void ICACHE_FLASH_ATTR http_disconnect_callback( void * arg )
else
if
(
req
->
buffer
[
0
]
!=
'\0'
)
{
/* FIXME: make sure this is not a partial response, using the Content-Length header. */
const
char
*
version
=
"HTTP/1.1 "
;
if
(
os_strncmp
(
req
->
buffer
,
version
,
strlen
(
version
)
)
!=
0
)
const
char
*
version_1_0
=
"HTTP/1.0 "
;
const
char
*
version_1_1
=
"HTTP/1.1 "
;
if
((
os_strncmp
(
req
->
buffer
,
version_1_0
,
strlen
(
version_1_0
)
)
!=
0
)
&&
(
os_strncmp
(
req
->
buffer
,
version_1_1
,
strlen
(
version_1_1
)
)
!=
0
))
{
HTTPCLIENT_DEBUG
(
"Invalid version in %s
\n
"
,
req
->
buffer
);
}
else
{
http_status
=
atoi
(
req
->
buffer
+
strlen
(
version
)
);
http_status
=
atoi
(
req
->
buffer
+
strlen
(
version
_1_0
)
);
body
=
(
char
*
)
os_strstr
(
req
->
buffer
,
"
\r\n\r\n
"
)
+
4
;
if
(
os_strstr
(
req
->
buffer
,
"Transfer-Encoding: chunked"
)
)
{
...
...
app/http/httpclient.h
View file @
1a20f2ed
...
...
@@ -32,7 +32,7 @@
/*
* Size of http responses that will cause an error.
*/
#define BUFFER_SIZE_MAX (
1024
)
#define BUFFER_SIZE_MAX (
0x2000
)
/*
* Timeout of http request.
...
...
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