Changeset 2386
- Timestamp:
- 2001-05-08T16:58:59+12:00 (23 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/gsdl/src/recpt/receptionist.cpp
r2379 r2386 25 25 26 26 // following line required to get fstream.filedesc() on darwin (Mac OS X) 27 // gcc 2.91 automatically defines this in stream.h 27 28 #define _STREAM_COMPAT 1 28 29 … … 37 38 #include <time.h> 38 39 #include <stdio.h> 40 // following 2 are for printing Last-modified http header. 41 #include <sys/stat.h> 42 #include <time.h> 43 39 44 #if defined (GSDL_USE_IOS_H) 40 45 #include <fstream.h> … … 43 48 #endif 44 49 45 #if defined (__WIN32_ )50 #if defined (__WIN32__) 46 51 #include "wincgiutils.h" 47 52 #endif … … 752 757 } else if (response == content) { 753 758 // content response 759 760 // use the later of build.cfg and collect.cfg modification times 761 // as the Last-modified: header, for caching values 762 struct stat file_info; 763 time_t latest=0; 764 765 text_t collectname=""; 766 collectname=args["c"]; 767 if (collectname != "") { 768 text_t collectdir=filename_cat("collect",collectname); 769 text_t buildcfg=filename_cat(collectdir,"index"); 770 buildcfg=filename_cat(buildcfg,"build.cfg"); 771 char *buildcfg_ptr=buildcfg.getcstr(); 772 text_t collectcfg=filename_cat(collectdir,"etc"); 773 collectcfg=filename_cat(collectcfg,"collect.cfg"); 774 char *collectcfg_ptr=collectcfg.getcstr(); 775 776 if (stat(buildcfg_ptr, &file_info)) { 777 // we got an error. Currently don't handle error :( 778 // logout << 779 } else { 780 latest=file_info.st_mtime; 781 } 782 783 if (stat(collectcfg_ptr, &file_info)) { 784 // error - unhandled for now 785 } else { 786 if (latest<file_info.st_mtime) latest=file_info.st_mtime; 787 } 788 delete buildcfg_ptr; 789 delete collectcfg_ptr; 790 791 if (latest>0) { 792 // print out modified time, "DDD, dd MMM YYYY hh:mm:ss" format 793 // c library takes care of mem for this string... (has \n at end!!!!) 794 contentout << "Last-modified: " << ctime(&latest); 795 } 796 } 797 754 798 contentout << text_t2ascii << "Content-type: " << response_data << "\n\n"; 755 799 } else {
Note:
See TracChangeset
for help on using the changeset viewer.