Bug Tracker

Opened 9 years ago

Closed 9 years ago

Last modified 9 years ago

#7969 closed bug (fixed)

$.get() returns "success" when the request fails by timeout

Reported by: mappy Owned by:
Priority: low Milestone: 1.5
Component: ajax Version: 1.4.4
Keywords: Cc:
Blocked by: Blocking:

Description

When $.get() is called to an address where no server is running - e.g. http://127.0.0.1:82 - the request succeeds, returning 'success' as the second callback argument

Expected behavior: Request fails, does not return 'success' to the callback.

Steps to reproduce:

  1. Save the code from http://pastebin.com/RfXmekB7 as a local .htm file
  2. Open the .htm in a browser and watch the javascript console
  3. Status appears as 'success', despite no server existing at 127.0.0.1:82

Change History (3)

comment:1 Changed 9 years ago by anonymous

Relevant chat log from #jquery on irc.freenode.org

<mappy> could anyone grab http://pastebin.com/RfXmekB7, save and run it locally?
<Vorspire> mappy, use jsfiddle.net :)
<mappy> i tried, but the problem doesn't reproduce there owing to access control issues
<mappy> sorry
<Vorspire> ahh
<Vorspire> mappy, how is that address invalid?
<mappy> well, presumably there's no server running on it
<mappy> it should timeout and die
<alcuadrado> Loading the invalid address 'http://127.0.0.1:82/?'..
<alcuadrado> Status: success
<alcuadrado> Data:
<alcuadrado> you are right
<Vorspire> mappy; line 5974; "// The transfer is complete and the data is available, or the request timed out"
<Vorspire> so if it times out, it still returns true i guess
<mappy> ok : /
<mappy> seems like counterintuitive behaviour

comment:2 Changed 9 years ago by jitter

Component: unfiledajax
Milestone: 1.next1.5
Priority: undecidedlow
Resolution: fixed
Status: newclosed

Thanks for taking the time to contribute to the jQuery project by writing a bug report.

I used the code you provided on that pastebin. This was only reproducible using Firefox. Anyhow this has already been fixed and works as expected with the today released jQuery 1.5b1 version (which includes a major ajax rewrite)

Please verify with this http://pastebin.com/sk3mmEiG if it is indeed fixed for you also.

comment:3 Changed 9 years ago by mappy

I've tested both scripts with Chrome 9 only. Changing to jQuery 1.5b1, as in your script, seems to make the inner .get function never execute. No further lines are shown after Loading the invalid address 'http://127.0.0.1:82/?'...

This behaviour is fine by me, thanks for your response.

Note: See TracTickets for help on using tickets.