| OLD | NEW |
| 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 118 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 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 // headers |
| 133 if (connection.getHeaderFields().size() > 0) { | 133 if (connection.getHeaderFields().size() > 0) { |
| 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 : |
| 136 connection.getHeaderFields().entrySet()) | 136 connection.getHeaderFields().entrySet()) |
| 137 for (String eachValue : eachEntry.getValue()) | 137 for (String eachValue : eachEntry.getValue()) |
| 138 if (eachEntry.getKey() != null && eachValue != null) | 138 if (eachEntry.getKey() != null && eachValue != null) |
| 139 responseHeaders.add(new HeaderEntry(eachEntry.getKey(), eachVa
lue)); | 139 responseHeaders.add(new HeaderEntry(eachEntry.getKey().toLower
Case(), eachValue)); |
| 140 response.setReponseHeaders(responseHeaders); | 140 response.setReponseHeaders(responseHeaders); |
| 141 } | 141 } |
| 142 | 142 |
| 143 connection.disconnect(); | 143 connection.disconnect(); |
| 144 } | 144 } |
| 145 else | 145 else |
| 146 { | 146 { |
| 147 response.setStatus(NsStatus.ERROR_FAILURE); | 147 response.setStatus(NsStatus.ERROR_FAILURE); |
| 148 } | 148 } |
| 149 return response; | 149 return response; |
| 150 } | 150 } |
| 151 catch (final Throwable t) | 151 catch (final Throwable t) |
| 152 { | 152 { |
| 153 throw new AdblockPlusException("WebRequest failed", t); | 153 throw new AdblockPlusException("WebRequest failed", t); |
| 154 } | 154 } |
| 155 } | 155 } |
| 156 } | 156 } |
| OLD | NEW |