mirror of
https://github.com/lammertb/libhttp.git
synced 2025-08-09 03:22:45 +03:00
Add test case for issue #77
This commit is contained in:
@@ -20,6 +20,27 @@
|
|||||||
var hand_hour;
|
var hand_hour;
|
||||||
var hand_min;
|
var hand_min;
|
||||||
|
|
||||||
|
function queryStringElem(name, idx) {
|
||||||
|
if (typeof(queryStringElem_Table) != "object") {
|
||||||
|
queryStringElem_Table = {};
|
||||||
|
window.location.search.slice(1).split('&').forEach(
|
||||||
|
function(keyValuePair) {
|
||||||
|
keyValuePair = keyValuePair.split('=');
|
||||||
|
if (typeof(queryStringElem_Table[keyValuePair[0]]) != "object") {
|
||||||
|
queryStringElem_Table[keyValuePair[0]] = [];
|
||||||
|
}
|
||||||
|
var idx = queryStringElem_Table[keyValuePair[0]].length+1;
|
||||||
|
queryStringElem_Table[keyValuePair[0]][idx] = keyValuePair[1] || '';
|
||||||
|
}
|
||||||
|
);
|
||||||
|
}
|
||||||
|
idx = idx || 1;
|
||||||
|
if (queryStringElem_Table[name]) {
|
||||||
|
return queryStringElem_Table[name][idx];
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
function webSockKeepAlive() {
|
function webSockKeepAlive() {
|
||||||
if (keepAlive) {
|
if (keepAlive) {
|
||||||
connection.send('client still alive');
|
connection.send('client still alive');
|
||||||
@@ -35,8 +56,16 @@
|
|||||||
hand_min = document.getElementById('hand_min');
|
hand_min = document.getElementById('hand_min');
|
||||||
hand_hour = document.getElementById('hand_hour');
|
hand_hour = document.getElementById('hand_hour');
|
||||||
|
|
||||||
|
var ka = queryStringElem("keepAlive");
|
||||||
|
if (ka) {
|
||||||
|
use_keepAlive = (ka.toLowerCase()!="false") && (ka.toLowerCase()!=0);
|
||||||
|
} else {
|
||||||
|
use_keepAlive = true;
|
||||||
|
}
|
||||||
|
|
||||||
connection.onopen = function () {
|
connection.onopen = function () {
|
||||||
keepAlive = true;
|
keepAlive = use_keepAlive;
|
||||||
|
alert(keepAlive);
|
||||||
webSockKeepAlive();
|
webSockKeepAlive();
|
||||||
};
|
};
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user