zephyr/subsys/net/lib/http
Robert Lubos be7faf7c08 net: http: Fix HTTP_DATA_FINAL notification
HTTP_DATA_FINAL was incorrectly notified in case Content Length field
was present in the HTTP respone - in such case it was set for every
response fragment, not only the last one.

Fix this by relying on `message_complete` flag instead of
`http_should_keep_alive()` function to determine whether to notify
HTTP_DATA_FINAL or not. As the HTTP parser calls the
`on_message_complete()` callback in either case (response is chunked or
not), this seems to be a more reasonable apporach to determine whether
the fragment is final or not.

Additinally, instead of calling response callback for
`on_body`/`on_message_complete` separately, call it directly from
`http_wait_data()` function, after the parsing round. This fixes the
case when headers were not reported correctly when the provided buffer
was smaller than the total headers length, resulting in corrupted data
being reported to the user.

Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
2021-09-17 08:12:00 -04:00
..
CMakeLists.txt cmake: remove _if_kconfig() functions 2020-08-01 12:35:20 +02:00
http_client.c net: http: Fix HTTP_DATA_FINAL notification 2021-09-17 08:12:00 -04:00
http_parser.c net: http: update status if no status text is provided 2021-05-18 11:23:59 -05:00
http_parser_url.c license: add missing SPDX headers 2021-02-11 08:05:16 -05:00
Kconfig kconfig: Clean up header comments and make them consistent 2019-11-04 17:31:27 -05:00
README_http_parser docs: fix misspelling across the tree 2019-06-19 15:34:13 -05:00