From b7c465827f88162ab5e6f1984c77b83f385d74f2 Mon Sep 17 00:00:00 2001 From: globalworming Date: Fri, 21 Nov 2014 11:27:59 +0100 Subject: [PATCH] added domainfix for facebook --- sahi-core/src/main/java/net/sf/sahi/response/HttpResponse.java | 3 +++ .../src/main/java/net/sf/sahi/workspace/WorkspaceBuilder.java | 1 + .../src/main/resources/net/sf/sahi/workspace/domainfix.txt | 1 + .../test/java/net/sf/sahi/workspace/WorkspaceBuilderTest.java | 2 +- 4 files changed, 6 insertions(+), 1 deletion(-) create mode 100644 sahi-core/src/main/resources/net/sf/sahi/workspace/domainfix.txt diff --git a/sahi-core/src/main/java/net/sf/sahi/response/HttpResponse.java b/sahi-core/src/main/java/net/sf/sahi/response/HttpResponse.java index 0a650c5c..fa478c30 100644 --- a/sahi-core/src/main/java/net/sf/sahi/response/HttpResponse.java +++ b/sahi-core/src/main/java/net/sf/sahi/response/HttpResponse.java @@ -124,6 +124,9 @@ public void modifyHeaders(boolean isKeepAlive) { removeHeader("Transfer-Encoding"); removeHeader("Transfer-encoding"); removeHeader("Content-Security-Policy"); + removeHeader("X-Frame-Options"); + removeHeader("X-Content-Type-Options"); + removeHeader("X-XSS-Protection"); setContentLength(getModifiedContentLength()); } diff --git a/sahi-core/src/main/java/net/sf/sahi/workspace/WorkspaceBuilder.java b/sahi-core/src/main/java/net/sf/sahi/workspace/WorkspaceBuilder.java index 600899d3..b9e8bdfc 100644 --- a/sahi-core/src/main/java/net/sf/sahi/workspace/WorkspaceBuilder.java +++ b/sahi-core/src/main/java/net/sf/sahi/workspace/WorkspaceBuilder.java @@ -134,6 +134,7 @@ private void copyUserDataConfig() throws IOException { resources.add("jira.properties"); resources.add("log.properties"); resources.add("userdata.properties"); + resources.add("domainfix.txt"); File destDir = new File(Utils.concatPaths(target, USER_CONFIG_ROOT)); copyResources(resources, destDir); } diff --git a/sahi-core/src/main/resources/net/sf/sahi/workspace/domainfix.txt b/sahi-core/src/main/resources/net/sf/sahi/workspace/domainfix.txt new file mode 100644 index 00000000..ace9b8c7 --- /dev/null +++ b/sahi-core/src/main/resources/net/sf/sahi/workspace/domainfix.txt @@ -0,0 +1 @@ +*.facebook.com facebook.com \ No newline at end of file diff --git a/sahi-core/src/test/java/net/sf/sahi/workspace/WorkspaceBuilderTest.java b/sahi-core/src/test/java/net/sf/sahi/workspace/WorkspaceBuilderTest.java index 0221966d..9562c35f 100644 --- a/sahi-core/src/test/java/net/sf/sahi/workspace/WorkspaceBuilderTest.java +++ b/sahi-core/src/test/java/net/sf/sahi/workspace/WorkspaceBuilderTest.java @@ -1,7 +1,6 @@ package net.sf.sahi.workspace; import com.google.common.io.Files; -import net.sf.sahi.util.Utils; import org.junit.Test; import java.io.File; @@ -35,6 +34,7 @@ public void testBuild() throws Exception { assertTrue(new File(workingDirectory, "config/userdata.properties").exists()); assertTrue(new File(workingDirectory, "config/browser_types.xml").exists()); assertTrue(new File(workingDirectory, "phantomscript/phantom.js").exists()); + assertTrue(new File(workingDirectory, "config/domainfix.txt").exists()); } @Test