mirror of
https://github.com/cappuccino/cappuccino.git
synced 2026-10-04 16:12:58 +00:00
Fixed: CPURLConnection now accepts withCredentials
From the original PR: CPURLConnection was modified to reduce the withCredentials flag to a file-scope member. This has been done to facilitate use of withCredentials when a developer cannot modify the CPURLConnection manually (e.g. https://github.com/wireload/Ratatosk/blob/master/WLRemoteLink.j, line 466). Refs #1296, #2138
This commit is contained in:
1 parent
33317782ea
commit
ffcef907b3
1 file changed
+18
@@ -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);
|
||||
|
||||
Reference in new issue
Block a user