Friday, 11 January 2008

Browser caching hell

Started to look at Freeswitch which I may be using over the next few months.

Initially decided to try and build it using cygwin (nasty habit that I must get rid off!), but after installing various packages, gave up after some wierd error about 64 bit integers.

So, switched to Visual Studio to build, which I thought would be dead easy. In a way, it was, once I learned a few very basic things about VS, like looking in the 'output' window to see the build progress, then I hit a problem......

Part of the build uses a vbs script to download and uncompress some dependent packages. I have stripped out the relevant code here, which is sort of interesting in itself, as I think it's really meant as an Ajaxy sort of tool:
Set xml = CreateObject("Microsoft.XMLHTTP")
Set oStream = CreateObject("Adodb.Stream")

xml.Open "GET",

Const adTypeBinary = 1
Const adSaveCreateOverWrite = 2
Const adSaveCreateNotExist = 1

oStream.type = adTypeBinary
oStream.write xml.responseBody
oStream.savetofile "pthreads-w32-2-7-0-release.tar.gz", adSaveCreateOverWrite

The code then used 7za.exe to unpack the gz and then unpack the tar file. This seemed to be where the problem started, as the .gz file seemed to be corrupt and I ended up with a file called [Content], instead of a directory structure.

I must have spent about a whole day investigating this. It was all the more strange because it seemed to work OK on my 'personal' laptop. As I seem to be rambling on, to cut a long story a bit shorter, it turned out to be a caching problem. IE had somehow created a corrupted cached version of the downloaded file and I was always getting the cached copy, instead of a fresh download.

Anyway, luckily it was in a 'downtime' period at work, so no harm done. Back to real work next week.

No comments: