Ignore:
Timestamp:
05/11/11 00:31:28 (9 years ago)
Author:
Admin
Message:

WebIf: Fix external css caching.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/oscam-http-helpers.c

    r5214 r5219  
    498498        pos += snprintf(pos, sizeof(buf)-(pos-buf),"Last-Modified: %s\r\n", timebuf);
    499499        if(content){
    500             pos += snprintf(pos, sizeof(buf)-(pos-buf),"ETag: \"%u\"\r\n", (uint32_t)crc32(0L, (uchar *)content, strlen(content)));
     500            uint32_t checksum = (uint32_t)crc32(0L, (uchar *)content, strlen(content));
     501            pos += snprintf(pos, sizeof(buf)-(pos-buf),"ETag: \"%u\"\r\n", checksum==0?1:checksum);
    501502        }
    502503    }
     
    550551        char buffer[1024], *pos;
    551552        int32_t read;
    552         struct stat st;
    553        
     553        struct stat st;     
    554554        stat(filename, &st);
    555555        moddate = st.st_mtime;
    556         if(moddate < modifiedheader){
    557             send_header304(f);
    558             return;
    559         }
    560556        if((fp = fopen(filename, "r"))==NULL) return;
    561557        if(!cs_malloc(&result, st.st_size + 1, -1)){
     
    569565            buffer[read] = '\0';
    570566            if(pos + read > result + st.st_size) break;     //nasty, file has grown while reading   
    571             memcpy(&pos, buffer, read);
     567            memcpy(pos, buffer, read);
    572568            pos += read;   
    573569        }       
     
    581577        }
    582578    }
    583     if(moddate < modifiedheader || (uint32_t)crc32(0L, (uchar *)result, strlen(result)) == etagheader){
     579    if((etagheader == 0 && moddate < modifiedheader) || (uint32_t)crc32(0L, (uchar *)result, strlen(result)) == etagheader){
    584580        send_header304(f);
    585581    } else {
Note: See TracChangeset for help on using the changeset viewer.