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

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

Issue 8484110: ABP/Android proxy service (Closed)
Patch Set: ABP/Android proxy service Created Nov. 9, 2012, 9:23 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
OLDNEW
(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 }
OLDNEW

Powered by Google App Engine
This is Rietveld