Skip to content

Commit

Permalink
If no cookies in a 'Set-Cookies' header are found, try a lowercase 's…
Browse files Browse the repository at this point in the history
…et-cookies' header, as workaround for the pre-Gingerbread lowercase header bug (issue pixmob#9).
  • Loading branch information
erickok committed Apr 3, 2013
1 parent d40a026 commit 110276d
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion src/org/pixmob/httpclient/HttpRequestBuilder.java
Original file line number Diff line number Diff line change
Expand Up @@ -315,7 +315,13 @@ public HttpResponse execute() throws HttpClientException {
final Map<String, List<String>> headerFields = conn.getHeaderFields();
final Map<String, String> inMemoryCookies = hc.getInMemoryCookies();
if (headerFields != null) {
final List<String> newCookies = headerFields.get("Set-Cookie");
List<String> newCookies = headerFields.get("Set-Cookie");
if (newCookies == null) {
// Malicious web servers may return lower case header fields
// and before Gingerbread HttpURLConnection does not correct
// these properly; instead parse "set-cookie" headers too.
newCookies = headerFields.get("set-cookie");
}
if (newCookies != null) {
for (final String newCookie : newCookies) {
final String rawCookie = newCookie.split(";", 2)[0];
Expand Down

0 comments on commit 110276d

Please sign in to comment.