Hi,

When I run the maven build behind a proxy the test
EndToEndTest.testTemplates() fails.

I'm building like so: mvn clean install -Dhttp.proxyHost=<host>
-Dhttp.proxyPort=<port>

I've got it working now, but I had to fix three things:
 - surefire plugin version: the 2.3 version doesn't pass on the proxy system
properties on, so updated to version 2.4.2 and that worked.
 - /java/common/conf/shindig.properties: shindig.content-rewrite.proxy-url
and shindig.content-rewrite.concat-url are hardcoded to
http://localhost:8080. I had to set them to http://localhost:9003 for
EndToEndTest to work.
 -
/java/gadgets/src/main/java/org/apache/shindig/gadgets/http/BasicHttpFetcher.java:
the proxyProvider is not null by default (not sure why) but instead it's set
to be of Proxy.Type.DIRECT. I fixed this by doing an extra check to ignore
the proxyProvider if it's set to be of Proxy.Type.DIRECT.

See the patch file attached (fix-proxy-bug.patch) for more details.

What I would like is for someone to confirm my findings, and if so, then I
will create a new Jira issue and submit my patch.

Cheers
Chico
Index: java/common/conf/shindig.properties
===================================================================
--- java/common/conf/shindig.properties	(revision 721112)
+++ java/common/conf/shindig.properties	(working copy)
@@ -20,8 +20,8 @@
 shindig.content-rewrite.exclude-urls=
 shindig.content-rewrite.include-tags=link,script,embed,img,style
 shindig.content-rewrite.expires=86400
-shindig.content-rewrite.proxy-url=http://localhost:8080/gadgets/proxy?url=
-shindig.content-rewrite.concat-url=http://localhost:8080/gadgets/concat?
+shindig.content-rewrite.proxy-url=http://localhost:9003/gadgets/proxy?url=
+shindig.content-rewrite.concat-url=http://localhost:9003/gadgets/concat?
 
 # These values provide default TTLs for HTTP responses that don't use caching headers.
 shindig.cache.http.defaultTtl=3600000
Index: java/gadgets/src/main/java/org/apache/shindig/gadgets/http/BasicHttpFetcher.java
===================================================================
--- java/gadgets/src/main/java/org/apache/shindig/gadgets/http/BasicHttpFetcher.java	(revision 721112)
+++ java/gadgets/src/main/java/org/apache/shindig/gadgets/http/BasicHttpFetcher.java	(working copy)
@@ -87,8 +87,11 @@
    */
   private HttpURLConnection getConnection(HttpRequest request) throws IOException {
     URL url = new URL(request.getUri().toString());
-    HttpURLConnection fetcher = (HttpURLConnection) ( proxyProvider == null ?
-        url.openConnection() : url.openConnection(proxyProvider.get()));
+    
+    // ProxyProvider Fix?
+    HttpURLConnection fetcher = (HttpURLConnection) ( (proxyProvider == null || proxyProvider.get().type().equals(Proxy.Type.DIRECT)) ?
+       url.openConnection() : url.openConnection(proxyProvider.get()));
+    
     fetcher.setConnectTimeout(CONNECT_TIMEOUT_MS);
     fetcher.setRequestProperty("Accept-Encoding", "gzip, deflate");
     fetcher.setInstanceFollowRedirects(request.getFollowRedirects());
Index: pom.xml
===================================================================
--- pom.xml	(revision 721112)
+++ pom.xml	(working copy)
@@ -731,7 +731,7 @@
         <plugin>
           <groupId>org.apache.maven.plugins</groupId>
           <artifactId>maven-surefire-plugin</artifactId>
-          <version>2.3</version>
+          <version>2.4.2</version>
         </plugin>
         <plugin>
           <groupId>org.codehaus.mojo</groupId>

Reply via email to