rscript = /<script\b[^<]*(?:(?!<\/script>)<[^<]*)*<\/script>/gi,
rselectTextarea = /^(?:select|textarea)/i,
rts = /([?&])_=[^&]*/,
- rurl = /^(\w+:)?\/\/([^\/?#]+)/,
+ rurl = /^(\w+:)?\/\/([^\/?#:]+)(?::(\d+))?/,
// Slice function
sliceFunc = Array.prototype.slice,
} 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
// 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" ) {