zephyr/subsys/net/lib
Michael Scott caa377943a net: http: fix avoiding timeout on HTTP requests w/o body
The original commit 8ebaf29927 ("net: http: dont timeout
on HTTP requests w/o body") was intended to handle a case
where an HTTP response had been retrieved from the server but
the HTTP parser couldn't meet the criteria for calling
"on_message_complete".  For example, a POST to a REST API
where the server doesn't return anything but an HTTP
status code.

It was a really bad idea to check a semaphore count.  There
is a lot of kernel logic built into semaphores and how the
count is adjusted.  The assumption that the value is 0
after the k_sem_give() is incorrect.  It's STILL 0 if
something is pending with a k_sem_take().  By the time
k_sem_give() is done executing the other thread has now
been kicked and the count is back to 0.

This caused the original check to always pass and in turn
breakage was noticed in the http_client sample.

Let's do this the right way by setting a flag when
on_message_complete is called and if that flag is not set
by the time we reach recv_cb, let's give back the semaphore
to avoid a timeout.

Jira: ZEP-2561

Signed-off-by: Michael Scott <michael.scott@linaro.org>
2017-08-23 16:42:03 -04:00
..
app net: app: Introduce missing enable/disable functions for server 2017-08-22 13:33:33 -04:00
dns net: struct sockaddr should have field "sa_family" 2017-08-18 16:34:51 -04:00
http net: http: fix avoiding timeout on HTTP requests w/o body 2017-08-23 16:42:03 -04:00
lwm2m net: lwm2m: return BAD_REQUEST when object create fails 2017-08-21 08:38:17 -04:00
mqtt net/mqtt: Enable TLS support 2017-07-28 11:25:43 +03:00
sockets net: sockets: Consistently use "BSD Sockets compatible API" moniker 2017-08-17 12:02:55 -05:00
zoap net: struct sockaddr should have field "sa_family" 2017-08-18 16:34:51 -04:00
Kbuild net: lwm2m: initial library support for LWM2M 2017-08-09 10:55:53 +03:00
Kconfig net: sockets: Move under "Network Application Support" heading 2017-08-15 09:20:27 -04:00
Makefile net: lwm2m: initial library support for LWM2M 2017-08-09 10:55:53 +03:00