Changeset 3663


Ignore:
Timestamp:
2003-01-10T16:35:04+13:00 (21 years ago)
Author:
sjboddie
Message:

Altered receptionist.cpp slightly so it'll now produce nocache headers if compiled with
a GSDL_NOCACHE flag.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/gsdl/src/recpt/receptionist.cpp

    r3546 r3663  
    764764    // content response
    765765
     766#ifdef GSDL_NOCACHE
     767    contentout << "Expires: Mon, 26 Jul 1997 05:00:00 GMT\n"; // date in the past
     768    tm *tm_ptr = NULL;
     769    time_t t = time(NULL);
     770    tm_ptr = gmtime (&t);
     771    if (tm_ptr != NULL) {
     772      char *timestr = new char[128];
     773      strftime (timestr, 128, "%a, %d %b %Y %H:%M:%S", tm_ptr);
     774      contentout << "Last-Modified: " << timestr << " GMT\n"; // always modified
     775      delete timestr;
     776    }
     777    contentout << "Cache-Control: no-cache, must-revalidate\n"; // HTTP/1.1
     778    contentout << "Pragma: no-cache\n"; // HTTP/1.0
     779
     780#else
     781
    766782    // use the later of build.cfg and collect.cfg modification times
    767783    // as the Last-Modified: header, for caching values
     
    804820    contentout << "Last-Modified: " << asctime(utc_latest);
    805821      }
    806 
    807822    } // end of collection != ""
    808823
    809     /*
    810       // This block of code should prevent the users browser from caching
    811       // the page. It may be useful to uncomment this code and comment out
    812       // that directly above (which sets a "Last-Modified" header) when
    813       // doing interface development work where a given page may be
    814       // changing often.
    815 
    816     contentout << "Expires: Mon, 26 Jul 1997 05:00:00 GMT\n"; // date in the past
    817     tm *tm_ptr = NULL;
    818     time_t t = time(NULL);
    819     tm_ptr = gmtime (&t);
    820     if (tm_ptr != NULL) {
    821       char *timestr = new char[128];
    822       strftime (timestr, 128, "%a, %d %b %Y %H:%M:%S", tm_ptr);
    823       contentout << "Last-Modified: " << timestr << " GMT\n"; // always modified
    824       delete timestr;
    825     }
    826     contentout << "Cache-Control: no-cache, must-revalidate\n"; // HTTP/1.1
    827     contentout << "Pragma: no-cache\n"; // HTTP/1.0
    828     */
     824#endif
     825
    829826    contentout << text_t2ascii << "Content-type: " << response_data << "\n\n";
    830827  } else {
Note: See TracChangeset for help on using the changeset viewer.