diff --git a/Foundation/CPURLConnection.j b/Foundation/CPURLConnection.j index b520cf9fd..0349947c1 100644 --- a/Foundation/CPURLConnection.j +++ b/Foundation/CPURLConnection.j @@ -27,6 +27,7 @@ @import "CPURLResponse.j" var CPURLConnectionDelegate = nil; +var withCredentials = NO; /*! @class CPURLConnection @@ -87,6 +88,21 @@ var CPURLConnectionDelegate = nil; CPURLConnectionDelegate = delegate; } +/* + Sets a flag to designate whether async XMLHTTPRequests should allow credentials to be sent or not. + This only works with async calls. + @param willSendWithCredentials flag to let XMLHTTPRequests to use withCredentials +*/ ++ (void)setWithCredentials:(BOOL)willSendWithCredentials +{ + withCredentials = willSendWithCredentials; +} + ++ (BOOL)withCredentials +{ + return withCredentials; +} + /* Sends a request for the data from a URL. This is the easiest way to obtain data from a URL. @param aRequest contains the URL to request the data from @@ -189,6 +205,8 @@ var CPURLConnectionDelegate = nil; { _isCanceled = NO; + _HTTPRequest.setWithCredentials(withCredentials); + try { _HTTPRequest.open([_request HTTPMethod], [[_request URL] absoluteString], YES);