Changeset 7347 for trunk


Ignore:
Timestamp:
2004-05-19T13:17:48+12:00 (20 years ago)
Author:
davidb
Message:

Revisions made to support Greenstone being embedded in Apache
as a module.

File:
1 edited

Legend:

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

    r7229 r7347  
    868868// contains content then reponse_data contains the content-type.
    869869// Note that images can now be produced by the receptionist.
     870// Note also, alternative for get_cgihead_info below which
     871// stores the information in a text_tmap so it is more easily digested
     872
    870873void receptionist::get_cgihead_info (cgiargsclass &args, response_t &response,
    871874                     text_t &response_data, ostream &logout,
     
    901904  }
    902905}
     906
     907
     908// Alternative version of get_cgihead_info, stores fielded infomation
     909// in text_tmap rather than concatenated string
     910void receptionist::get_cgihead_info (cgiargsclass &args, text_tmap &headers,
     911                     ostream &logout, text_tmap &fcgienv) {
     912
     913  response_t response;
     914  text_t response_data;
     915
     916  // get the action
     917  action *a = actions.getaction (args["a"]);
     918  if (a != NULL) {
     919    a->get_cgihead_info (args, &protocols, response, response_data, logout);
     920
     921  } else {
     922    // the action was not found!!
     923    outconvertclass text_t2ascii;
     924    logout << text_t2ascii << "Error receptionist::get_cgihead_info: the action \""
     925       << args["a"] << "\" could not be found.\n";
     926    response = content;
     927    response_data = "text/html";
     928  }
     929
     930  if (response == location) {
     931    response_data = expandmacros(response_data, args, logout);
     932    headers["Location"] = response_data;
     933    return;
     934  }
     935
     936  // add the encoding information
     937  if (response == content) {
     938
     939    if (converters.find(args["w"]) != converters.end()) {
     940      headers["content-encoding"] = args["w"];
     941      response_data += "; charset=" + args["w"];
     942    } else {
     943      // default to utf-8
     944      headers["content-encoding"] = "utf-8";
     945      response_data += "; charset=utf-8";
     946    }
     947
     948    headers["content-type"] = response_data;
     949
     950  }
     951
     952}
     953
    903954
    904955
Note: See TracChangeset for help on using the changeset viewer.