 
 // --------------------------------------------------------------------
 
-// #define DEBUG
+#define DEBUG
 #ifdef DEBUG
 #define debug(a) Serial.print(millis()); Serial.print(": "); Serial.println(a);
 #define debug2(a, b) Serial.print(millis()); Serial.print(": "); Serial.print(a); Serial.println(b);

      debug("Still connected");
      while(client.available()) {
        if (parsingHeader) {
          client.find("Content-Length: ");
          char c;
          while (isdigit(c = client.read())) {

boolean downloadWaiting = false;
char* cacheFilename = "TMP";
unsigned long content_length = 0;
boolean statusOk = false;

void checkForDownload() {
  unsigned long length = 0;
  content_length = 0;
  statusOk = false;
  if (SD.exists(cacheFilename)) {
    if (SD.remove(cacheFilename)) {
      debug("Cleared cache");
