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
{{ message }}
This repository was archived by the owner on Apr 12, 2024. It is now read-only.
Repository navigation
This repository was archived by the owner on Apr 12, 2024. It is now read-only.
$httpBackend changing all zero status codes to 404 forbids identifying a down server #6155
Commit 28fc80b forcefully changes status code zero to 404 without considering the protocol.
Because of this, it's not possible to distinguish at the application level between a server that did not respond (zero) and a non existing resource (404). Please consider reverting this commit, or narrow the status code check so that 404 is only returned for the Android file protocol.
+1 Throwing a 404 is misleading in multiple ways. The application assumes that:
The server responded and is up.
The server resource does not exist.
I'd vote for a revert or a better fit for the response code such as 503 or 522 (latter is non-standard and vendors specific though).
It's a bit tricky to handle connection timeout in a standard way using response codes because these response should be sent by the server. But on connection timeout, we don't get any response. So AngularJS injects a response code, as if the server returned it, but this never happened.
+1 I'd love a better way to find out the details about connection errors that are not the result of a HTTP response code sent by the server - such as indeed timeouts, host not found, destination unreachable, connection refused etc.
Seems to me that status = (status === 0 && response) ? 200 : status would keep #1356 fixed and prevent misleading 404 responses. Will look into submitting a PR.
The desire expressed above to be able to distinguish between 'host not found', 'destination unreachable', 'connection refused' etc isn't in #6074, but that seems like an XMLHttpRequest limitation anyway - so not something that we can fix in Angular.js
Activity
fix($httpBackend): Allow status code 0 from any protocol
stefansundin commentedon Feb 6, 2014
Agreed! +1
8bitDesigner commentedon Feb 6, 2014
Yeah, I don't like showing "Error could not do #{ish}" whenever the user navigates away from my page during a request.
geirgp commentedon Feb 7, 2014
Great, thanks for creating the issue!
jimleroyer commentedon Feb 7, 2014
+1 Throwing a 404 is misleading in multiple ways. The application assumes that:
I'd vote for a revert or a better fit for the response code such as 503 or 522 (latter is non-standard and vendors specific though).
It's a bit tricky to handle connection timeout in a standard way using response codes because these response should be sent by the server. But on connection timeout, we don't get any response. So AngularJS injects a response code, as if the server returned it, but this never happened.
raboof commentedon Feb 16, 2014
+1 I'd love a better way to find out the details about connection errors that are not the result of a HTTP response code sent by the server - such as indeed timeouts, host not found, destination unreachable, connection refused etc.
spalger commentedon Feb 25, 2014
Seems to me that
status = (status === 0 && response) ? 200 : statuswould keep #1356 fixed and prevent misleading 404 responses. Will look into submitting a PR.pkozlowski-opensource commentedon Feb 25, 2014
This is duplicate of #6074
fix($http): don't covert 0 status codes to 404 for non-file protocols
raboof commentedon Mar 3, 2014
The desire expressed above to be able to distinguish between 'host not found', 'destination unreachable', 'connection refused' etc isn't in #6074, but that seems like an XMLHttpRequest limitation anyway - so not something that we can fix in Angular.js
fix($http): don't covert 0 status codes to 404 for non-file protocols
fix($http): don't covert 0 status codes to 404 for non-file protocols