"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "flow-server/src/test/java/com/vaadin/flow/server/StaticFileServerTest.java" between
vaadin-flow-4.0.5.tar.gz and vaadin-flow-4.0.6.tar.gz

About: Vaadin flow is a Java framework binding Vaadin web components to Java.

StaticFileServerTest.java  (vaadin-flow-4.0.5):StaticFileServerTest.java  (vaadin-flow-4.0.6)
skipping to change at line 540 skipping to change at line 540
mockStatsBundles(mockLoader); mockStatsBundles(mockLoader);
mockConfigurationPolyfills(); mockConfigurationPolyfills();
CapturingServletOutputStream out = new CapturingServletOutputStream(); CapturingServletOutputStream out = new CapturingServletOutputStream();
Mockito.when(response.getOutputStream()).thenReturn(out); Mockito.when(response.getOutputStream()).thenReturn(out);
Assert.assertTrue(fileServer.serveStaticResource(request, response)); Assert.assertTrue(fileServer.serveStaticResource(request, response));
Assert.assertEquals(0, out.getOutput().length); Assert.assertEquals(0, out.getOutput().length);
Assert.assertEquals(HttpServletResponse.SC_FORBIDDEN,
responseCode.get());
} }
@Test @Test
public void staticBuildResourceWithDirectoryChangeWithSlash_nothingServed() public void serveStaticResource_uriWithDirectoryChangeWithSlash_returnsImmed iatelyAndSetsForbiddenStatus()
throws IOException { throws IOException {
staticBuildResourceWithDirectoryChange_nothingServed( staticBuildResourceWithDirectoryChange_nothingServed(
"/VAADIN/build/../vaadin-bundle-1234.cache.js"); "/VAADIN/build/../vaadin-bundle-1234.cache.js");
} }
@Test @Test
public void staticBuildResourceWithDirectoryChangeWithBackslash_nothingServe d() public void serveStaticResource_uriWithDirectoryChangeWithBackslash_returnsI mmediatelyAndSetsForbiddenStatus()
throws IOException { throws IOException {
staticBuildResourceWithDirectoryChange_nothingServed( staticBuildResourceWithDirectoryChange_nothingServed(
"/VAADIN/build/something\\..\\vaadin-bundle-1234.cache.js"); "/VAADIN/build/something\\..\\vaadin-bundle-1234.cache.js");
} }
@Test @Test
public void staticBuildResourceWithDirectoryChangeWithEncodedBackslashUpperC ase_nothingServed() public void serveStaticResource_uriWithDirectoryChangeWithEncodedBackslashUp perCase_returnsImmediatelyAndSetsForbiddenStatus()
throws IOException { throws IOException {
staticBuildResourceWithDirectoryChange_nothingServed( staticBuildResourceWithDirectoryChange_nothingServed(
"/VAADIN/build/something%5C..%5Cvaadin-bundle-1234.cache.js"); "/VAADIN/build/something%5C..%5Cvaadin-bundle-1234.cache.js");
} }
@Test @Test
public void staticBuildResourceWithDirectoryChangeWithEncodedBackslashLowerC ase_nothingServed() public void serveStaticResource_uriWithDirectoryChangeWithEncodedBackslashLo werCase_returnsImmediatelyAndSetsForbiddenStatus()
throws IOException { throws IOException {
staticBuildResourceWithDirectoryChange_nothingServed( staticBuildResourceWithDirectoryChange_nothingServed(
"/VAADIN/build/something%5c..%5cvaadin-bundle-1234.cache.js"); "/VAADIN/build/something%5c..%5cvaadin-bundle-1234.cache.js");
} }
@Test @Test
public void serveStaticResource_uriWithDirectoryChangeInTheEndWithSlash_retu
rnsImmediatelyAndSetsForbiddenStatus()
throws IOException {
staticBuildResourceWithDirectoryChange_nothingServed(
"/VAADIN/build/..");
}
@Test
public void serveStaticResource_uriWithDirectoryChangeInTheEndWithBackslash_
returnsImmediatelyAndSetsForbiddenStatus()
throws IOException {
staticBuildResourceWithDirectoryChange_nothingServed(
"/VAADIN/build/something\\..");
}
@Test
public void serveStaticResource_uriWithDirectoryChangeInTheEndWithEncodedBac
kslashUpperCase_returnsImmediatelyAndSetsForbiddenStatus()
throws IOException {
staticBuildResourceWithDirectoryChange_nothingServed(
"/VAADIN/build/something%5C..");
}
@Test
public void serveStaticResource_uriWithDirectoryChangeInTheEndWithEncodedBac
kslashLowerCase_returnsImmediatelyAndSetsForbiddenStatus()
throws IOException {
staticBuildResourceWithDirectoryChange_nothingServed(
"/VAADIN/build/something%5c..");
}
@Test
public void customStaticBuildResource_isServed() throws IOException { public void customStaticBuildResource_isServed() throws IOException {
String pathInfo = "/VAADIN/build/my-text.txt"; String pathInfo = "/VAADIN/build/my-text.txt";
setupRequestURI("", "", pathInfo); setupRequestURI("", "", pathInfo);
byte[] fileData = "function() {eval('foo');};" byte[] fileData = "function() {eval('foo');};"
.getBytes(StandardCharsets.UTF_8); .getBytes(StandardCharsets.UTF_8);
ClassLoader mockLoader = Mockito.mock(ClassLoader.class); ClassLoader mockLoader = Mockito.mock(ClassLoader.class);
Mockito.when(servletService.getClassLoader()).thenReturn(mockLoader); Mockito.when(servletService.getClassLoader()).thenReturn(mockLoader);
Mockito.when(mockLoader.getResource("META-INF" + pathInfo)).thenReturn( Mockito.when(mockLoader.getResource("META-INF" + pathInfo)).thenReturn(
createFileURLWithDataAndLength("META-INF" + pathInfo, createFileURLWithDataAndLength("META-INF" + pathInfo,
 End of changes. 6 change blocks. 
4 lines changed or deleted 38 lines changed or added

Home  |  About  |  Features  |  All  |  Newest  |  Dox  |  Diffs  |  RSS Feeds  |  Screenshots  |  Comments  |  Imprint  |  Privacy  |  HTTP(S)