Skip to content

Commit

Permalink
fix(android): set all cookies on proxied requests (#5781)
Browse files Browse the repository at this point in the history
  • Loading branch information
tlancina authored Sep 13, 2022
1 parent aa60a75 commit 5ef6a38
Showing 1 changed file with 7 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
import java.nio.charset.StandardCharsets;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

/**
Expand Down Expand Up @@ -360,9 +361,12 @@ private WebResourceResponse handleProxyRequest(WebResourceRequest request, PathH
String base64 = Base64.encodeToString(userInfoBytes, Base64.NO_WRAP);
conn.setRequestProperty("Authorization", "Basic " + base64);
}
String cookie = conn.getHeaderField("Set-Cookie");
if (cookie != null) {
CookieManager.getInstance().setCookie(url, cookie);

List<String> cookies = conn.getHeaderFields().get("Set-Cookie");
if (cookies != null) {
for (String cookie : cookies) {
CookieManager.getInstance().setCookie(url, cookie);
}
}
InputStream responseStream = conn.getInputStream();
responseStream = jsInjector.getInjectedStream(responseStream);
Expand Down

0 comments on commit 5ef6a38

Please sign in to comment.