mirror of
https://github.com/Lastorder-DC/rhymix.git
synced 2026-01-09 03:32:00 +09:00
17523819 : enable setting SSL and HTTP port
git-svn-id: http://xe-core.googlecode.com/svn/sandbox@5109 201d5d3c-b55e-5fd7-737f-ddc643e51545
This commit is contained in:
parent
b92ae79baa
commit
3dc23c0223
11 changed files with 170 additions and 27 deletions
|
|
@ -317,12 +317,33 @@ String.prototype.setQuery = function(key, val) {
|
|||
if(val.toString().trim()) uri = uri+"?"+key+"="+val;
|
||||
}
|
||||
|
||||
uri = uri.replace(/^https:\/\//i,'http://');
|
||||
var re = /https:\/\/([^:\/]+)(:\d+|)/i;
|
||||
var check = re.exec(uri);
|
||||
if(check)
|
||||
{
|
||||
var toReplace = "http://"+check[1];
|
||||
if(typeof(http_port)!='undefined' && http_port != 80)
|
||||
{
|
||||
toReplace += ":" + http_port;
|
||||
}
|
||||
uri = uri.replace(re,toReplace);
|
||||
}
|
||||
|
||||
if(typeof(ssl_actions)!='undefined' && typeof(ssl_actions.length)!='undefined' && uri.getQuery('act')) {
|
||||
var act = uri.getQuery('act');
|
||||
for(i=0;i<ssl_actions.length;i++) {
|
||||
if(ssl_actions[i]==act) {
|
||||
uri = uri.replace(/^http:\/\//i,'https://');
|
||||
var re = /http:\/\/([^:\/]+)(:\d+|)/i;
|
||||
var check = re.exec(uri);
|
||||
if(check)
|
||||
{
|
||||
var toReplace = "https://"+check[1];
|
||||
if(typeof(https_port)!='undefined' && https_port != 443)
|
||||
{
|
||||
toReplace += ":" + https_port;
|
||||
}
|
||||
uri = uri.replace(re,toReplace);
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
60
common/js/unittest/unittest_common.html
Normal file
60
common/js/unittest/unittest_common.html
Normal file
|
|
@ -0,0 +1,60 @@
|
|||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
|
||||
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="ko">
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html;charset=UTF-8" />
|
||||
<title>JSSpec results</title>
|
||||
<link rel="stylesheet" type="text/css" href="css/JSSpec.css" />
|
||||
<script type="text/javascript" src="JSSpec/JSSpec.js"></script>
|
||||
<script type="text/javascript" src="JSSpec/diff_match_patch.js"></script>
|
||||
<script type="text/javascript" src="../jquery.js"></script>
|
||||
<script type="text/javascript" src="../common.js"></script>
|
||||
<script type="text/javascript">// <![CDATA[
|
||||
describe('SetQuery', {
|
||||
'should satisfy basic uri condition' : function() {
|
||||
target = "http://www.zeroboard.com/";
|
||||
value_of(target.setQuery("q","r")).should_be("http://www.zeroboard.com/?q=r");
|
||||
},
|
||||
'should work when ssl is on' : function() {
|
||||
target = "http://www.zeroboard.com/";
|
||||
ssl_actions = new Array("dispLogin");
|
||||
value_of(target.setQuery("act","dispLogin")).should_be("https://www.zeroboard.com/?act=dispLogin");
|
||||
},
|
||||
'should work when ssl is on and https_port is set (not 443)' : function() {
|
||||
target = "http://www.zeroboard.com/";
|
||||
https_port = 445;
|
||||
ssl_actions = new Array("dispLogin");
|
||||
value_of(target.setQuery("act","dispLogin")).should_be("https://www.zeroboard.com:445/?act=dispLogin");
|
||||
},
|
||||
'should work when ssl is on and https_port is set as 443' : function() {
|
||||
target = "http://www.zeroboard.com/";
|
||||
https_port = 443;
|
||||
ssl_actions = new Array("dispLogin");
|
||||
value_of(target.setQuery("act","dispLogin")).should_be("https://www.zeroboard.com/?act=dispLogin");
|
||||
},
|
||||
'should replace https to http if act is not a member of ssl_actions': function() {
|
||||
targets = "https://www.zeroboard.com/";
|
||||
ssl_actions = new Array("dispLogin");
|
||||
value_of(targets.setQuery("act","dispLogin2")).should_be("http://www.zeroboard.com/?act=dispLogin2");
|
||||
},
|
||||
'should remove https port' : function() {
|
||||
targetsp = "https://www.zeroboard.com:443/?q=r";
|
||||
value_of(targetsp.setQuery("act","dispLogin2")).should_be("http://www.zeroboard.com/?q=r&act=dispLogin2");
|
||||
},
|
||||
'should remove https port and add http port if http port is defined' : function() {
|
||||
targetsp = "https://www.zeroboard.com:443/?q=r";
|
||||
http_port = 8000;
|
||||
value_of(targetsp.setQuery("act","dispLogin2")).should_be("http://www.zeroboard.com:8000/?q=r&act=dispLogin2");
|
||||
},
|
||||
'should only remove https port and if http port is defined as 80' : function() {
|
||||
targetsp = "https://www.zeroboard.com:443/?q=r";
|
||||
http_port = 80;
|
||||
value_of(targetsp.setQuery("act","dispLogin2")).should_be("http://www.zeroboard.com/?q=r&act=dispLogin2");
|
||||
},
|
||||
|
||||
})
|
||||
|
||||
// ]]></script>
|
||||
</head>
|
||||
<body><div style="display:none;"><p>A</p><p>B</p></div></body>
|
||||
</html>
|
||||
|
||||
|
|
@ -51,6 +51,8 @@
|
|||
var current_mid = "{$mid}";
|
||||
var waiting_message = "{$lang->msg_call_server}";
|
||||
var ssl_actions = new Array(<!--@if(count($ssl_actions))-->"{implode('","',$ssl_actions)}"<!--@end-->);
|
||||
<!--@if($GLOBALS["_http_port"])-->var http_port = {$GLOBALS["_http_port"]};<!--@end-->
|
||||
<!--@if($GLOBALS["_https_port"])-->var https_port = {$GLOBALS["_https_port"]};<!--@end-->
|
||||
//]]></script>
|
||||
|
||||
{Context::getHtmlHeader()}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue