提交 7ab6d8e5 编写于 作者: J Jesse Glick 提交者: Oleg Nenashev

Adapt to newer HtmlUnit (#4398)

* Adapt to newer HtmlUnit.

* https://github.com/HtmlUnit/htmlunit/pull/29 seems to have been incompatible.
WebClient.addRequestHeader will no longer override a header in a WebRequest,
such as when the same WebClient/WebRequest was previously used with different headers.

* Tracked down a behavioral change in passing through URL-encoded path characters.
https://github.com/HtmlUnit/htmlunit/commit/2c4956863420e4baef9d3d8c23ec0577ec64d2bf picks up
https://github.com/apache/httpcomponents-client/commit/8c04c6ae5e5ba1432e40684428338ce68431766b which is the actual change.

* jenkins-test-harness 2.58
上级 f9b2c595
......@@ -71,7 +71,7 @@ THE SOFTWARE.
<dependency>
<groupId>${project.groupId}</groupId>
<artifactId>jenkins-test-harness</artifactId>
<version>2.57</version>
<version>2.58</version>
<scope>test</scope>
<exclusions>
<exclusion>
......
......@@ -48,9 +48,11 @@ public class PluginTest {
((TestPluginManager) r.jenkins.pluginManager).installDetachedPlugin("matrix-auth");
r.createWebClient().goTo("plugin/matrix-auth/images/user-disabled.png", "image/png");
r.createWebClient().goTo("plugin/matrix-auth/images/../images/user-disabled.png", "image/png"); // collapsed somewhere before it winds up in restOfPath
/* TODO https://github.com/apache/httpcomponents-client/commit/8c04c6ae5e5ba1432e40684428338ce68431766b#r32873542
r.createWebClient().assertFails("plugin/matrix-auth/images/%2E%2E/images/user-disabled.png", HttpServletResponse.SC_INTERNAL_SERVER_ERROR); // IAE from TokenList.<init>
r.createWebClient().assertFails("plugin/matrix-auth/images/%252E%252E/images/user-disabled.png", HttpServletResponse.SC_BAD_REQUEST); // SECURITY-131
r.createWebClient().assertFails("plugin/matrix-auth/images/%25252E%25252E/images/user-disabled.png", HttpServletResponse.SC_BAD_REQUEST); // just checking
*/
// SECURITY-705:
r.createWebClient().assertFails("plugin/matrix-auth/images/..%2fWEB-INF/licenses.xml", HttpServletResponse.SC_BAD_REQUEST);
r.createWebClient().assertFails("plugin/matrix-auth/./matrix-auth.jpi", /* Path collapsed to simply `credentials.jpi` before entering */ HttpServletResponse.SC_NOT_FOUND);
......
......@@ -96,6 +96,8 @@ public class HudsonHomeDiskUsageMonitorTest {
assertEquals(HttpURLConnection.HTTP_FORBIDDEN, p.getWebResponse().getStatusCode());
wc.withBasicApiToken(administrator);
request = new WebRequest(new URL(wc.getContextPath() + "administrativeMonitor/hudsonHomeIsFull/act"), HttpMethod.POST);
request.setRequestParameters(Collections.singletonList(param));
p = wc.getPage(request);
assertEquals(HttpURLConnection.HTTP_OK, p.getWebResponse().getStatusCode());
assertFalse(mon.isEnabled());
......
......@@ -99,7 +99,7 @@ public class ResourceDomainTest {
{
webClient.setThrowExceptionOnFailingStatusCode(false);
Page page = webClient.getPage(resourceRootUrl + "/static-files");
Page page = webClient.getPage(resourceRootUrl + "/static-files/");
Assert.assertEquals("resource action index page response is 404", 404, page.getWebResponse().getStatusCode());
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册