source: trunk/gsdl/src/recpt/cgiwrapper.cpp@ 1347

Last change on this file since 1347 was 1347, checked in by jrm21, 24 years ago

merged z39.50 receptionist stuff into main trunk (along with the mgpp stuff)

  • Property svn:executable set to *
  • Property svn:keywords set to Author Date Id Revision
File size: 21.9 KB
Line 
1/**********************************************************************
2 *
3 * cgiwrapper.cpp -- output pages using the cgi protocol
4 * Copyright (C) 1999 The New Zealand Digital Library Project
5 *
6 * A component of the Greenstone digital library software
7 * from the New Zealand Digital Library Project at the
8 * University of Waikato, New Zealand.
9 *
10 * This program is free software; you can redistribute it and/or modify
11 * it under the terms of the GNU General Public License as published by
12 * the Free Software Foundation; either version 2 of the License, or
13 * (at your option) any later version.
14 *
15 * This program is distributed in the hope that it will be useful,
16 * but WITHOUT ANY WARRANTY; without even the implied warranty of
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 * GNU General Public License for more details.
19 *
20 * You should have received a copy of the GNU General Public License
21 * along with this program; if not, write to the Free Software
22 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
23 *
24 *********************************************************************/
25
26#include "gsdlconf.h"
27#include "cgiwrapper.h"
28#include "recptconfig.h"
29#include "fileutil.h"
30#include <stdlib.h>
31#include <assert.h>
32
33#if defined(GSDL_USE_OBJECTSPACE)
34# include <ospace/std/iostream>
35# include <ospace/std/fstream>
36#elif defined(GSDL_USE_IOS_H)
37# include <iostream.h>
38# include <fstream.h>
39#else
40# include <iostream>
41# include <fstream>
42#endif
43
44#ifdef USE_FASTCGI
45#include "fcgiapp.h"
46#endif
47
48
49#ifdef USE_FASTCGI
50// used to output the text from receptionist
51class fcgistreambuf : public streambuf {
52public:
53 fcgistreambuf ();
54 int sync ();
55 int overflow (int ch);
56 int underflow () {return EOF;}
57
58 void fcgisbreset() {fcgx_stream = NULL; other_ostream = NULL;};
59 void set_fcgx_stream(FCGX_Stream *newone) {fcgx_stream=newone;};
60 void set_other_ostream(ostream *newone) {other_ostream=newone;};
61
62private:
63 FCGX_Stream *fcgx_stream;
64 ostream *other_ostream;
65};
66
67fcgistreambuf::fcgistreambuf() {
68 fcgisbreset();
69 if (base() == ebuf()) allocate();
70 setp (base(), ebuf());
71};
72
73int fcgistreambuf::sync () {
74 if ((fcgx_stream != NULL) &&
75 (FCGX_PutStr (pbase(), out_waiting(), fcgx_stream) < 0)) {
76 fcgx_stream = NULL;
77 }
78
79 if (other_ostream != NULL) {
80 char *thepbase=pbase();
81 for (int i=0;i<out_waiting();i++) (*other_ostream).put(thepbase[i]);
82 }
83
84 setp (pbase(), epptr());
85
86 return 0;
87}
88
89int fcgistreambuf::overflow (int ch) {
90 if (sync () == EOF) return EOF;
91 if (ch != EOF) sputc (ch);
92 return 0;
93}
94
95#endif
96
97static void format_error_string (text_t &errorpage, const text_t &errortext, bool debug) {
98
99 errorpage.clear();
100
101 if (debug) {
102 errorpage += "\n";
103 errorpage += "ERROR: " + errortext;
104 errorpage += "\n";
105
106 } else {
107
108 errorpage += "Content-type: text/html\n\n";
109
110 errorpage += "<html>\n";
111 errorpage += "<head>\n";
112 errorpage += "<title>Error</title>\n";
113 errorpage += "</head>\n";
114 errorpage += "<body>\n";
115 errorpage += "<h2>Oops!</h2>\n";
116 errorpage += errortext;
117 errorpage += "</body>\n";
118 errorpage += "</html>\n";
119 }
120}
121
122static void page_errorcollect (const text_t &gsdlhome, text_t &errorpage, bool debug) {
123
124 text_t collectdir = filename_cat (gsdlhome, "collect");
125
126 text_t errortext = "No valid collections were found: Check that your collect directory\n";
127 errortext += "(" + collectdir + ") is readable and contains at least one valid collection.\n";
128 errortext += "Note that modelcol is NOT a valid collection.\n";
129 errortext += "If the path to your collect directory is wrong edit the 'gsdlhome' field\n";
130 errortext += "in your gsdlsite.cfg configuration file.\n";
131
132 format_error_string (errorpage, errortext, debug);
133}
134
135static void page_errorsitecfg (text_t &errorpage, bool debug, int mode) {
136
137 text_t errortext;
138
139 if (mode == 0) {
140 errortext += "The gsdlsite.cfg configuration file could not be found. This\n";
141 errortext += "file should contain configuration information relating to this\n";
142 errortext += "site's setup.\n";
143
144 } else if (mode == 1) {
145 errortext += "The gsdlsite.cfg configuration file does not contain a valid\n";
146 errortext += "gsdlhome entry.\n";
147 }
148
149 if (debug) {
150 errortext += "gsdlsite.cfg should reside in the directory from which the\n";
151 errortext += "library executable was run.\n";
152 } else {
153 errortext += "gsdlsite.cfg should reside in the same directory as the library\n";
154 errortext += "executable file.\n";
155 }
156
157 format_error_string (errorpage, errortext, debug);
158}
159
160
161static void page_errormaincfg (const text_t &gsdlhome, const text_t &collection,
162 bool debug, text_t &errorpage) {
163
164 text_t errortext;
165
166 if (collection.empty()) {
167 text_t main_cfg_file = filename_cat (gsdlhome, "etc", "main.cfg");
168 errortext += "The main.cfg configuration file could not be found. This file\n";
169 errortext += "should contain configuration information relating to the\n";
170 errortext += "setup of the interface. As this receptionist is not being run\n";
171 errortext += "in collection specific mode the file should reside at\n";
172 errortext += main_cfg_file + ".\n";
173 } else {
174 text_t collect_cfg_file = filename_cat (gsdlhome, "collect", collection, "etc", "collect.cfg");
175 text_t main_collect_cfg_file = filename_cat (gsdlhome, "etc", "collect.cfg");
176 text_t main_cfg_file = filename_cat (gsdlhome, "etc", "main.cfg");
177 errortext += "Either the collect.cfg or main.cfg configuration file could\n";
178 errortext += "not be found. This file should contain configuration information\n";
179 errortext += "relating to the setup of the interface. As this receptionist is\n";
180 errortext += "being run in collection specific mode the file should reside\n";
181 errortext += "at either " + collect_cfg_file + ",\n";
182 errortext += main_collect_cfg_file + " or " + main_cfg_file + ".\n";
183 }
184
185 format_error_string (errorpage, errortext, debug);
186}
187
188
189static void page_errorinit (const text_t &gsdlhome, bool debug, text_t &errorpage) {
190
191 text_t errortext = "An error occurred during the initialisation of the Greenstone Digital\n";
192 errortext += "Library software. It is likely that the software has not been setup\n";
193 errortext += "correctly.\n";
194
195 text_t init_file = filename_cat (gsdlhome, "etc", "initout.txt");
196 char *ifile = init_file.getcstr();
197 ifstream initin (ifile);
198 delete ifile;
199 if (initin) {
200 errortext += "The initialisation error log, " + init_file + ", contains the\n";
201 errortext += "following information:\n\n";
202 if (!debug) errortext += "<pre>\n";
203
204 char c;
205 initin.get(c);
206 while (!initin.eof ()) {
207 errortext.push_back(c);
208 initin.get(c);
209 }
210
211 if (!debug) errortext += "</pre>\n";
212
213 initin.close();
214
215 } else {
216 errortext += "Please consult " + init_file + " for more information.\n";
217 }
218
219 format_error_string (errorpage, errortext, debug);
220}
221
222static void page_errorparseargs (const text_t &gsdlhome, bool debug, text_t &errorpage) {
223
224 text_t errortext = "An error occurred during the parsing of the cgi arguments.\n";
225
226 text_t error_file = filename_cat (gsdlhome, "etc", "errout.txt");
227 char *efile = error_file.getcstr();
228 ifstream errin (efile);
229 delete efile;
230 if (errin) {
231 errortext += "The error log, " + error_file + ", contains the\n";
232 errortext += "following information:\n\n";
233 if (!debug) errortext += "<pre>\n";
234
235 char c;
236 errin.get(c);
237 while (!errin.eof ()) {
238 errortext.push_back(c);
239 errin.get(c);
240 }
241 if (!debug) errortext += "</pre>\n";
242 errin.close();
243
244 } else {
245 errortext += "Please consult " + error_file + " for more information.\n";
246 }
247
248 format_error_string (errorpage, errortext, debug);
249}
250
251static void page_errorcgipage (const text_t &gsdlhome, bool debug, text_t &errorpage) {
252
253 text_t errortext = "An error occurred during the construction of the cgi page.\n";
254
255 text_t error_file = filename_cat (gsdlhome, "etc", "errout.txt");
256 char *efile = error_file.getcstr();
257 ifstream errin (efile);
258 delete efile;
259 if (errin) {
260 errortext += "The error log, " + error_file + ", contains the\n";
261 errortext += "following information:\n\n";
262 if (!debug) errortext += "<pre>\n";
263
264 char c;
265 errin.get(c);
266 while (!errin.eof ()) {
267 errortext.push_back(c);
268 errin.get(c);
269 }
270 if (!debug) errortext += "</pre>\n";
271 errin.close();
272
273 } else {
274 errortext += "Please consult " + error_file + " for more information.\n";
275 }
276
277 format_error_string (errorpage, errortext, debug);
278}
279
280static void print_debug_info (receptionist &recpt) {
281
282 outconvertclass text_t2ascii;
283 recptconf configinfo = recpt.get_configinfo ();
284 text_t etc_dir = filename_cat (configinfo.gsdlhome, "etc");
285
286 cout << "\n";
287 cout << text_t2ascii
288 << "------------------------------------------------------------\n"
289 << "Configuration and initialization completed successfully.\n"
290 << " Note that more debug information may be available in the\n"
291 << " initialization and error logs initout.txt and errout.txt\n"
292 << " in " << etc_dir << ".\n"
293 << "------------------------------------------------------------\n\n";
294
295 bool colspec = false;
296 if (configinfo.collection.empty()) {
297 cout << "Receptionist is running in \"general\" (i.e. not \"collection\n"
298 << "specific\") mode.\n";
299 } else {
300 cout << text_t2ascii
301 << "Receptionist is running in \"collection specific\" mode.\n"
302 << " collection=" << configinfo.collection << "\n"
303 << " collection directory=" << configinfo.collectdir << "\n";
304 colspec = true;
305 }
306
307 cout << text_t2ascii << "gsdlhome=" << configinfo.gsdlhome << "\n";
308 if (!configinfo.gdbmhome.empty())
309 cout << text_t2ascii << "gdbmhome=" << configinfo.gdbmhome << "\n";
310 cout << text_t2ascii << "httpprefix=" << configinfo.httpprefix << "\n";
311 cout << text_t2ascii << "httpimg=" << configinfo.httpimg << "\n";
312 cout << text_t2ascii << "gwcgi=" << configinfo.gwcgi << "\n"
313 << " Note that unless gwcgi has been set from a configuration\n"
314 << " file it is dependent on environment variables set by your\n"
315 << " webserver. Therefore it may not have the same value when run\n"
316 << " from the command line as it would be when run from your\n"
317 << " web server.\n";
318 if (configinfo.usecookies)
319 cout << "cookies are enabled\n";
320 else
321 cout << "cookies are disabled\n";
322 if (configinfo.logcgiargs)
323 cout << "logging is enabled\n";
324 else
325 cout << "logging is disabled\n";
326 cout << "------------------------------------------------------------\n\n";
327
328 text_tset::const_iterator this_mfile = configinfo.macrofiles.begin();
329 text_tset::const_iterator end_mfile = configinfo.macrofiles.end();
330 cout << "Macro Files:\n"
331 << "------------\n";
332 text_t mfile;
333 bool found;
334 while (this_mfile != end_mfile) {
335 cout << text_t2ascii << *this_mfile;
336 int spaces = (22 - (*this_mfile).size());
337 if (spaces < 2) spaces = 2;
338 text_t outspaces;
339 for (int i = 0; i < spaces; i++) outspaces.push_back (' ');
340 cout << text_t2ascii << outspaces;
341
342 found = false;
343 if (colspec) {
344 // collection specific - try collectdir/macros first
345 mfile = filename_cat (configinfo.collectdir, "macros", *this_mfile);
346 if (file_exists (mfile)) {
347 cout << text_t2ascii << "found (" << mfile << ")\n";
348 found = true;
349 }
350 }
351
352 if (!found) {
353 // try main macro directory
354 mfile = filename_cat (configinfo.gsdlhome, "macros", *this_mfile);
355 if (file_exists (mfile)) {
356 cout << text_t2ascii << "found (" << mfile << ")\n";
357 found = true;
358 }
359 }
360
361 if (!found)
362 cout << text_t2ascii << "NOT FOUND\n";
363
364 this_mfile ++;
365 }
366
367 cout << "------------------------------------------------------------\n\n"
368 << "Collections:\n"
369 << "------------\n"
370 << " Note that collections will only appear as \"running\" if\n"
371 << " their build.cfg files exist, are readable, contain a valid\n"
372 << " builddate field (i.e. > 0), and are in the collection's\n"
373 << " index directory (i.e. NOT the building directory)\n\n";
374
375 recptprotolistclass *protos = recpt.get_recptprotolist_ptr();
376 recptprotolistclass::iterator rprotolist_here = protos->begin();
377 recptprotolistclass::iterator rprotolist_end = protos->end();
378
379 bool is_z3950 = false;
380 bool found_valid_col = false;
381
382 while (rprotolist_here != rprotolist_end) {
383 if ((*rprotolist_here).p == NULL) continue;
384 else if (is_z3950==false &&
385 (*rprotolist_here).p->get_protocol_name() == "z3950proto") {
386 cout << "\nZ39.50 Servers: (always public)\n"
387 << "---------------\n";
388 is_z3950=true;
389 }
390
391 text_tarray collist;
392 comerror_t err;
393 (*rprotolist_here).p->get_collection_list (collist, err, cerr);
394 if (err == noError) {
395 text_tarray::iterator collist_here = collist.begin();
396 text_tarray::iterator collist_end = collist.end();
397
398 while (collist_here != collist_end) {
399
400 cout << text_t2ascii << *collist_here;
401
402 int spaces = (22 - (*collist_here).size());
403 if (spaces < 2) spaces = 2;
404 text_t outspaces;
405 for (int i = 0; i < spaces; i++) outspaces.push_back (' ');
406 cout << text_t2ascii << outspaces;
407
408 ColInfoResponse_t cinfo;
409 (*rprotolist_here).p->get_collectinfo (*collist_here, cinfo, err, cerr);
410 if (err == noError && is_z3950 == false) {
411 if (cinfo.isPublic) cout << "public ";
412 else cout << "private";
413
414 if (cinfo.buildDate > 0) cout << " running ";
415 else cout << " not running";
416 cout << text_t2ascii << *collist_here;
417
418 int spaces = (22 - (*collist_here).size());
419 if (spaces < 2) spaces = 2;
420 text_t outspaces;
421 for (int i = 0; i < spaces; i++) outspaces.push_back (' ');
422 cout << text_t2ascii << outspaces;
423
424 ColInfoResponse_t *cinfo = recpt.get_collectinfo_ptr ((*rprotolist_here).p, *collist_here, cerr);
425 if (cinfo != NULL) {
426 if (cinfo->isPublic) cout << "public ";
427 else cout << "private";
428
429 if (cinfo->buildDate > 0) {
430 cout << " running ";
431 found_valid_col = true;
432 } else {
433 cout << " not running";
434 }
435 }
436
437 cout << "\n";
438
439 collist_here ++;
440 }
441
442 cout << "\n";
443
444 collist_here ++;
445 }
446 }
447 is_z3950=false;
448 rprotolist_here ++;
449 } // end of while loop
450
451 if (!found_valid_col) {
452 cout << "WARNING: No \"running\" collections were found. You need to\n";
453 cout << " build one of the above collections\n";
454 }
455
456 cout << "\n------------------------------------------------------------\n";
457 cout << "------------------------------------------------------------\n\n";
458 cout << "receptionist running in command line debug mode\n";
459 cout << "enter cgi arguments as name=value pairs (e.g. 'a=p&p=home'):\n";
460
461}
462
463// cgiwrapper does everything necessary to output a page
464// using the cgi protocol. If this is being run for a particular
465// collection then "collection" should be set, otherwise it
466// should equal "".
467void cgiwrapper (receptionist &recpt, text_t collection) {
468
469 int numrequests = 0;
470 bool debug = false;
471 recptconf configinfo = recpt.get_configinfo ();
472
473 // find out whether this is being run as a cgi-script
474 // or a fastcgi script
475#ifdef USE_FASTCGI
476 fcgistreambuf outbuf;
477 int isfastcgi = !FCGX_IsCGI();
478 FCGX_Stream *fcgiin, *fcgiout, *fcgierr;
479 FCGX_ParamArray fcgienvp;
480#else
481 int isfastcgi = 0;
482#endif
483
484 // get the query string if it is not being run as a fastcgi
485 // script
486 text_t argstr = "";
487 cgiargsclass args;
488 char *aURIStr;
489 if (!isfastcgi) {
490 char *request_method_str = getenv("REQUEST_METHOD");
491 char *content_length_str = getenv("CONTENT_LENGTH");
492 if (request_method_str != NULL && strcmp(request_method_str, "POST") == 0 &&
493 content_length_str != NULL) {
494 // POST form data
495 int content_length = text_t(content_length_str).getint();
496 if (content_length > 0) {
497 char c;
498 do {
499 cin.get(c);
500 if (cin.eof()) break;
501 argstr.push_back (c);
502 content_length--;
503 } while (content_length > 0);
504 }
505
506 } else {
507 aURIStr = getenv("QUERY_STRING");
508 if ((request_method_str != NULL && strcmp(request_method_str, "GET") == 0)
509 || aURIStr != NULL) {
510 // GET form data
511 if (aURIStr != NULL) argstr = aURIStr;
512 } else {
513 // debugging from command line
514 debug = true;
515 }
516 }
517 }
518
519 if (debug) {
520 cout << "Configuring Greenstone...\n";
521 cout << flush;
522 }
523
524 // init stuff - we can't output error pages directly with
525 // fastcgi so the pages are stored until we can output them
526 text_t errorpage;
527 outconvertclass text_t2ascii;
528
529 // set defaults
530 int maxrequests = 10000;
531 recpt.configure ("collection", collection);
532 recpt.configure ("httpimg", "/gsdl/images");
533 char *script_name = getenv("SCRIPT_NAME");
534 if (script_name != NULL) recpt.configure("gwcgi", script_name);
535 else recpt.configure("gwcgi", "/cgi-bin/gw");
536
537 // read in the configuration files.
538 text_t gsdlhome;
539 if (!site_cfg_read (recpt, gsdlhome, maxrequests)) {
540 // couldn't find the site configuration file
541 page_errorsitecfg (errorpage, debug, 0);
542 } else if (gsdlhome.empty()) {
543 // no gsdlhome in gsdlsite.cfg
544 page_errorsitecfg (errorpage, debug, 1);
545 } else if (!main_cfg_read (recpt, gsdlhome, collection)) {
546 // couldn't find the main configuration file
547 page_errormaincfg (gsdlhome, collection, debug, errorpage);
548 } else if (configinfo.collectinfo.empty()) {
549 // don't have any collections
550 page_errorcollect (gsdlhome, errorpage, debug);
551 }
552
553 if (errorpage.empty()) {
554
555 // initialise the library software
556 if (debug) {
557 cout << "Initializing...\n";
558 cout << flush;
559 }
560
561 text_t init_file = filename_cat (gsdlhome, "etc", "initout.txt");
562 char *iout = init_file.getcstr();
563 ofstream initout (iout);
564 delete iout;
565 if (!recpt.init(initout)) {
566 // an error occurred during the initialisation
567 initout.close();
568 page_errorinit(gsdlhome, debug, errorpage);
569 }
570 initout.close();
571 }
572
573 if (debug && errorpage.empty()) {
574 // get query string from command line
575 print_debug_info (recpt);
576 char cinURIStr[1024];
577 cin.get(cinURIStr, 1024);
578 argstr = cinURIStr;
579 }
580
581 // cgi scripts only deal with one request
582 if (!isfastcgi) maxrequests = 1;
583
584 // Page-request loop. If this is not being run as a fastcgi
585 // process then only one request will be processed and then
586 // the process will exit.
587 while (numrequests < maxrequests) {
588#ifdef USE_FASTCGI
589 if (isfastcgi) {
590 if (FCGX_Accept(&fcgiin, &fcgiout, &fcgierr, &fcgienvp) < 0) break;
591
592 char *request_method_str = FCGX_GetParam ("REQUEST_METHOD", fcgienvp);
593 char *content_length_str = FCGX_GetParam ("CONTENT_LENGTH", fcgienvp);
594
595 if (request_method_str != NULL && strcmp(request_method_str, "POST") == 0 &&
596 content_length_str != NULL) {
597 // POST form data
598 int content_length = text_t(content_length_str).getint();
599 if (content_length > 0) {
600 argstr.clear();
601 int c;
602 do {
603 c = FCGX_GetChar (fcgiin);
604 if (c < 0) break;
605 argstr.push_back (c);
606 content_length--;
607 } while (content_length > 0);
608 }
609
610 } else {
611 // GET form data
612 aURIStr = FCGX_GetParam("QUERY_STRING", fcgienvp);
613 if (aURIStr != NULL) argstr = aURIStr;
614 else argstr = "";
615 }
616 }
617#endif
618
619 // get output streams ready
620#ifdef USE_FASTCGI
621 outbuf.fcgisbreset ();
622 if (isfastcgi) outbuf.set_fcgx_stream (fcgiout);
623 else outbuf.set_other_ostream (&cout);
624 ostream pageout (&outbuf);
625#else
626#define pageout cout
627#endif
628
629 // if using fastcgi we'll load environment into a map,
630 // otherwise simply pass empty map (can't get environment
631 // variables using getenv() while using FCGX versions
632 // of fastcgi - at least I can't ;-) - Stefan)
633 text_tmap fastcgienv;
634#ifdef USE_FASTCGI
635 if (isfastcgi) {
636 for(; *fcgienvp != NULL; fcgienvp++) {
637 text_t fvalue = *fcgienvp;
638 text_t::const_iterator begin = fvalue.begin();
639 text_t::const_iterator end = fvalue.end();
640 text_t::const_iterator equals_sign = findchar (begin, end, '=');
641 if (equals_sign != end)
642 fastcgienv[substr(begin, equals_sign)] = substr(equals_sign+1, end);
643 }
644 }
645#endif
646
647 // temporarily need to configure gwcgi here when using fastcgi as I can't
648 // get it to pass the SCRIPT_NAME environment variable to the initial
649 // environment (if anyone can work out how to do this using the apache
650 // server, let me know). Note that this overrides the gwcgi field in
651 // site.cfg (which it shouldn't do) but I can't at present set gwcgi
652 // from site.cfg as I have old receptionists laying around that wouldn't
653 // appreciate it. The following 5 lines of code should be deleted once
654 // I either a: get the server to pass SCRIPT_NAME at initialization
655 // time or b: convert all the collections using old receptionists over
656 // to this version and uncomment gwcgi in the site.cfg file -- Stefan.
657#ifdef USE_FASTCGI
658 if (isfastcgi) {
659 recpt.configure("gwcgi", fastcgienv["SCRIPT_NAME"]);
660 }
661#endif
662
663
664 if (errorpage.empty()) {
665 text_t error_file = filename_cat (gsdlhome, "etc", "errout.txt");
666 char *eout = error_file.getcstr();
667 ofstream errout (eout, ios::app);
668 delete eout;
669 // note that the following line appears to cause a runtime
670 // error using debug versions of VC++ 6.0 (on windows)
671 cerr = errout;
672
673 // parse the cgi arguments and produce the resulting page if there
674 // has been no errors so far
675 if (!recpt.parse_cgi_args (argstr, args, errout, fastcgienv)) {
676 errout.close ();
677 page_errorparseargs(gsdlhome, debug, errorpage);
678 } else {
679 if (!recpt.produce_cgi_page (args, pageout, errout, fastcgienv)) {
680 errout.close ();
681 page_errorcgipage(gsdlhome, debug, errorpage);
682 }
683 recpt.log_cgi_args (args, errout, fastcgienv);
684 errout.close ();
685 }
686 }
687 // there was an error, output the error page
688 if (!errorpage.empty()) {
689 pageout << text_t2ascii << errorpage;
690 errorpage.clear();
691 numrequests = maxrequests; // make this the last page
692 }
693 pageout << flush;
694
695 // finish with the output streams
696#ifdef USE_FASTCGI
697 if (isfastcgi) FCGX_Finish();
698#endif
699
700 numrequests++;
701 }
702
703 return;
704}
Note: See TracBrowser for help on using the repository browser.