Delay Before Completion of File Load Solved

I was pulling my hair out this morning because although a css file I was loading was offering it’s contents immediately, the file didn’t complete loading to the browser for another 10+ seconds on each refresh.

After sanity checking everything I realised it’s because I was doing some string replacement on the file after calculating the filesize.

Sending the wrong filesize / string length when you spit a file results in either the browser waiting for content that will never load or cutting the content short.

If you tweak a file before splitting it, be sure to use strlen on your file just before you print to browser.

Another one of those lessons learned