ajax

Async Ajax streaming

Well, fnar.

 

I got my web-based Mac client builder working after wrestling with Roxen and Apache to convince one of them to send raw output without waiting for the CGI script to finish (Apache needed my CGI script to explicitly output a “Content-Encoding: chunked” header of it’s own). I’ve got my little status <div> updating on the fly by using setInterval to periodically check for new lines of text added to ajax.responseText. And it works under Safari and Firefox.

Apparently, though, IE doesn’t populate responseText until readyState == 4 and status == 200; if you try to access it before then you get a javascript error saying “The data necessary to complete this operation is not yet available”. Oh, well, networking remains one of Microsoft’s weakest areas. Maybe they’ll get compatible in a future version of XMLHttpRequest / XMLHTTP.

Streaming CGI

Every now and again I come across the need to build a CGI/web page which has streaming output. That is, I want the page to start rendering before the CGI stream has finished – the way that the LookingGlass traceroute and ping tools do.

In this case, it’s for automating both the host and the Mac builds. Between yesterday and today I’ve completely automated the Mac build process along with all kinds of command switches and safeties and fallbacks. A little collection of perl scripts on the mac dev box and the patch build box.

What it needs now is a web interface (because we do everything else thru a web interface).