You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
However, http_send_data() doesn't typically return the number of bytes that were added in that particular invocation. Instead it copies the values into a local 192 byte buffer and returns the current position within that buffer.
Then the http_client sends 33+43+22==98 bytes of headers plus my 34 bytes of payload for a total of 132 bytes.
However the calls to http_send_data() will return 33, (33 + 43), and (33 + 43 + 22) respectively. This leads to total_sent being set to 207 by the time the headers have been sent, which causes an incorrect return value of 207+34==241 from http_client_req().
The text was updated successfully, but these errors were encountered:
The
http_client_req()
function is supposed to return the number of bytes sent to the server:https://github.com/zephyrproject-rtos/zephyr/blob/main/include/net/http_client.h#L327
However, there is a bug in the implementation such that it generally returns something much larger. Each line of the headers is sent via one call to
http_send_data()
, the return value of which is added to thetotal_sent
summation variable.https://github.com/zephyrproject-rtos/zephyr/blob/main/subsys/net/lib/http/http_client.c#L529
However,
http_send_data()
doesn't typically return the number of bytes that were added in that particular invocation. Instead it copies the values into a local 192 byte buffer and returns the current position within that buffer.For example, if I wanted to send:
Then the http_client sends 33+43+22==98 bytes of headers plus my 34 bytes of payload for a total of 132 bytes.
However the calls to
http_send_data()
will return 33, (33 + 43), and (33 + 43 + 22) respectively. This leads tototal_sent
being set to 207 by the time the headers have been sent, which causes an incorrect return value of 207+34==241 fromhttp_client_req()
.The text was updated successfully, but these errors were encountered: