Skip to content
This repository was archived by the owner on Apr 12, 2024. It is now read-only.
This repository was 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

Description

@marcalj

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.

Activity

  1. pkozlowski-opensource commented on Mar 1, 2014

    @pkozlowski-opensource
    Member

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

  2. pkozlowski-opensource commented on Mar 1, 2014

    @pkozlowski-opensource
    Member

    Closing this one as a duplicate.

  3. marcalj commented on Mar 1, 2014

    @marcalj
    Author

    @pkozlowski-opensource Great!! Thanks! :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions