fr a demo of tclhttpd content compression using zip deflate respectively
the tcl part, PATH/custom/filename.tcl package require vfs::zip proc repeat {x n} { global Httpd set sock $Httpd(currentSocket) upvar #0 Httpd$sock data #append newline as separator set text [string repeat $x\n $n] set data(headers) [list content-encoding deflate original-len [string length $text]] return [vfs::zip -mode compress $text] } Direct_Url /repeat ::repeat
the browser part, e.g. as PATH/htdocs/fox.html
<HTML> <HEAD> <script type='text/javascript'> var A=new String(); function $(id) { return document.getElementById(id); } function show() { var tt=new String(); $('var').value=''; var obj=$('d'); var b=$('f'); var tt=unescape(obj.contentWindow.document.body.innerHTML); b.innerHTML=tt; var p=new RegExp('^<pre>|</pre>$','ig'); //alert(tt); tt=tt.replace(/'/g,'\\\''); //remove auto-generated tags tt=tt.replace(p,'\''); tt=tt.replace(/\n/g,'\\n'); //alert('tt:<'+tt+'>'); //assign string to variable A A=eval(tt); var b=A.replace(/\n/g,'|'); $('var').value=b; } function repeat() { var x=$('d'); var direct=new String('repeat?x='); var toecho=$('x').value; toecho=escape(toecho); toecho=encodeURIComponent(toecho); var count=parseInt($('n').value); direct=direct.concat(toecho,'&n=',count); //start request x.setAttribute('src', direct); //show request in headerline $('h').innerHTML=direct; } </SCRIPT> </HEAD> <H4> functional in Firefox and Opera differently</H4> <H5> sets the source attribute of the iframe to "repeat?x=sometext&n=counter"<H5> <H5> x and n are the parameter names used in procedure repeat of tclhttpd-server<H5> <H3 id='h'>url</H3> <BODY onload="$('d').contentWindow.document.write('please press the button');$('x').value=unescape('-%e9-%f6%b7 %a5')"> <INPUT id='x'>text to echo</input> <INPUT id='n' value=7 size=4 maxlength=4>times repeated</INPUT> <INPUT type=button name=echo value='set iframe-src' onClick=repeat();><BR> <br><input id='var' size=80> | replaces newline in var A</input><br> <iframe id='d' onload=show();> </iframe> <DIV id='f'></DIV> </BODY> </HTML>