| 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 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 105 | 105 |
| 106 public void setListener(Listener listener) | 106 public void setListener(Listener listener) |
| 107 { | 107 { |
| 108 this.listener = listener; | 108 this.listener = listener; |
| 109 } | 109 } |
| 110 | 110 |
| 111 @Override | 111 @Override |
| 112 public ServerResponse httpGET(String url, List<HeaderEntry> headers) | 112 public ServerResponse httpGET(String url, List<HeaderEntry> headers) |
| 113 { | 113 { |
| 114 // since parameters may vary we need to ignore them | 114 // since parameters may vary we need to ignore them |
| 115 String urlWithoutParams = url.substring(0, url.indexOf("?")); | 115 String urlWithoutParams = Utils.getUrlWithoutParams(url); |
| 116 Integer resourceId = urlToResourceIdMap.get(urlWithoutParams); | 116 Integer resourceId = urlToResourceIdMap.get(urlWithoutParams); |
| 117 | 117 |
| 118 if (resourceId != null) | 118 if (resourceId != null) |
| 119 { | 119 { |
| 120 if (!storage.contains(urlWithoutParams)) | 120 if (!storage.contains(urlWithoutParams)) |
| 121 { | 121 { |
| 122 Log.w(TAG, "Intercepting request for " + url + " with resource #" + reso
urceId.intValue()); | 122 Log.w(TAG, "Intercepting request for " + url + " with resource #" + reso
urceId.intValue()); |
| 123 ServerResponse response = buildResourceContentResponse(resourceId); | 123 ServerResponse response = buildResourceContentResponse(resourceId); |
| 124 storage.put(urlWithoutParams); | 124 storage.put(urlWithoutParams); |
| 125 | 125 |
| (...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 247 .commit(); | 247 .commit(); |
| 248 } | 248 } |
| 249 | 249 |
| 250 @Override | 250 @Override |
| 251 public synchronized boolean contains(String url) | 251 public synchronized boolean contains(String url) |
| 252 { | 252 { |
| 253 return urls.contains(url); | 253 return urls.contains(url); |
| 254 } | 254 } |
| 255 } | 255 } |
| 256 } | 256 } |
| OLD | NEW |