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

Side by Side Diff: src/org/adblockplus/brazil/RequestHandler.java

Issue 10282011: ABP/Android Fix element hiding (Closed)
Patch Set: Created April 11, 2013, 11:43 a.m.
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View unified diff | Download patch
« no previous file with comments | « assets/js/start.js ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * This file is part of the Adblock Plus, 2 * This file is part of the Adblock Plus,
3 * Copyright (C) 2006-2012 Eyeo GmbH 3 * Copyright (C) 2006-2012 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 196 matching lines...) Expand 10 before | Expand all | Expand 10 after
207 request.responseHeaders.add("Via", via); 207 request.responseHeaders.add("Via", via);
208 } 208 }
209 209
210 // Detect if we need to add ElemHide filters 210 // Detect if we need to add ElemHide filters
211 String type = request.responseHeaders.get("Content-Type"); 211 String type = request.responseHeaders.get("Content-Type");
212 212
213 String selectors = null; 213 String selectors = null;
214 if (type != null && type.toLowerCase().startsWith("text/html")) 214 if (type != null && type.toLowerCase().startsWith("text/html"))
215 { 215 {
216 selectors = application.getSelectorsForDomain(reqHost); 216 selectors = application.getSelectorsForDomain(reqHost);
217 if (selectors != null)
218 selectors = selectors.replace(",", ",\r\n");
219 } 217 }
220 // If no filters are applicable just pass through the response 218 // If no filters are applicable just pass through the response
221 if (selectors == null || target.getResponseCode() != 200) 219 if (selectors == null || target.getResponseCode() != 200)
222 { 220 {
223 int contentLength = target.getContentLength(); 221 int contentLength = target.getContentLength();
224 if (contentLength == 0) 222 if (contentLength == 0)
225 { 223 {
226 // we do not use request.sendResponse to avoid arbitrary 224 // we do not use request.sendResponse to avoid arbitrary
227 // 200 -> 204 response code conversion 225 // 200 -> 204 response code conversion
228 request.sendHeaders(-1, null, -1); 226 request.sendHeaders(-1, null, -1);
(...skipping 139 matching lines...) Expand 10 before | Expand all | Expand 10 after
368 request.sendError(500, msg); 366 request.sendError(500, msg);
369 Log.e(prefix, msg, e); 367 Log.e(prefix, msg, e);
370 } 368 }
371 finally 369 finally
372 { 370 {
373 target.close(); 371 target.close();
374 } 372 }
375 return true; 373 return true;
376 } 374 }
377 } 375 }
OLDNEW
« no previous file with comments | « assets/js/start.js ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld