--- /dev/null
+<html>
+<head>
+<script type="text/javascript" src="xynt/xynt-commons.js"></script>
+<script type="text/javascript" src="xynt/xynt-console.js"></script>
+ <script type="text/javascript"><!--
+
+function test_item(ins, nms, vls, out)
+{
+ this.in = ins;
+ this.nm = nms;
+ this.vl = vls;
+ this.out = out;
+}
+
+test_item.prototype = {
+in: null,
+nm: null,
+vl: null,
+out: null
+};
+
+ window.onload = function ()
+ {
+ var i, test_items;
+
+ test_items = new Array( new test_item("http://www.pippo.com", "assoli", "new_value", "http://www.pippo.com?assoli=new_value"),
+ new test_item("http://www.example.com/pippo/pluto.php?asso=1&assoli=2&assolino=3",
+ "assoli", "new_value",
+ "http://www.example.com/pippo/pluto.php?asso=1&assoli=new_value&assolino=3"),
+ new test_item("http://www.example.com/pippo/pluto.php?asso=1&assoli=2&assolino=3",
+ "bossoli", "new_value",
+ "http://www.example.com/pippo/pluto.php?asso=1&assoli=2&assolino=3&bossoli=new_value"),
+
+ new test_item("http://www.pippo.com", "assoli", "new_value_&_with_ampersand", "http://www.pippo.com?assoli=new_value_%26_with_ampersand"),
+ new test_item("http://www.example.com/pippo/pluto.php?asso=1&assoli=2&assolino=3",
+ "assoli", "new_value_&_with_ampersand",
+ "http://www.example.com/pippo/pluto.php?asso=1&assoli=new_value_%26_with_ampersand&assolino=3"),
+ new test_item("http://www.example.com/pippo/pluto.php?asso=1&assoli=2&assolino=3",
+ "bossoli", "new_value_&_with_ampersand",
+ "http://www.example.com/pippo/pluto.php?asso=1&assoli=2&assolino=3&bossoli=new_value_%26_with_ampersand"),
+ new test_item("http://dodo.birds.lan/xynt/test-hs-rd.php?sess=51583d21b104d28eac58b59f310499e5", "st", "-1", "http://dodo.birds.lan/xynt/test-hs-rd.php?sess=51583d21b104d28eac58b59f310499e5&st=-1"),
+ new test_item("http://dodo.birds.lan/xynt/test-hs-rd.php?sess=51583d21b104d28eac58b59f310499e5&st=-1", "st", "15", "http://dodo.birds.lan/xynt/test-hs-rd.php?sess=51583d21b104d28eac58b59f310499e5&st=15")
+
+ );
+
+ for (i = 0 ; i < test_items.length ; i++) {
+ $('cont').innerHTML += i+"<br>";
+ $('cont').innerHTML += "original: "+test_items[i].in+"<br>";
+ $('cont').innerHTML += "name: ["+ test_items[i].nm + "] value: ["+test_items[i].vl+"]<br>";
+ ret = url_append_arg(test_items[i].in, test_items[i].nm, test_items[i].vl);
+ $('cont').innerHTML += "result: "+ret+"<br>";
+ if (ret != test_items[i].out) {
+ break;
+ }
+ $('cont').innerHTML += "<hr>";
+ }
+
+ if (i < test_items.length) {
+ $('cont').innerHTML += "<b>ERROR AT: "+i+"</b><br>";
+ }
+ else {
+ $('cont').innerHTML += "<b>TEST SUCCESS</b><br>";
+ }
+ }
+
+//-->
+ </script>
+ </head>
+ <body>
+ <div id="cont"></div>
+ </body>
+ </html>
+
\ No newline at end of file
<script type="text/javascript" src="xynt/xynt-http-streaming-ifra.js"></script>
<script type="text/javascript">
var http_streaming = "ready";
-var ctx_new = "";
window.onload = function () { if (http_streaming != "ready") http_streaming.reload(); };
</script>
function main()
{
+ GLOBAL $st;
+
$s = "";
for ($i = 0 ; $i < 4096 ; $i++) {
$s .= rand(65,90);
}
- for ($i = 0 ; $i < 15 ; $i++) {
+
+ $to = rand(10,20);
+ for ($first = true, $i = $st+1 ; $i < $st+$to ; $i++, $first = false) {
// if ($i == 0)
// sleep(1);
if ($i != 8 || true) {
printf("<script id='hs%d' type='text/javascript'>
-push(\"$('cont').innerHTML += '%s %d';\");
-</script>", $i, ($i == 0 ? "<br/>" : ""), $i);
+push(\"$('cont').innerHTML += '%s %d'; gst.st = %d;\");
+</script>", $i, ($first ? "<br/>" : ""), $i, $i);
}
else {
// exit();
// sleep(30);
}
- if ($i == 0)
+ if ($first)
printf("<!-- %s -->", $s);
mop_flush();
usleep(1000000);
<script type="text/javascript" src="xynt/xynt-console.js"></script>
<script type="text/javascript" src="xynt/xynt-http-streaming.js"></script>
<script type="text/javascript"><!--
-var allmythings="BEGIN";
+var gst = null;
<?php
if ($action != 'stop') {
?>
window.onload = function () {
var hs;
- hs = new http_streaming(window, console);
+ var sess;
+
+ sess = '<?php
+ if (!isset($sess)) {
+ $sess = md5(mt_rand());
+ }
+ printf("%s", $sess);
+?>';
+
+ createCookie('sess', sess, 24*365,cookiepath);
+ gst = new globst();
+ hs = new http_streaming(window, gst, sess, console);
// FIXME: with relative path not work!
hs.start('http://dodo.birds.lan/xynt/test-hs-rd.php');
// hs.start('test-hs-rd.php');
}
?>
-
-
window.onkeypress = function () {
console.log("win kpress");
}
}
}
-function http_streaming(win, cons)
+function http_streaming(win, gst, sess, cons)
{
this.console = cons;
this.win = win;
+ this.sess = sess;
this.doc = win.document;
this.keepalive_old = -1;
this.keepalive_new = -1;
- this.gst = new globst();
+ this.gst = gst;
this.cmdproc = function(com){eval(com);}
}
console: null,
win: null,
doc: null,
+ sess: null,
ifra: null,
page: null,
watchdog_hdl: null,
this.doc.body.appendChild(this.ifra);
if (page != null)
this.page = page;
- // this.log(this.ifra);
+ this.page = url_append_args(this.page, "sess", this.sess, "st", gst.st);
+ this.log(this.page);
this.ifra.contentWindow.location.href = this.page;
this.watchdog_ct = 0;
this.watchdog_hdl = setTimeout(function(obj) { obj.log("tout1"); obj.watchdog(); }, this.watchdog_timeout, this);