Changeset 872


Ignore:
Timestamp:
2000-01-26T11:45:59+13:00 (24 years ago)
Author:
sjboddie
Message:

few changes to get fastcgi to work properly

File:
1 edited

Legend:

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

    r533 r872  
    2828/*
    2929   $Log$
     30   Revision 1.21  2000/01/25 22:45:59  sjboddie
     31   few changes to get fastcgi to work properly
     32
    3033   Revision 1.20  1999/09/07 04:56:53  sjboddie
    3134   added GPL notice
     
    118121#include "recptconfig.h"
    119122#include <stdlib.h>
     123#include <assert.h>
    120124
    121125
     
    483487#endif
    484488
     489    // if using fastcgi we'll load environment into a map,
     490    // otherwise simply pass empty map (can't get environment
     491    // variables using getenv() while using FCGX versions
     492    // of fastcgi - at least I can't ;-) - Stefan)
     493    text_tmap fastcgienv;
     494#ifdef USE_FASTCGI
     495    if (isfastcgi) {
     496      for(; *fcgienvp != NULL; fcgienvp++) {
     497    text_t fvalue = *fcgienvp;
     498    text_t::const_iterator begin = fvalue.begin();
     499    text_t::const_iterator end = fvalue.end();
     500    text_t::const_iterator equals_sign = findchar (begin, end, '=');
     501    if (equals_sign != end)
     502      fastcgienv[substr(begin, equals_sign)] = substr(equals_sign+1, end);
     503      }
     504    }
     505#endif
     506
     507    // temporarily need to configure gwcgi here when using fastcgi as I can't
     508    // get it to pass the SCRIPT_NAME environment variable to the initial
     509    // environment (if anyone can work out how to do this using the apache
     510    // server, let me know). Note that this overrides the gwcgi field in
     511    // site.cfg (which it shouldn't do) but I can't at present set gwcgi
     512    // from site.cfg as I have old receptionists laying around that wouldn't
     513    // appreciate it. The following 5 lines of code should be deleted once
     514    // I either a: get the server to pass SCRIPT_NAME at initialization
     515    // time or b: convert all the collections using old receptionists over
     516    // to this version and uncomment gwcgi in the site.cfg file -- Stefan.
     517#ifdef USE_FASTCGI
     518    if (isfastcgi) {
     519      recpt.configure("gwcgi", fastcgienv["SCRIPT_NAME"]);
     520    }
     521#endif
     522
     523
    485524    if (errorpage.empty()) {
    486525      ofstream errout (GSDL_GSDLHOME "/etc/errout.txt");
     
    489528      // parse the cgi arguments and produce the resulting page if there
    490529      // has been no errors so far
    491       if (!recpt.parse_cgi_args (argstr, args, errout)) {
     530      if (!recpt.parse_cgi_args (argstr, args, errout, fastcgienv)) {
    492531    errout.close ();
    493532    page_errorparseargs(GSDL_GSDLHOME, errorpage);
    494533      } else {
    495     if (!recpt.produce_cgi_page (args, pageout, errout)) {
     534    if (!recpt.produce_cgi_page (args, pageout, errout, fastcgienv)) {
    496535      errout.close ();
    497536      page_errorcgipage(GSDL_GSDLHOME, errorpage);
     
    499538      errout.close ();
    500539    }
    501     recpt.log_cgi_args (args, errout);
     540    recpt.log_cgi_args (args, errout, fastcgienv);
    502541      }
    503542    }
Note: See TracChangeset for help on using the changeset viewer.