OLD | NEW |
(Empty) | |
| 1 package org.adblockplus.brazil; |
| 2 |
| 3 import java.io.IOException; |
| 4 |
| 5 import sunlabs.brazil.server.Handler; |
| 6 import sunlabs.brazil.server.Request; |
| 7 import sunlabs.brazil.server.Server; |
| 8 |
| 9 /** |
| 10 * Reconstructs request url to comply with proxy specification if transparent |
| 11 * proxy is used. |
| 12 */ |
| 13 public class TransparentProxyHandler implements Handler |
| 14 { |
| 15 |
| 16 @Override |
| 17 public boolean init(Server server, String prefix) |
| 18 { |
| 19 return true; |
| 20 } |
| 21 |
| 22 @Override |
| 23 public boolean respond(Request request) throws IOException |
| 24 { |
| 25 if (!request.url.contains("://")) |
| 26 { |
| 27 request.url = "http://" + request.headers.get("host") + request.url; |
| 28 } |
| 29 return false; |
| 30 } |
| 31 |
| 32 } |
OLD | NEW |