       debug("Still connected");
       while(client.available()) {
         if (parsingHeader) {
+          client.find("HTTP/1.1 ");
+          char statusCode[4];
+          client.readBytes(statusCode, 3);
+          statusOk = (strcmp(statusCode, "200") == 0);
           client.find("Content-Length: ");
           char c;
           while (isdigit(c = client.read())) {


// --------------------------------------------------------------------

// #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);

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");
