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

Unified Diff: src/org/adblockplus/brazil/TransparentProxyHandler.java

Issue 8484110: ABP/Android proxy service (Closed)
Patch Set: Created Oct. 5, 2012, 9:28 a.m.
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/org/adblockplus/brazil/SSLConnectionHandler.java ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/org/adblockplus/brazil/TransparentProxyHandler.java
===================================================================
new file mode 100644
--- /dev/null
+++ b/src/org/adblockplus/brazil/TransparentProxyHandler.java
@@ -0,0 +1,32 @@
+package org.adblockplus.brazil;
+
+import java.io.IOException;
+
+import sunlabs.brazil.server.Handler;
+import sunlabs.brazil.server.Request;
+import sunlabs.brazil.server.Server;
+
+/**
+ * Reconstructs request url to comply with proxy specification if transparent
+ * proxy is used.
+ */
+public class TransparentProxyHandler implements Handler
+{
+
+ @Override
+ public boolean init(Server server, String prefix)
+ {
+ return true;
+ }
+
+ @Override
+ public boolean respond(Request request) throws IOException
+ {
+ if (!request.url.contains("://"))
+ {
+ request.url = "http://" + request.headers.get("host") + request.url;
+ }
+ return false;
+ }
+
+}
« no previous file with comments | « src/org/adblockplus/brazil/SSLConnectionHandler.java ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld