The following reply was made to PR mod_cgi/4971; it has been noted by GNATS.
From: Mongenet Marc <[EMAIL PROTECTED]> To: [EMAIL PROTECTED], apache-bugdb@apache.org Cc: Subject: RE: mod_cgi/4971: wrong CONTENT_LENGTH due to CRLF->LF conversion Date: Wed, 8 Sep 1999 10:50:44 +0200 Problem solved, sorry for for inconvenience. Maybe it should be a FAQ for the Windows port. Here are some explanations from MS doc: "The stdin, stdout, and stderr streams always open in text mode by default;" "t Open in text (translated) mode; carriage return-linefeed (CR-LF) combinations are translated into single linefeed (LF) characters on input; LF characters are translated to CR-LF combinations on output. Also, CTRL+Z is interpreted as an end-of-file character on input. In files opened for reading or for writing and reading with "a+", the run-time library checks for a CTRL+Z at the end of the file and removes it, if possible. This is done because using fseek and ftell to move within a file may cause fseek to behave improperly near the end of the file. The t option is a Microsoft extension that should not be used where ANSI portability is desired. b Open in binary (untranslated) mode; the above translations are suppressed." "The _setmode function sets to mode the translation mode of the file given by handle. The mode must be one of two manifest constants, _O_TEXT or _O_BINARY. _O_TEXT sets text (translated) mode. Carriage return-linefeed (CR-LF) combinations are translated into a single linefeed character on input. Linefeed characters are translated into CR-LF combinations on output. _O_BINARY sets binary (untranslated) mode, in which these translations are suppressed." " #include <stdio.h> #include <fcntl.h> #include <io.h> main() { /* Set "stdin" to have binary mode: */ _setmode( _fileno( stdin ), _O_BINARY ); }" Marc Mongenet