Skip to content

Commit

Permalink
Fix automatic addition of protocol in discovery endpoint (#11612)
Browse files Browse the repository at this point in the history
* Fix #11609

Signed-off-by: Yanlong He <[email protected]>

* Fix #11609

Signed-off-by: heyanlong <[email protected]>

* Update AwsEc2ServiceImplTests.java

Signed-off-by: 何延龙 <[email protected]>

* spotless

Signed-off-by: heyanlong <[email protected]>

---------

Signed-off-by: Yanlong He <[email protected]>
Signed-off-by: heyanlong <[email protected]>
Signed-off-by: 何延龙 <[email protected]>
(cherry picked from commit 2b1c9ae)
Signed-off-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
  • Loading branch information
github-actions[bot] committed Dec 18, 2023
1 parent cb3b0f3 commit 6ad9a62
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 1 deletion.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
- Fix bug where replication lag grows post primary relocation ([#11238](https://github.com/opensearch-project/OpenSearch/pull/11238))
- Fix for stuck update action in a bulk with `retry_on_conflict` property ([#11152](https://github.com/opensearch-project/OpenSearch/issues/11152))
- Fix template setting override for replication type ([#11417](https://github.com/opensearch-project/OpenSearch/pull/11417))
- Fix Automatic addition of protocol broken in #11512 ([#11609](https://github.com/opensearch-project/OpenSearch/pull/11609))

### Security

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ protected String getFullEndpoint(String endpoint) {
if (!Strings.hasText(endpoint)) {
return null;
}
if (endpoint.startsWith("http")) {
if (endpoint.startsWith("http://") || endpoint.startsWith("https://")) {
return endpoint;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -211,6 +211,10 @@ public void testGetFullEndpointWithScheme() {

String endpoint = awsEc2ServiceImpl.getFullEndpoint(clientSettings.endpoint);
assertEquals("http://ec2.us-west-2.amazonaws.com", endpoint);

assertEquals("http://httpserver.example.com", awsEc2ServiceImpl.getFullEndpoint("http://httpserver.example.com"));

assertEquals("https://httpserver.example.com", awsEc2ServiceImpl.getFullEndpoint("https://httpserver.example.com"));
}

public void testGetFullEndpointWithoutScheme() {
Expand All @@ -222,6 +226,8 @@ public void testGetFullEndpointWithoutScheme() {
String endpoint = awsEc2ServiceImpl.getFullEndpoint(clientSettings.endpoint);
assertEquals("https://ec2.us-west-2.amazonaws.com", endpoint);

assertEquals("https://httpserver.example.com", awsEc2ServiceImpl.getFullEndpoint("httpserver.example.com"));

assertNull(awsEc2ServiceImpl.getFullEndpoint(""));
}
}

0 comments on commit 6ad9a62

Please sign in to comment.