Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
S
spring-cloud-netflix
Project
Overview
Details
Activity
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
openSource
spring-cloud-netflix
Commits
c417a9a5
Commit
c417a9a5
authored
Feb 14, 2017
by
Ryan Baxter
Committed by
GitHub
Feb 14, 2017
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #1695 from ryanjbaxter/uri-equal-to-empty-string
Adds a check for an empty URI in updateToHttpsIfNeeded
parents
62bc2758
52ab4d3e
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
9 additions
and
1 deletion
+9
-1
RibbonUtils.java
...org/springframework/cloud/netflix/ribbon/RibbonUtils.java
+1
-1
RibbonUtilsTests.java
...pringframework/cloud/netflix/ribbon/RibbonUtilsTests.java
+8
-0
No files found.
spring-cloud-netflix-core/src/main/java/org/springframework/cloud/netflix/ribbon/RibbonUtils.java
View file @
c417a9a5
...
...
@@ -71,7 +71,7 @@ public class RibbonUtils {
public
static
URI
updateToHttpsIfNeeded
(
URI
uri
,
IClientConfig
config
,
ServerIntrospector
serverIntrospector
,
Server
server
)
{
String
scheme
=
uri
.
getScheme
();
if
(!
"https"
.
equals
(
scheme
)
&&
isSecure
(
config
,
serverIntrospector
,
server
))
{
if
(!
"
"
.
equals
(
uri
.
toString
())
&&
!
"
https"
.
equals
(
scheme
)
&&
isSecure
(
config
,
serverIntrospector
,
server
))
{
UriComponentsBuilder
uriComponentsBuilder
=
UriComponentsBuilder
.
fromUri
(
uri
).
scheme
(
"https"
);
if
(
uri
.
getRawQuery
()
!=
null
)
{
// When building the URI, UriComponentsBuilder verify the allowed characters and does not
...
...
spring-cloud-netflix-core/src/test/java/org/springframework/cloud/netflix/ribbon/RibbonUtilsTests.java
View file @
c417a9a5
...
...
@@ -110,6 +110,14 @@ public class RibbonUtilsTests {
"https://foo/%20bar?hello=1%202"
)));
}
@Test
public
void
emptyStringUri
()
throws
URISyntaxException
{
URI
original
=
new
URI
(
""
);
URI
updated
=
updateToHttpsIfNeeded
(
original
,
SECURE_CONFIG
,
SECURE_INTROSPECTOR
,
SERVER
);
Assert
.
assertThat
(
"URI should be the emptry string"
,
updated
,
is
(
new
URI
(
""
)));
}
static
DefaultClientConfigImpl
getConfig
(
boolean
value
)
{
DefaultClientConfigImpl
config
=
new
DefaultClientConfigImpl
();
config
.
setProperty
(
CommonClientConfigKey
.
IsSecure
,
value
);
...
...
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