Reverted commit D3841122

Summary:
This commit brings Android in line with iOS WebSockets by sending along cookies from the shared CookieManager. See: https://github.com/facebook/react-native/pull/5630
Closes https://github.com/facebook/react-native/pull/6067

Differential Revision: D3841122

Pulled By: wutalman

fbshipit-source-id: 6dae03bdf1c4599f12c0b191fcc56a61952fb59e
This commit is contained in:
Brad Daily 2016-09-22 09:08:58 -07:00 committed by Facebook Github Bot 8
parent 5f8c82412f
commit 61eb3e8826
1 changed files with 0 additions and 23 deletions

View File

@ -9,9 +9,7 @@
package com.facebook.react.modules.websocket;
import android.net.Uri;
import android.util.Base64;
import android.webkit.CookieManager;
import java.io.IOException;
import java.lang.IllegalStateException;
@ -89,27 +87,6 @@ public class WebSocketModule extends ReactContextBaseJavaModule {
.tag(id)
.url(url);
if (url != null) {
// Use the shared CookieManager to access the cookies
// set by WebViews inside the same app
CookieManager cookieManager = CookieManager.getInstance();
Uri parsedUrl = Uri.parse(url);
Uri.Builder builtUrl = parsedUrl.buildUpon();
// To get HTTPS-only cookies for wss URLs,
// replace wss with http in the URL.
if (parsedUrl.getScheme().equals("wss")) {
builtUrl.scheme("https");
}
String cookie = cookieManager.getCookie(builtUrl.build().toString());
if (cookie != null) {
builder.addHeader("Cookie", cookie);
}
}
if (headers != null) {
ReadableMapKeySetIterator iterator = headers.keySetIterator();