PAC Local Proxy to only receive lo connections
This changes the Local Proxy used in PAC to only accept connections coming from the device. Bug: 10230718 Change-Id: I5fbeb3aa018df5179a403301021f452e910a517d
This commit is contained in:
@@ -25,6 +25,7 @@ import com.google.android.collect.Lists;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.io.OutputStream;
|
||||
import java.net.InetAddress;
|
||||
import java.net.InetSocketAddress;
|
||||
import java.net.Proxy;
|
||||
import java.net.ProxySelector;
|
||||
@@ -198,9 +199,15 @@ public class ProxyServer extends Thread {
|
||||
|
||||
while (mIsRunning) {
|
||||
try {
|
||||
ProxyConnection parser = new ProxyConnection(serverSocket.accept());
|
||||
Socket socket = serverSocket.accept();
|
||||
// Only receive local connections.
|
||||
if (socket.getInetAddress().isLoopbackAddress()) {
|
||||
ProxyConnection parser = new ProxyConnection(socket);
|
||||
|
||||
threadExecutor.execute(parser);
|
||||
threadExecutor.execute(parser);
|
||||
} else {
|
||||
socket.close();
|
||||
}
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user