Author: jm
Date: 2012-10-11 11:18:39 -0700 (Thu, 11 Oct 2012)
New Revision: 30651

Modified:
   
core3/impl/trunk/app-impl/src/main/java/org/cytoscape/app/internal/net/server/ScreenOriginsBeforeResponse.java
Log:
Fixes #1513: Added check for trailing slashes when checking Origin HTTP header

Modified: 
core3/impl/trunk/app-impl/src/main/java/org/cytoscape/app/internal/net/server/ScreenOriginsBeforeResponse.java
===================================================================
--- 
core3/impl/trunk/app-impl/src/main/java/org/cytoscape/app/internal/net/server/ScreenOriginsBeforeResponse.java
      2012-10-11 01:14:53 UTC (rev 30650)
+++ 
core3/impl/trunk/app-impl/src/main/java/org/cytoscape/app/internal/net/server/ScreenOriginsBeforeResponse.java
      2012-10-11 18:18:39 UTC (rev 30651)
@@ -16,7 +16,16 @@
      */
     public ScreenOriginsBeforeResponse(final String... allowedOrigins)
     {
-        this.allowedOrigins = allowedOrigins;
+        this.allowedOrigins = new String[allowedOrigins.length];
+        
+        // Trim any trailing slashes
+        for (int i = 0; i < allowedOrigins.length; i++) {
+               String origin = allowedOrigins[i];
+               if (origin.endsWith("/")) {
+                       origin = origin.substring(0, origin.length() - 1);
+               }
+               this.allowedOrigins[i] = origin;
+        }
     }
 
     public CyHttpResponse intercept(CyHttpRequest request)

-- 
You received this message because you are subscribed to the Google Groups 
"cytoscape-cvs" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/cytoscape-cvs?hl=en.

Reply via email to