git.asbjorn.biz
/
jquery.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Fixes #8177. XHR transport now considers 304 Not Modified responses as 200 OK if...
[jquery.git]
/
src
/
ajax
/
xhr.js
diff --git
a/src/ajax/xhr.js
b/src/ajax/xhr.js
index
97db079
..
b18274c
100644
(file)
--- a/
src/ajax/xhr.js
+++ b/
src/ajax/xhr.js
@@
-23,11
+23,7
@@
var // Next active xhr id
xhrUnloadAbortInstalled,
// XHR used to determine supports properties
xhrUnloadAbortInstalled,
// XHR used to determine supports properties
- testXHR,
-
- // Keep track of isLocal in case it gets removed
- // from ajaxSettings later on
- protocolIsLocal = jQuery.ajaxSettings.isLocal;
+ testXHR;
// Create the request object
// (This is still attached to ajaxSettings for backward compatibility)
// Create the request object
// (This is still attached to ajaxSettings for backward compatibility)
@@
-38,12
+34,9
@@
jQuery.ajaxSettings.xhr = window.ActiveXObject ?
* Additionally XMLHttpRequest can be disabled in IE7/IE8 so
* we need a fallback.
*/
* Additionally XMLHttpRequest can be disabled in IE7/IE8 so
* we need a fallback.
*/
- ( protocolIsLocal ?
- createActiveXHR :
- function() {
- return createStandardXHR() || createActiveXHR();
- }
- ) :
+ function() {
+ return !this.isLocal && createStandardXHR() || createActiveXHR();
+ } :
// For all other browsers, use the standard XMLHttpRequest object
createStandardXHR;
// For all other browsers, use the standard XMLHttpRequest object
createStandardXHR;
@@
-185,6
+178,12
@@
if ( jQuery.support.ajax ) {
// IE - #1450: sometimes returns 1223 when it should be 204
if ( status === 1223 ) {
status = 204;
// IE - #1450: sometimes returns 1223 when it should be 204
if ( status === 1223 ) {
status = 204;
+ // Various - #8177: a Not Modified response was received
+ // yet no conditional request headers was provided
+ } else if ( status === 304 &&
+ !headers[ "if-modified-since" ] &&
+ !headers[ "if-none-match" ] ) {
+ status = 200;
// Status 0 encompasses several cases
} else if ( !status ) {
// Cross-domain
// Status 0 encompasses several cases
} else if ( !status ) {
// Cross-domain
@@
-196,7
+195,7
@@
if ( jQuery.support.ajax ) {
status = 302;
}
// All same-domain: for local files, 0 is a success
status = 302;
}
// All same-domain: for local files, 0 is a success
- } else if( protocolIsLocal ) {
+ } else if( s.isLocal ) {
status = 200;
// Opera: this notifies success for all requests
// (verified in 11.01). Patch welcome.
status = 200;
// Opera: this notifies success for all requests
// (verified in 11.01). Patch welcome.