projects
/
pazpar2-moved-to-github.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
13d672f
)
pz2.js: Allow overidding cookie do
author
Adam Dickmeiss
<adam@indexdata.dk>
Mon, 9 Dec 2013 12:17:42 +0000
(13:17 +0100)
committer
Adam Dickmeiss
<adam@indexdata.dk>
Mon, 9 Dec 2013 12:17:42 +0000
(13:17 +0100)
js/pz2.js
patch
|
blob
|
history
diff --git
a/js/pz2.js
b/js/pz2.js
index
becef33
..
a0afe3a
100644
(file)
--- a/
js/pz2.js
+++ b/
js/pz2.js
@@
-768,7
+768,7
@@
pz2.prototype =
** AJAX HELPER CLASS ***********************************************************
********************************************************************************
*/
** AJAX HELPER CLASS ***********************************************************
********************************************************************************
*/
-var pzHttpRequest = function ( url, errorHandler ) {
+var pzHttpRequest = function (url, errorHandler, cookieDomain) {
this.maxUrlLength = 2048;
this.request = null;
this.url = url;
this.maxUrlLength = 2048;
this.request = null;
this.url = url;
@@
-777,6
+777,7
@@
var pzHttpRequest = function ( url, errorHandler ) {
this.requestHeaders = {};
this.isXDomain = false;
this.domainRegex = /https?:\/\/([^:/]+).*/;
this.requestHeaders = {};
this.isXDomain = false;
this.domainRegex = /https?:\/\/([^:/]+).*/;
+ this.cookieDomain = cookieDomain || null;
var xhr = new XMLHttpRequest();
if ("withCredentials" in xhr) {
var xhr = new XMLHttpRequest();
if ("withCredentials" in xhr) {
@@
-843,6
+844,7
@@
pzHttpRequest.prototype =
_getDomainFromUrl: function (url)
{
_getDomainFromUrl: function (url)
{
+ if (this.cookieDomain) return this.cookieDomain; //explicit cookie domain
var m = this.domainRegex.exec(url);
return (m && m.length > 1) ? m[1] : null;
},
var m = this.domainRegex.exec(url);
return (m && m.length > 1) ? m[1] : null;
},
@@
-854,6
+856,7
@@
pzHttpRequest.prototype =
_isCrossDomain: function (domain)
{
_isCrossDomain: function (domain)
{
+ if (this.cookieDomain) return true; //assume xdomain is cookie domain set
return !this._strEndsWith(domain, document.domain);
},
return !this._strEndsWith(domain, document.domain);
},