提交 40dcfcb1 编写于 作者: J Jesse Glick

[JENKINS-16368] Reverted faulty fix.

上级 ce170a60
......@@ -55,6 +55,9 @@ Upcoming changes</a>
<!-- Record your changes in the trunk here. -->
<div id="trunk" style="display:none"><!--=TRUNK-BEGIN=-->
<ul class=image>
<li class='major bug'>
Reverted change in 1.500 causing serious regression in HTTPS reverse proxy setups.
(<a href="https://issues.jenkins-ci.org/browse/JENKINS-16368">issue 16368</a>)
<li class=bug>
Bogus “Build Record Root Directory” inadequately diagnosed.
(<a href="https://issues.jenkins-ci.org/browse/JENKINS-16457">issue 16457</a>)
......
......@@ -1866,20 +1866,15 @@ public class Jenkins extends AbstractCIBase implements ModifiableTopLevelItemGro
* @see #getRootUrlFromRequest()
*/
public String getRootUrl() {
String url = JenkinsLocationConfiguration.get().getUrl();
if(url!=null && !url.endsWith("/")) {
url += '/';
if(url!=null) {
if (!url.endsWith("/")) url += '/';
return url;
}
StaplerRequest req = Stapler.getCurrentRequest();
if(req == null) return url;
if(url == null) return getRootUrlFromRequest();
// replace current protocol, if any, with request protocol
return url.replaceFirst("^\\w+(?=://)", req.getScheme());
if(req!=null)
return getRootUrlFromRequest();
return null;
}
/**
......
......@@ -87,12 +87,20 @@ public class JenkinsGetRootUrlTest {
@Bug(16368)
@Test
public void inheritProtocolWhenDispatchingRequest() {
public void doNotInheritProtocolWhenDispatchingRequest() {
configured("http://configured.host/");
accessing("https://real.host/");
rootUrlIs("https://configured.host/");
rootUrlIs("http://configured.host/");
}
@Bug(16511)
@Test
public void doNotInheritProtocolWhenDispatchingRequest2() {
configured("https://ci/jenkins/");
accessing("http://localhost:8080/");
rootUrlIs("https://ci/jenkins/");
}
private void rootUrlIs(final String expectedRootUrl) {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册