--- parser3/src/classes/file.C 2002/09/10 10:55:32 1.97 +++ parser3/src/classes/file.C 2002/09/16 15:21:36 1.98 @@ -5,7 +5,7 @@ Author: Alexandr Petrosian (http://paf.design.ru) */ -static const char* IDENT_FILE_C="$Date: 2002/09/10 10:55:32 $"; +static const char* IDENT_FILE_C="$Date: 2002/09/16 15:21:36 $"; #include "pa_config_includes.h" @@ -281,18 +281,26 @@ static void _exec_cgi(Request& r, const const String *body=&out; // ^file:exec 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; if(cgi) { // ^file:cgi // construct with 'out' body and header - int delim_size; - int pos=out.pos("\r\n\r\n", delim_size=4); - if(pos<0) { - eol_marker="\n"; eol_marker_size=1; - pos=out.pos("\n\n", delim_size=2); - } - if(pos<0) { - delim_size=0; // calm down, compiler + int dos_pos=out.pos("\r\n\r\n", 4); + int unix_pos=out.pos("\n\n", 2); + + bool unix_header_break; + switch((dos_pos >= 0?10:00) + (unix_pos >= 0?01:00)) { + case 10: // dos + unix_header_break=false; + break; + case 01: // unix + unix_header_break=true; + break; + case 11: // dos & unix + unix_header_break=unix_poscstr(), body->size()); // $fields << header - if(header) { + if(header && eol_marker) { Array rows(pool); header->split(rows, 0, eol_marker, eol_marker_size); Pass_cgi_header_attribute_info info={&self.fields()};