-
Notifications
You must be signed in to change notification settings - Fork 7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
httpd_socket_send
return value does not match the docs (IDFGH-9275)
#10658
Comments
httpd_socket_send
return value does not match the docs httpd_socket_send
return value does not match the docs (IDFGH-9275)
One example of potential problem: When sending 258 bytes using this API, the return value will match |
I would recommend instead of returning |
Hello @wuyuanyi135 |
@hmalpani Thanks for the prompt response! FYI, |
Yes. I have raised an internal MR to fix both APIs. The fix will be available soon. Thanks! |
…pd_socket_recv()` APIs Closes #10658
…pd_socket_recv()` APIs Closes #10658
…pd_socket_recv()` APIs Closes espressif/esp-idf#10658
Answers checklist.
IDF version.
v5.1-dev-3073-g9c29ec0f15
Operating System used.
Windows
How did you build your project?
Command line with idf.py
If you are using Windows, please specify command line type.
PowerShell
Development Kit.
ESP32-S3-WROOM-1-N16R2
Power Supply used.
USB
What is the expected behavior?
According to the docstring,
* @return
The return value should be either bytes sent (success) or negative error codes. This matches socket send behavior.
What is the actual behavior?
However,
esp-idf/components/esp_http_server/src/httpd_txrx.c
Lines 625 to 628 in 236fa5e
will return
ESP_ERR_INVALID_ARG
orESP_ERR_INVALID_STATE
. They are postive numbers hence confusing the error check whether the return value is less than zero.Steps to reproduce.
N/A
Debug Logs.
No response
More Information.
Rather than saying this is a documentation issue, I would say this is probably due to inconsistent design of the API about how the error should be reported. In this case, the
http_socket_send
's return value cannot reliably tell how many bytes were sent. It could only be used to check if any error occurs.The text was updated successfully, but these errors were encountered: