//>>built
define("dojox/io/xhrPlugins",["dojo/_base/kernel","dojo/_base/xhr","dojo/AdapterRegistry"],function(b,r,t){function m(){return q=dojox.io.xhrPlugins.plainXhr=q||b._defaultXhr||r}b.getObject("io.xhrPlugins",!0,dojox);var k,q;dojox.io.xhrPlugins.register=function(){var g=m();k||(k=new t,b[b._defaultXhr?"_defaultXhr":"xhr"]=function(e,d,a){return k.match.apply(k,arguments)},k.register("xhr",function(e,d){if(!d.url.match(/^\w*:\/\//))return!0;var a=window.location.href.match(/^.*?\/\/.*?\//)[0];return d.url.substring(0,
a.length)==a},g));return k.register.apply(k,arguments)};dojox.io.xhrPlugins.addProxy=function(g){var e=m();dojox.io.xhrPlugins.register("proxy",function(d,a){return!0},function(d,a,f){a.url=g+encodeURIComponent(a.url);return e.call(b,d,a,f)})};var n;dojox.io.xhrPlugins.addCrossSiteXhr=function(g,e){var d=m();if(void 0===n&&window.XMLHttpRequest)try{(new XMLHttpRequest).open("GET","http://testing-cross-domain-capability.com",!0),n=!0,b.config.noRequestedWithHeaders=!0}catch(a){n=!1}dojox.io.xhrPlugins.register("cs-xhr",
function(a,f){return(n||window.XDomainRequest&&!0!==f.sync&&("GET"==a||"POST"==a||e))&&f.url.substring(0,g.length)==g},n?d:function(){var a=b._xhrObj;b._xhrObj=function(){function l(h,p){return function(){c.readyState=p;c.status=h}}var c=new XDomainRequest;c.readyState=1;c.setRequestHeader=function(){};c.getResponseHeader=function(h){return"Content-Type"==h?c.contentType:null};c.onload=l(200,4);c.onprogress=l(200,3);c.onerror=l(404,4);return c};var f=(e?e(m()):m()).apply(b,arguments);b._xhrObj=a;
return f})};dojox.io.xhrPlugins.fullHttpAdapter=function(g,e){return function(d,a,f){var l={},c={};"GET"!=d&&(c["http-method"]=d,a.putData&&e&&(l["http-content"]=a.putData,delete a.putData,f=!1),a.postData&&e&&(l["http-content"]=a.postData,delete a.postData,f=!1),d="POST");for(var h in a.headers){var p=h.match(/^X-/)?h.substring(2).replace(/-/g,"_").toLowerCase():"http-"+h;c[p]=a.headers[h]}a.query=b.objectToQuery(c);b._ioAddQueryToUrl(a);a.content=b.mixin(a.content||{},l);return g.call(b,d,a,f)}};
return dojox.io.xhrPlugins});