Fix logical error in origin check
This commit is contained in:
parent
fb91130952
commit
1d0ccbbf13
|
@ -199,7 +199,7 @@ module Typertext.Http {
|
||||||
*
|
*
|
||||||
* @returns {boolean}
|
* @returns {boolean}
|
||||||
*/
|
*/
|
||||||
public CrossOriginCheck(url:HttpUrl):boolean {
|
public SameOriginCheck(url:HttpUrl):boolean {
|
||||||
return (this.domain === url.GetDomain() && this.port === url.GetPort() && this.protocol === url.GetProtocol());
|
return (this.domain === url.GetDomain() && this.port === url.GetPort() && this.protocol === url.GetProtocol());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -32,8 +32,8 @@ module Typertext.Transport {
|
||||||
var ieLte9 = (ieTestDiv.getElementsByTagName("i").length === 1);
|
var ieLte9 = (ieTestDiv.getElementsByTagName("i").length === 1);
|
||||||
var origin = HttpUrl.FromUrl(window.location.href);
|
var origin = HttpUrl.FromUrl(window.location.href);
|
||||||
|
|
||||||
//If this is a CORS request in a modern browser
|
//If this is a standard request, or a CORS request in a modern browser
|
||||||
if (!origin.CrossOriginCheck(origin) || !ieLte9) {
|
if (origin.SameOriginCheck(origin) || !ieLte9) {
|
||||||
//Just use a standard XHR request
|
//Just use a standard XHR request
|
||||||
return XHR;
|
return XHR;
|
||||||
}
|
}
|
||||||
|
|
Reference in New Issue