Diff for /parser3/src/classes/file.C between versions 1.97 and 1.98

version 1.97, 2002/09/10 10:55:32 version 1.98, 2002/09/16 15:21:36
Line 281  static void _exec_cgi(Request& r, const Line 281  static void _exec_cgi(Request& r, const
   
         const String *body=&out; // ^file:exec          const String *body=&out; // ^file:exec
         Value *content_type=0;          Value *content_type=0;
         const char *eol_marker="\r\n"; size_t eol_marker_size=2;          const char *eol_marker=0; size_t eol_marker_size;
         const String *header=0;          const String *header=0;
         if(cgi) { // ^file:cgi          if(cgi) { // ^file:cgi
                 // construct with 'out' body and header                  // construct with 'out' body and header
                 int delim_size;                  int dos_pos=out.pos("\r\n\r\n", 4);
                 int pos=out.pos("\r\n\r\n", delim_size=4);                  int unix_pos=out.pos("\n\n", 2);
                 if(pos<0) {  
                         eol_marker="\n"; eol_marker_size=1;                  bool unix_header_break;
                         pos=out.pos("\n\n", delim_size=2);                  switch((dos_pos >= 0?10:00) + (unix_pos >= 0?01:00)) {
                 }                  case 10: // dos
                 if(pos<0) {                          unix_header_break=false;
                         delim_size=0; // calm down, compiler                          break;
                   case 01: // unix
                           unix_header_break=true;
                           break;
                   case 11: // dos & unix
                           unix_header_break=unix_pos<dos_pos;
                           break;
                   default: // 00
                           unix_header_break=false; // calm down, compiler
                         throw Exception(0,                          throw Exception(0,
                                 &method_name,                                  &method_name,
                                 "output does not contain CGI header; "                                  "output does not contain CGI header; "
Line 300  static void _exec_cgi(Request& r, const Line 308  static void _exec_cgi(Request& r, const
                                         status,                                           status, 
                                         (uint)out.size(), out.cstr(),                                          (uint)out.size(), out.cstr(),
                                         (uint)err.size(), err.cstr());                                          (uint)err.size(), err.cstr());
                           break; //never reached
                   }
   
                   int header_break_pos;
                   if(unix_header_break) {
                           header_break_pos=unix_pos;
                           eol_marker="\n"; eol_marker_size=1;
                   } else {
                           header_break_pos=dos_pos;
                           eol_marker="\r\n"; eol_marker_size=2;
                 }                  }
   
                 header=&out.mid(0, pos);                  header=&out.mid(0, header_break_pos);
                 body=&out.mid(pos+delim_size, out.size());                  body=&out.mid(header_break_pos+eol_marker_size*2, out.size());
         }          }
         // body          // body
         self.set(false/*not tainted*/, body->cstr(), body->size());          self.set(false/*not tainted*/, body->cstr(), body->size());
   
         // $fields << header          // $fields << header
         if(header) {          if(header && eol_marker) {
                 Array rows(pool);                  Array rows(pool);
                 header->split(rows, 0, eol_marker, eol_marker_size);                  header->split(rows, 0, eol_marker, eol_marker_size);
                 Pass_cgi_header_attribute_info info={&self.fields()};                  Pass_cgi_header_attribute_info info={&self.fields()};

Removed from v.1.97  
changed lines
  Added in v.1.98


E-mail: