Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Sign in / Register
Toggle navigation
S
spring-boot
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
DEMO
spring-boot
Commits
89d5e086
Commit
89d5e086
authored
Nov 11, 2016
by
Andy Wilkinson
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch '1.4.x' into 1.5.x
parents
c0f6c93b
a1dda12b
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
36 additions
and
0 deletions
+36
-0
JettyEmbeddedServletContainerFactory.java
.../embedded/jetty/JettyEmbeddedServletContainerFactory.java
+1
-0
AbstractEmbeddedServletContainerFactoryTests.java
...mbedded/AbstractEmbeddedServletContainerFactoryTests.java
+35
-0
No files found.
spring-boot/src/main/java/org/springframework/boot/context/embedded/jetty/JettyEmbeddedServletContainerFactory.java
View file @
89d5e086
...
...
@@ -692,6 +692,7 @@ public class JettyEmbeddedServletContainerFactory
public
ServerConnector
getConnector
(
Server
server
,
SslContextFactory
sslContextFactory
,
int
port
)
{
HttpConfiguration
config
=
new
HttpConfiguration
();
config
.
setSendServerVersion
(
false
);
config
.
addCustomizer
(
new
SecureRequestCustomizer
());
HttpConnectionFactory
connectionFactory
=
new
HttpConnectionFactory
(
config
);
SslConnectionFactory
sslConnectionFactory
=
new
SslConnectionFactory
(
...
...
spring-boot/src/test/java/org/springframework/boot/context/embedded/AbstractEmbeddedServletContainerFactoryTests.java
View file @
89d5e086
...
...
@@ -424,6 +424,41 @@ public abstract class AbstractEmbeddedServletContainerFactoryTests {
.
contains
(
"scheme=https"
);
}
@Test
public
void
serverHeaderIsDisabledByDefaultWhenUsingSsl
()
throws
Exception
{
AbstractEmbeddedServletContainerFactory
factory
=
getFactory
();
factory
.
setSsl
(
getSsl
(
null
,
"password"
,
"src/test/resources/test.jks"
));
this
.
container
=
factory
.
getEmbeddedServletContainer
(
new
ServletRegistrationBean
(
new
ExampleServlet
(
true
,
false
),
"/hello"
));
this
.
container
.
start
();
SSLConnectionSocketFactory
socketFactory
=
new
SSLConnectionSocketFactory
(
new
SSLContextBuilder
()
.
loadTrustMaterial
(
null
,
new
TrustSelfSignedStrategy
()).
build
());
HttpClient
httpClient
=
HttpClients
.
custom
().
setSSLSocketFactory
(
socketFactory
)
.
build
();
ClientHttpResponse
response
=
getClientResponse
(
getLocalUrl
(
"https"
,
"/hello"
),
HttpMethod
.
GET
,
new
HttpComponentsClientHttpRequestFactory
(
httpClient
));
assertThat
(
response
.
getHeaders
().
get
(
"Server"
)).
isNullOrEmpty
();
}
@Test
public
void
serverHeaderCanBeCustomizedWhenUsingSsl
()
throws
Exception
{
AbstractEmbeddedServletContainerFactory
factory
=
getFactory
();
factory
.
setServerHeader
(
"MyServer"
);
factory
.
setSsl
(
getSsl
(
null
,
"password"
,
"src/test/resources/test.jks"
));
this
.
container
=
factory
.
getEmbeddedServletContainer
(
new
ServletRegistrationBean
(
new
ExampleServlet
(
true
,
false
),
"/hello"
));
this
.
container
.
start
();
SSLConnectionSocketFactory
socketFactory
=
new
SSLConnectionSocketFactory
(
new
SSLContextBuilder
()
.
loadTrustMaterial
(
null
,
new
TrustSelfSignedStrategy
()).
build
());
HttpClient
httpClient
=
HttpClients
.
custom
().
setSSLSocketFactory
(
socketFactory
)
.
build
();
ClientHttpResponse
response
=
getClientResponse
(
getLocalUrl
(
"https"
,
"/hello"
),
HttpMethod
.
GET
,
new
HttpComponentsClientHttpRequestFactory
(
httpClient
));
assertThat
(
response
.
getHeaders
().
get
(
"Server"
)).
containsExactly
(
"MyServer"
);
}
protected
final
void
testBasicSslWithKeyStore
(
String
keyStore
)
throws
Exception
{
AbstractEmbeddedServletContainerFactory
factory
=
getFactory
();
addTestTxtFile
(
factory
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment