Skip to content
This repository has been archived by the owner on Apr 12, 2024. It is now read-only.

[BUG] Getting HTTP response 404 for net::ERR_CONNECTION_REFUSED #6503

Closed
marcalj opened this issue Mar 1, 2014 · 3 comments
Closed

[BUG] Getting HTTP response 404 for net::ERR_CONNECTION_REFUSED #6503

marcalj opened this issue Mar 1, 2014 · 3 comments

Comments

@marcalj
Copy link

marcalj commented Mar 1, 2014

Hi, I'm developing offline capabilities for one webapp and I realised here that you change HTTP status from 0 to 404.

I would like to detect the 0 status code and stop the sync process, but now it's no reliable at all.

We can assume that all 0 responses are related when there's no connection to server? I thought it was like this, I'm missing something?

The related code:

    function completeRequest(callback, status, response, headersString) {
      // cancel timeout and subsequent timeout promise resolution
      timeoutId && $browserDefer.cancel(timeoutId);
      jsonpDone = xhr = null;

      // fix status code when it is 0 (0 status is undocumented).
      // Occurs when accessing file resources.
      // On Android 4.1 stock browser it occurs while retrieving files from application cache.
      status = (status === 0) ? (response ? 200 : 404) : status;

      // normalize IE bug (http://bugs.jquery.com/ticket/1450)
      status = status == 1223 ? 204 : status;

      callback(status, response, headersString);
      $browser.$$completeOutstandingRequest(noop);
    }
  };

W3C spec: http://www.w3.org/TR/XMLHttpRequest/#the-status-attribute

Thanks.

@pkozlowski-opensource
Copy link
Member

Yes, this is duplicate of #6074 and #6155. I've got a fix ready locally, will be sending a pull request today.

@pkozlowski-opensource
Copy link
Member

Closing this one as a duplicate.

@marcalj
Copy link
Author

marcalj commented Mar 1, 2014

@pkozlowski-opensource Great!! Thanks! :)

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

2 participants