You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tez.apache.org by ks...@apache.org on 2017/09/18 18:25:44 UTC
tez git commit: TEZ-3724. Tez UI on HTTP corrects HTTPS REST calls to
HTTP (Jonathan Eagles via kshukla)
Repository: tez
Updated Branches:
refs/heads/master 4c2963588 -> 7236d1563
TEZ-3724. Tez UI on HTTP corrects HTTPS REST calls to HTTP (Jonathan Eagles via kshukla)
Project: http://git-wip-us.apache.org/repos/asf/tez/repo
Commit: http://git-wip-us.apache.org/repos/asf/tez/commit/7236d156
Tree: http://git-wip-us.apache.org/repos/asf/tez/tree/7236d156
Diff: http://git-wip-us.apache.org/repos/asf/tez/diff/7236d156
Branch: refs/heads/master
Commit: 7236d1563ef71a4f551da2bca5501713cbf1d037
Parents: 4c29635
Author: Kuhu Shukla <ks...@yahoo-inc.com>
Authored: Mon Sep 18 13:22:47 2017 -0500
Committer: Kuhu Shukla <ks...@yahoo-inc.com>
Committed: Mon Sep 18 13:22:47 2017 -0500
----------------------------------------------------------------------
tez-ui/src/main/webapp/app/services/hosts.js | 28 +++++++-------------
.../webapp/tests/unit/services/hosts-test.js | 8 +++---
2 files changed, 14 insertions(+), 22 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/tez/blob/7236d156/tez-ui/src/main/webapp/app/services/hosts.js
----------------------------------------------------------------------
diff --git a/tez-ui/src/main/webapp/app/services/hosts.js b/tez-ui/src/main/webapp/app/services/hosts.js
index c9e7d25..ddab5c5 100644
--- a/tez-ui/src/main/webapp/app/services/hosts.js
+++ b/tez-ui/src/main/webapp/app/services/hosts.js
@@ -23,26 +23,18 @@ export default Ember.Service.extend({
env: Ember.inject.service("env"),
correctProtocol: function (url, localProto) {
- var urlProto;
-
- localProto = localProto || window.location.protocol;
-
- if(url.match("://")) {
- urlProto = url.substr(0, url.indexOf("//"));
- }
-
- if(localProto === "file:") {
- urlProto = urlProto || "http:";
+ var index = url.indexOf("://");
+ if(index === -1) {
+ localProto = localProto || window.location.protocol;
+ return localProto + "//" + url;
}
- else {
- urlProto = localProto;
+ var urlProto = url.substr(0, index + 1);
+ if(urlProto === "file:") {
+ urlProto = localProto || "http:";
+ url = url.substr(index + 3);
+ return urlProto + "//" + url;
}
-
- if(url.match("://")) {
- url = url.substr(url.indexOf("://") + 3);
- }
-
- return urlProto + "//" + url;
+ return url;
},
normalizeURL: function (url) {
http://git-wip-us.apache.org/repos/asf/tez/blob/7236d156/tez-ui/src/main/webapp/tests/unit/services/hosts-test.js
----------------------------------------------------------------------
diff --git a/tez-ui/src/main/webapp/tests/unit/services/hosts-test.js b/tez-ui/src/main/webapp/tests/unit/services/hosts-test.js
index 026f21b..afa527c 100644
--- a/tez-ui/src/main/webapp/tests/unit/services/hosts-test.js
+++ b/tez-ui/src/main/webapp/tests/unit/services/hosts-test.js
@@ -36,11 +36,11 @@ test('Test correctProtocol', function(assert) {
// Correction
assert.equal(service.correctProtocol("localhost:8088"), "http://localhost:8088");
- assert.equal(service.correctProtocol("https://localhost:8088"), "http://localhost:8088");
+ assert.equal(service.correctProtocol("https://localhost:8088"), "https://localhost:8088");
assert.equal(service.correctProtocol("file://localhost:8088"), "http://localhost:8088");
assert.equal(service.correctProtocol("localhost:8088", "http:"), "http://localhost:8088");
- assert.equal(service.correctProtocol("https://localhost:8088", "http:"), "http://localhost:8088");
+ assert.equal(service.correctProtocol("https://localhost:8088", "http:"), "https://localhost:8088");
assert.equal(service.correctProtocol("file://localhost:8088", "http:"), "http://localhost:8088");
assert.equal(service.correctProtocol("localhost:8088", "https:"), "https://localhost:8088");
@@ -72,6 +72,6 @@ test('Test host URLs with ENV set', function(assert) {
rm: "https://localhost:4444"
}
};
- assert.equal(service.get("timeline"), "http://localhost:3333");
- assert.equal(service.get("rm"), "http://localhost:4444");
+ assert.equal(service.get("timeline"), "https://localhost:3333");
+ assert.equal(service.get("rm"), "https://localhost:4444");
});