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 #7465. Reworked the regexp and associated test for cross-domain detection so...
[jquery.git]
/
src
/
ajax.js
diff --git
a/src/ajax.js
b/src/ajax.js
index
a814d80
..
207ef13
100644
(file)
--- a/
src/ajax.js
+++ b/
src/ajax.js
@@
-10,7
+10,7
@@
var r20 = /%20/g,
rscript = /<script\b[^<]*(?:(?!<\/script>)<[^<]*)*<\/script>/gi,
rselectTextarea = /^(?:select|textarea)/i,
rts = /([?&])_=[^&]*/,
rscript = /<script\b[^<]*(?:(?!<\/script>)<[^<]*)*<\/script>/gi,
rselectTextarea = /^(?:select|textarea)/i,
rts = /([?&])_=[^&]*/,
- rurl = /^(\w+:)?\/\/([^\/?#]+)/,
+ rurl = /^(\w+:)?\/\/([^\/?#:]+)(?::(\d+))?/,
// Slice function
sliceFunc = Array.prototype.slice,
// Slice function
sliceFunc = Array.prototype.slice,
@@
-464,6
+464,11
@@
jQuery.extend({
} else { // if not success, mark it as an error
error = error || statusText;
} else { // if not success, mark it as an error
error = error || statusText;
+
+ // Set responseText if needed
+ if ( response ) {
+ jXHR.responseText = response;
+ }
}
// Set data for the fake xhr object
}
// Set data for the fake xhr object
@@
-515,7
+520,12
@@
jQuery.extend({
// Determine if a cross-domain request is in order
var parts = rurl.exec( s.url.toLowerCase() ),
loc = location;
// Determine if a cross-domain request is in order
var parts = rurl.exec( s.url.toLowerCase() ),
loc = location;
- s.crossDomain = !!( parts && ( parts[ 1 ] && parts[ 1 ] != loc.protocol || parts[ 2 ] != loc.host ) );
+ s.crossDomain = !!(
+ parts &&
+ ( parts[ 1 ] && parts[ 1 ] != loc.protocol ||
+ parts[ 2 ] != loc.hostname ||
+ ( parts[ 3 ] || 80 ) != ( loc.port || 80 ) )
+ );
// Convert data if not already a string
if ( s.data && s.processData && typeof s.data != "string" ) {
// Convert data if not already a string
if ( s.data && s.processData && typeof s.data != "string" ) {