Changeset 16975

Show
Ignore:
Timestamp:
22.08.2008 17:44:22 (11 years ago)
Author:
davidb
Message:

support for /collect in URL pointing to area designated by 'collecthome'

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • gsdl/trunk/runtime-src/src/w32server/cgiwrapper.cpp

    r16320 r16975  
    336336DWORD baseavailvirtual; 
    337337text_t current_gsdlhome; 
     338text_t current_collecthome; 
    338339colinfo_tmap translated_collectinfo; 
    339340   
     
    383384  text_t collection = ""; 
    384385  text_tset dbhomes; 
     386  text_tset clhomes; // collecthome companion for dbhome 
    385387  text_tset collections; 
    386388 
     
    408410    collections.insert (collection); 
    409411    dbhomes.insert (gsdl_dbhome); 
     412    clhomes.insert (gsdl_collecthome); 
    410413    collectioninfo_t tmp; 
    411414    tmp.gsdl_gsdlhome = gsdl_gsdlhome; 
     
    449452    } 
    450453    dbhomes.insert ((*this_info).second.gsdl_dbhome); 
     454    clhomes.insert ((*this_info).second.gsdl_collecthome); 
    451455      } 
    452456      ++this_info; 
     
    470474      } 
    471475      dbhomes.insert (gsdl_dbhome); 
     476      clhomes.insert (gsdl_collecthome); 
    472477    } 
    473478  } 
     
    656661  text_tset::const_iterator thome = dbhomes.begin(); 
    657662  text_tset::const_iterator ehome = dbhomes.end(); 
     663  text_tset::const_iterator tchome = clhomes.begin(); // collecthome companion for dbhome 
     664 
    658665  while (thome != ehome) { 
    659     if (!main_cfg_read (recpt, *thome, collection)) { 
     666    if (!main_cfg_read (recpt, *thome, *tchome, collection)) { 
    660667      // couldn't find the main configuration file 
    661668      page_errormaincfg (*thome, collection); 
     
    663670    } 
    664671    ++thome; 
     672    ++tchome; 
    665673  } 
    666674 
     
    768776     
    769777  // try to open the file 
    770   filename = filename_cat (current_gsdlhome, filename); 
     778  //cerr << "*** filename = " << filename.getcstr() << endl; 
     779  //cerr << "**** collect_home = " << current_collecthome.getcstr() << endl; 
     780 
     781  if (filename.size()>=9) { 
     782    text_t prefix = substr(filename.begin(),filename.begin()+9); 
     783    //cerr << "**** prefix = " << prefix.getcstr() << endl; 
     784 
     785    text_t tail = substr(filename.begin()+9,filename.end()); 
     786    //cerr << "**** tail = " << tail.getcstr() << endl; 
     787 
     788    if (prefix == "/collect/") { 
     789      filename = filename_cat (current_collecthome, tail); 
     790    } 
     791    else { 
     792      filename = filename_cat (current_gsdlhome, filename); 
     793    } 
     794  } 
     795 
     796  cerr << "#### filename = " << filename.getcstr() << endl; 
     797 
    771798  /* Feb 2002 - handle files with spaces in their name. */ 
    772799  text_t::iterator space_start; 
     
    827854  if (it != translated_collectinfo.end()) { 
    828855    current_gsdlhome = (*it).second.gsdl_gsdlhome; 
     856    current_collecthome = (*it).second.gsdl_collecthome; 
    829857  } else { 
    830858    current_gsdlhome = gsdl_gsdlhome; 
     859    current_collecthome = gsdl_collecthome; 
    831860  } 
    832861