rscript = /<script\b[^<]*(?:(?!<\/script>)<[^<]*)*<\/script>/gi,
rselectTextarea = /^(?:select|textarea)/i,
rts = /([?&])_=[^&]*/,
- rurl = /^(\w+:)?\/\/([^\/?#]+)/,
+ rurl = /^(\w+:)?\/\/([^\/?#:]+)(?::(\d+))?/,
+ rCRLF = /\r?\n/g,
// Slice function
sliceFunc = Array.prototype.slice,
null :
jQuery.isArray(val) ?
jQuery.map( val, function(val, i){
- return {name: elem.name, value: val.replace(/\r?\n/g, "\r\n")};
+ return { name: elem.name, value: val.replace(rCRLF, "\r\n") };
}) :
- {name: elem.name, value: val.replace(/\r?\n/g, "\r\n")};
+ { name: elem.name, value: val.replace(rCRLF, "\r\n") };
}).get();
}
});
// 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 ) );
+
+ if ( ! s.crossDomain ) {
+ 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" ) {
s.data = jQuery.param( s.data , s.traditional );
}
+ // Get transport
+ transport = jQuery.ajax.prefilter( s , options ).transport( s );
+
// Watch for a new set of requests
if ( s.global && jQuery.active++ === 0 ) {
jQuery.event.trigger( "ajaxStart" );
}
- // Get transport
- transport = jQuery.ajax.prefilter( s ).transport( s );
-
// If no transport, we auto-abort
if ( ! transport ) {