|
From 3f6c7a21335cb243e602e4af5a917dee2d7d2332 Mon Sep 17 00:00:00 2001 |
|
From: James Reggio <james.reggio@gmail.com> |
|
Date: Thu, 28 Sep 2017 10:20:39 -0400 |
|
Subject: [PATCH] Revert "Added Cookie Header to XML and Websocket request" |
|
|
|
This reverts commit 047961fbf77cb012b53978184102e8ca3d00c7ec. |
|
--- |
|
Libraries/Network/RCTHTTPRequestHandler.mm | 3 --- |
|
Libraries/Network/RCTNetworking.mm | 14 +------------- |
|
Libraries/WebSocket/RCTWebSocketModule.m | 14 -------------- |
|
3 files changed, 1 insertion(+), 30 deletions(-) |
|
|
|
diff --git a/Libraries/Network/RCTHTTPRequestHandler.mm b/Libraries/Network/RCTHTTPRequestHandler.mm |
|
index 1a68588..1b06eab 100644 |
|
--- a/Libraries/Network/RCTHTTPRequestHandler.mm |
|
+++ b/Libraries/Network/RCTHTTPRequestHandler.mm |
|
@@ -63,9 +63,6 @@ RCT_EXPORT_MODULE() |
|
callbackQueue.maxConcurrentOperationCount = 1; |
|
callbackQueue.underlyingQueue = [[_bridge networking] methodQueue]; |
|
NSURLSessionConfiguration *configuration = [NSURLSessionConfiguration defaultSessionConfiguration]; |
|
- [configuration setHTTPShouldSetCookies:YES]; |
|
- [configuration setHTTPCookieAcceptPolicy:NSHTTPCookieAcceptPolicyAlways]; |
|
- [configuration setHTTPCookieStorage:[NSHTTPCookieStorage sharedHTTPCookieStorage]]; |
|
_session = [NSURLSession sessionWithConfiguration:configuration |
|
delegate:self |
|
delegateQueue:callbackQueue]; |
|
diff --git a/Libraries/Network/RCTNetworking.mm b/Libraries/Network/RCTNetworking.mm |
|
index 248dfce..4a7f7cc 100644 |
|
--- a/Libraries/Network/RCTNetworking.mm |
|
+++ b/Libraries/Network/RCTNetworking.mm |
|
@@ -228,19 +228,7 @@ RCT_EXPORT_MODULE() |
|
NSURL *URL = [RCTConvert NSURL:query[@"url"]]; // this is marked as nullable in JS, but should not be null |
|
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:URL]; |
|
request.HTTPMethod = [RCTConvert NSString:RCTNilIfNull(query[@"method"])].uppercaseString ?: @"GET"; |
|
- |
|
- // Load and set the cookie header. |
|
- NSArray<NSHTTPCookie *> *cookies = [[NSHTTPCookieStorage sharedHTTPCookieStorage] cookiesForURL:URL]; |
|
- request.allHTTPHeaderFields = [NSHTTPCookie requestHeaderFieldsWithCookies:cookies]; |
|
- |
|
- // Set supplied headers. |
|
- NSDictionary *headers = [RCTConvert NSDictionary:query[@"headers"]]; |
|
- [headers enumerateKeysAndObjectsUsingBlock:^(NSString *key, id value, BOOL *stop) { |
|
- if (value) { |
|
- [request addValue:[RCTConvert NSString:value] forHTTPHeaderField:key]; |
|
- } |
|
- }]; |
|
- |
|
+ request.allHTTPHeaderFields = [self stripNullsInRequestHeaders:[RCTConvert NSDictionary:query[@"headers"]]]; |
|
request.timeoutInterval = [RCTConvert NSTimeInterval:query[@"timeout"]]; |
|
request.HTTPShouldHandleCookies = [RCTConvert BOOL:query[@"withCredentials"]]; |
|
NSDictionary<NSString *, id> *data = [RCTConvert NSDictionary:RCTNilIfNull(query[@"data"])]; |
|
diff --git a/Libraries/WebSocket/RCTWebSocketModule.m b/Libraries/WebSocket/RCTWebSocketModule.m |
|
index 6ccf3f4..f6e5d4b 100644 |
|
--- a/Libraries/WebSocket/RCTWebSocketModule.m |
|
+++ b/Libraries/WebSocket/RCTWebSocketModule.m |
|
@@ -64,20 +64,6 @@ RCT_EXPORT_MODULE() |
|
RCT_EXPORT_METHOD(connect:(NSURL *)URL protocols:(NSArray *)protocols options:(NSDictionary *)options socketID:(nonnull NSNumber *)socketID) |
|
{ |
|
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:URL]; |
|
- |
|
- // We load cookies from sharedHTTPCookieStorage (shared with XHR and |
|
- // fetch). To get secure cookies for wss URLs, replace wss with https |
|
- // in the URL. |
|
- NSURLComponents *components = [NSURLComponents componentsWithURL:URL resolvingAgainstBaseURL:true]; |
|
- if ([components.scheme.lowercaseString isEqualToString:@"wss"]) { |
|
- components.scheme = @"https"; |
|
- } |
|
- |
|
- // Load and set the cookie header. |
|
- NSArray<NSHTTPCookie *> *cookies = [[NSHTTPCookieStorage sharedHTTPCookieStorage] cookiesForURL:components.URL]; |
|
- request.allHTTPHeaderFields = [NSHTTPCookie requestHeaderFieldsWithCookies:cookies]; |
|
- |
|
- // Load supplied headers |
|
[options[@"headers"] enumerateKeysAndObjectsUsingBlock:^(NSString *key, id value, BOOL *stop) { |
|
[request addValue:[RCTConvert NSString:value] forHTTPHeaderField:key]; |
|
}]; |
|
-- |
|
2.7.4 |
|
|