| Left: | ||
| Right: |
| 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("://")) | |
|
Felix Dahlke
2012/11/08 20:00:43
Since we're only dealing with HTTP(S), something l
Andrey Novikov
2012/11/09 09:23:47
Why are we? It's universal, it rewrites:
GET /file
| |
| 26 { | |
| 27 request.url = "http://" + request.headers.get("host") + request.url; | |
| 28 } | |
| 29 return false; | |
| 30 } | |
| 31 | |
| 32 } | |
| OLD | NEW |