-
Notifications
You must be signed in to change notification settings - Fork 6.8k
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
net: http: client: Return error if waiting timeout #68930
net: http: client: Return error if waiting timeout #68930
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good, although I've left one suggestion to consider. No strong push though.
Return error to the caller if no data was received or there was some other error. Earlier we did not check the error condition properly. Signed-off-by: Jukka Rissanen <[email protected]>
a2ce6f9
to
ddab14c
Compare
Hey, sorry I am commenting after this was merged, but wasn't the lack of error output in this scenario intentional? (or, more specifically, "officially adopted" and documented?) NULL HTTP output was instead indicated with the special status /** Numeric HTTP status code which corresponds to the
* textual description. Set to zero if null response is
* given. Otherwise, will be a 3-digit integer code if
* valid HTTP response is given.
*/
uint16_t http_status_code; See Are we intentionally reversing that decision? In which case documentation from my PR needs to be updated as well, and we will need to refactor libraries relying on the old behavior. That's fine if that's how it needs to be, but it does seem worth it to bring it up and discuss first See the issue I raised about this topic for discussion of whether NULL HTTP output should be considered a connection error: NULL response is absolutely an edge case, but there are servers out there that respond to legitimate API calls with a graceful TLS termination and NULL response body. So we'll have to refactor those in downstream projects if this change is permanent. |
@jukkar Were there any other edge cases, other than connection close, covered by this change? If not, perhaps we should indeed revert this change, and just document it better, that in case of no response, it'd be notified in the registered callback with the special status code (0)? |
I noticed the issue while working on #63531, I can check what it means to revert this. |
This commit fixes this issue: The original behavior without this commit gives following output:
and then with the fix
So the difference is that with original code and when a HTTP reply is not received, we get HTTP status 0 which just looks plain wrong as there was no HTTP server at the other end. WDYT? |
I think we are dealing with two separate behaviors, and we should introduce some more precise terminology to address that better:
Whereas what it seems you were trying to fix was the situation where no response (not even FIN ACK) is received from the server at all. Let's call this second situation So I agree, in the event of However, In the event of a Your PR happens to affect the behavior of BOTH IMO the behavior you are seeing in your examples is odd. Wouldn't If I am remembering wrong, then IMO what is needed is a change in |
The code checks if there was any data received from server |
No, an error like |
@glarsennordic I think I found a way to detect what you asked. See #70816 for details. |
Return error to the caller if no data was received or there was some other error. Earlier we did not check the error condition properly.