X-Git-Url: http://git.asbjorn.it/?p=jquery.git;a=blobdiff_plain;f=src%2Fajax.js;h=c7d7f2d63fa0de3cfef536aa208a6776b8ca169a;hp=39abe905940bbe760d4ba8057291912c03827ce3;hb=f43572d3b86074afc561822b7fd9592e1f05d19b;hpb=e0b1bb8e3d66db4166ac7ee2146903bae7ab1eb9 diff --git a/src/ajax.js b/src/ajax.js index 39abe90..c7d7f2d 100644 --- a/src/ajax.js +++ b/src/ajax.js @@ -350,6 +350,8 @@ jQuery.extend({ completeDeferred = jQuery._Deferred(), // Status-dependent callbacks statusCode = s.statusCode || {}, + // ifModified key + ifModifiedKey, // Headers (they are sent all at once) requestHeaders = {}, // Response headers @@ -453,10 +455,10 @@ jQuery.extend({ if ( s.ifModified ) { if ( ( lastModified = jXHR.getResponseHeader( "Last-Modified" ) ) ) { - jQuery.lastModified[ s.url ] = lastModified; + jQuery.lastModified[ ifModifiedKey ] = lastModified; } if ( ( etag = jXHR.getResponseHeader( "Etag" ) ) ) { - jQuery.etag[ s.url ] = etag; + jQuery.etag[ ifModifiedKey ] = etag; } } @@ -590,6 +592,9 @@ jQuery.extend({ s.url += ( rquery.test( s.url ) ? "&" : "?" ) + s.data; } + // Get ifModifiedKey before adding the anti-cache parameter + ifModifiedKey = s.url; + // Add anti-cache in url if needed if ( s.cache === false ) { @@ -609,11 +614,12 @@ jQuery.extend({ // Set the If-Modified-Since and/or If-None-Match header, if in ifModified mode. if ( s.ifModified ) { - if ( jQuery.lastModified[ s.url ] ) { - requestHeaders[ "if-modified-since" ] = jQuery.lastModified[ s.url ]; + ifModifiedKey = ifModifiedKey || s.url; + if ( jQuery.lastModified[ ifModifiedKey ] ) { + requestHeaders[ "if-modified-since" ] = jQuery.lastModified[ ifModifiedKey ]; } - if ( jQuery.etag[ s.url ] ) { - requestHeaders[ "if-none-match" ] = jQuery.etag[ s.url ]; + if ( jQuery.etag[ ifModifiedKey ] ) { + requestHeaders[ "if-none-match" ] = jQuery.etag[ ifModifiedKey ]; } }