Bug Tracker

Modify

Ticket #7969 (closed bug: fixed)

Opened 2 years ago

Last modified 2 years ago

$.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:
Blocking: Blocked by:

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

comment:1 Changed 2 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 2 years ago by jitter

  • Priority changed from undecided to low
  • Resolution set to fixed
  • Status changed from new to closed
  • Component changed from unfiled to ajax
  • Milestone changed from 1.next to 1.5

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 2 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.

Please follow the  bug reporting guidlines and use  jsFiddle when providing test cases and demonstrations instead of pasting the code in the ticket.

View

Add a comment

Modify Ticket

Action
as closed
Author


E-mail address and user name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.