webmetrics/browsermob-proxy — Issue #33: Hardcoded value localhost
Author: alexeimoisseev
Created: 2012-02-01 14:06:07+00:00
State: open

We in Yandex (http://www.yandex.com) are running WebDriver autotests on remote browsers.
In ProxyServer class there is hardcoded value of proxy host.
It doesn't work for us.

Our remote browser tries to use localhost proxy, but the proxy server runs not on the same machine as browser.
I have attached patch, that fixes isshue.
Please review it and apply.

We at Yandex hope you fix this issue.
Your tool is very helpfull for us.

```diff
--- a/src/main/java/org/browsermob/proxy/ProxyServer.java
+++ b/src/main/java/org/browsermob/proxy/ProxyServer.java
@@ -16,6 +16,8 @@ import org.openqa.selenium.Proxy;
import java.util.Date;
import java.util.Map;

+import java.net.InetAddress;
+

public class ProxyServer {
private static final HarNameVersion CREATOR = new HarNameVersion("BrowserMob Proxy", "2.0");
@@ -61,7 +63,7 @@ public class ProxyServer {
public org.openqa.selenium.Proxy seleniumProxy() {
Proxy proxy = new Proxy();
proxy.setProxyType(Proxy.ProxyType.MANUAL);
- String proxyStr = String.format("localhost:%d", getPort());
+ String proxyStr = String.format("%s:%d", InetAddress.getLocalHost().getCanonicalHostName(), getPort());
proxy.setHttpProxy(proxyStr);
proxy.setSslProxy(proxyStr);
```