zephyr/subsys
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
..
bluetooth Bluetooth: controller: Fix Read Peer RPA Command 2017-08-22 15:22:25 +02:00
console subsys: console: Fix signed vs unsigned char issues. 2017-05-22 08:43:31 -05:00
cpp subsystem: cleanup misc and make cpp a subsystem 2017-07-06 09:13:46 -05:00
debug debug: openocd: build openocd symbols using obj- 2017-08-10 09:13:06 -05:00
disk license: add missing licenses and copyright 2017-06-08 10:41:56 -04:00
fs subsys: convert to using newly introduced integer sized types 2017-04-21 09:36:22 -05:00
logging kconfig: build code conditionally when possible 2017-08-14 20:32:26 -04:00
net net: http: fix avoiding timeout on HTTP requests w/o body 2017-08-23 16:42:03 -04:00
shell shell: Adjust arguments when executing a command of different module 2017-06-09 18:54:27 -04:00
usb Kconfig: make all syslog variables depend on SYS_LOG 2017-08-04 14:34:54 -05:00
Kconfig subsystem: cleanup misc and make cpp a subsystem 2017-07-06 09:13:46 -05:00
Makefile Bluetooth: Kconfig: Rename CONFIG_BLUETOOTH_* to CONFIG_BT_* 2017-08-09 11:14:19 +03:00