zephyr/subsys/net
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
..
ip net: connection: Zero out connection struct when unregistering 2017-08-22 09:53:19 -04:00
lib net: http: fix avoiding timeout on HTTP requests w/o body 2017-08-23 16:42:03 -04:00
Kconfig Kconfig: make all syslog variables depend on SYS_LOG 2017-08-04 14:34:54 -05:00
Makefile
TODO Bluetooth: Kconfig: Rename CONFIG_BLUETOOTH_* to CONFIG_BT_* 2017-08-09 11:14:19 +03:00
buf.c net: buf: Move net_buf_pool objects to dedicated linker area 2017-06-16 17:05:06 +03:00