Skip to content

Commit

Permalink
fix(android): set all cookies on proxied requests
Browse files Browse the repository at this point in the history
Fixes #5780.
  • Loading branch information
tlancina committed Jul 20, 2022
1 parent ad83827 commit c7e6847
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 c7e6847

Please sign in to comment.