Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code

Delta Between Two Patch Sets: libadblockplus-android/src/org/adblockplus/android/AndroidWebRequest.java

Issue 29346561: Issue 4160 - Return headers in AndroidWebRequest (Closed)
Left Patch Set: Created June 16, 2016, 11:04 a.m.
Right Patch Set: Codestyle fixes #3 Created Sept. 8, 2016, 1:31 p.m.
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
Left: Side by side diff | Download
Right: Side by side diff | Download
« no previous file with change/comment | « no previous file | no next file » | no next file with change/comment »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
LEFTRIGHT
1 /* 1 /*
2 * This file is part of Adblock Plus <https://adblockplus.org/>, 2 * This file is part of Adblock Plus <https://adblockplus.org/>,
3 * Copyright (C) 2006-2016 Eyeo GmbH 3 * Copyright (C) 2006-2016 Eyeo GmbH
4 * 4 *
5 * Adblock Plus is free software: you can redistribute it and/or modify 5 * Adblock Plus is free software: you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License version 3 as 6 * it under the terms of the GNU General Public License version 3 as
7 * published by the Free Software Foundation. 7 * published by the Free Software Foundation.
8 * 8 *
9 * Adblock Plus is distributed in the hope that it will be useful, 9 * Adblock Plus is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of 10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
(...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after
122 122
123 while ((character = reader.read()) != -1) 123 while ((character = reader.read()) != -1)
124 { 124 {
125 sb.append((char) character); 125 sb.append((char) character);
126 } 126 }
127 } 127 }
128 128
129 response.setStatus(NsStatus.OK); 129 response.setStatus(NsStatus.OK);
130 response.setResponse(sb.toString()); 130 response.setResponse(sb.toString());
131 131
132 // headers 132 if (connection.getHeaderFields().size() > 0)
René Jeschke 2016/07/12 16:05:09 This comment can be removed.
anton 2016/07/13 06:31:19 Acknowledged.
133 if (connection.getHeaderFields().size() > 0) { 133 {
René Jeschke 2016/07/12 16:05:09 Please pay attention to our coding style. Opening
anton 2016/07/13 06:31:19 Acknowledged.
134 List<HeaderEntry> responseHeaders = new LinkedList<HeaderEntry>(); 134 List<HeaderEntry> responseHeaders = new LinkedList<HeaderEntry>();
135 for (Map.Entry<String, List<String>> eachEntry : 135 for (Map.Entry<String, List<String>> eachEntry : connection.getHeaderF ields().entrySet())
René Jeschke 2016/07/12 16:05:09 Please pay attention to indentation, this line (an
anton 2016/07/13 06:31:19 Acknowledged.
136 connection.getHeaderFields().entrySet()) 136 {
137 for (String eachValue : eachEntry.getValue()) 137 for (String eachValue : eachEntry.getValue())
138 if (eachEntry.getKey() != null && eachValue != null) 138 {
139 responseHeaders.add(new HeaderEntry(eachEntry.getKey(), eachVa lue)); 139 if (eachEntry.getKey() != null && eachValue != null)
140 {
141 responseHeaders.add(new HeaderEntry(eachEntry.getKey(), eachValu e));
142 }
143 }
144 }
140 response.setReponseHeaders(responseHeaders); 145 response.setReponseHeaders(responseHeaders);
141 } 146 }
142 147
143 connection.disconnect(); 148 connection.disconnect();
144 } 149 }
145 else 150 else
146 { 151 {
147 response.setStatus(NsStatus.ERROR_FAILURE); 152 response.setStatus(NsStatus.ERROR_FAILURE);
148 } 153 }
149 return response; 154 return response;
150 } 155 }
151 catch (final Throwable t) 156 catch (final Throwable t)
152 { 157 {
153 throw new AdblockPlusException("WebRequest failed", t); 158 throw new AdblockPlusException("WebRequest failed", t);
154 } 159 }
155 } 160 }
156 } 161 }
LEFTRIGHT
« no previous file | no next file » | Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Toggle Comments ('s')

Powered by Google App Engine
This is Rietveld