LEFT | RIGHT |
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-2015 Eyeo GmbH | 3 * Copyright (C) 2006-2015 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 23 matching lines...) Expand all Loading... |
34 import android.util.Log; | 34 import android.util.Log; |
35 | 35 |
36 public class AndroidWebRequest extends WebRequest | 36 public class AndroidWebRequest extends WebRequest |
37 { | 37 { |
38 public final static String TAG = Utils.getTag(WebRequest.class); | 38 public final static String TAG = Utils.getTag(WebRequest.class); |
39 | 39 |
40 private final HashSet<String> subscriptionURLs = new HashSet<String>(); | 40 private final HashSet<String> subscriptionURLs = new HashSet<String>(); |
41 | 41 |
42 private boolean isListedSubscriptionUrl(final URL url) | 42 private boolean isListedSubscriptionUrl(final URL url) |
43 { | 43 { |
44 final String toCheck; | 44 String toCheck = url.toString(); |
45 | 45 |
46 if (url.getQuery() != null) | 46 final int idx = toCheck.indexOf('?'); |
| 47 if (idx != -1) |
47 { | 48 { |
48 final String tmp = url.toString(); | 49 toCheck = toCheck.substring(0, idx); |
49 final int idx = tmp.indexOf('?'); | |
50 toCheck = idx != -1 ? tmp.substring(0, idx) : tmp; | |
51 } | |
52 else | |
53 { | |
54 toCheck = url.toString(); | |
55 } | 50 } |
56 | 51 |
57 return this.subscriptionURLs.contains(toCheck); | 52 return this.subscriptionURLs.contains(toCheck); |
58 } | 53 } |
59 | 54 |
60 protected void updateSubscriptionURLs(final FilterEngine engine) | 55 protected void updateSubscriptionURLs(final FilterEngine engine) |
61 { | 56 { |
62 for (final org.adblockplus.libadblockplus.Subscription s : engine.fetchAvail
ableSubscriptions()) | 57 for (final org.adblockplus.libadblockplus.Subscription s : engine.fetchAvail
ableSubscriptions()) |
63 { | 58 { |
64 this.subscriptionURLs.add(s.getProperty("url").toString()); | 59 this.subscriptionURLs.add(s.getProperty("url").toString()); |
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
128 response.setStatus(NsStatus.ERROR_FAILURE); | 123 response.setStatus(NsStatus.ERROR_FAILURE); |
129 } | 124 } |
130 return response; | 125 return response; |
131 } | 126 } |
132 catch (final Throwable t) | 127 catch (final Throwable t) |
133 { | 128 { |
134 throw new AdblockPlusException("WebRequest failed", t); | 129 throw new AdblockPlusException("WebRequest failed", t); |
135 } | 130 } |
136 } | 131 } |
137 } | 132 } |
LEFT | RIGHT |