httpd-bugs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bugzi...@apache.org
Subject DO NOT REPLY [Bug 19339] New: - stdin on CGI opened in text mode
Date Fri, 25 Apr 2003 21:23:29 GMT
DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG 
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://nagoya.apache.org/bugzilla/show_bug.cgi?id=19339>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND 
INSERTED IN THE BUG DATABASE.

http://nagoya.apache.org/bugzilla/show_bug.cgi?id=19339

stdin on CGI opened in text mode

           Summary: stdin on CGI opened in text mode
           Product: Apache httpd-1.3
           Version: 1.3.23
          Platform: PC
        OS/Version: Windows 9x
            Status: NEW
          Severity: Normal
          Priority: Other
         Component: mod_cgi
        AssignedTo: bugs@httpd.apache.org
        ReportedBy: andrew_walduck@hotmail.com


Hi...

The default mode for stdin in a VC++ 5.0 C cgi-bin executable is TEXT. On a 
<form> with type=multipart/form-data this results in the 0x0D 0x0A character 
sequences being mapped to one character only. As result the following code 
doesn't work. The CONTENT_LENGTH is off from the actual number read by the 
number of 0x0D 0x0A pairs that have been converted. Is there a server based 
solution for this?

Cheers.
Andrew Walduck

    char* content_length_string;
    content_length_string = getenv("CONTENT_LENGTH");
    if(content_length_string != 0)
    {
      size_t content_length;
      content_length = strtoul(content_length_string, 0, 10);
      if(content_length != 0)
      {
        FILE* fp;
        char* buffer;
        fp = fopen("C:/tmp/CONTENT.txt", "wb");
        buffer = (char*) malloc(content_length);
        if(buffer != 0)
        {

          fread(buffer, 1, content_length, stdin);
          fwrite(buffer, 1, content_length, fp);
        }
        fclose(fp);
      }
    }

---------------------------------------------------------------------
To unsubscribe, e-mail: bugs-unsubscribe@httpd.apache.org
For additional commands, e-mail: bugs-help@httpd.apache.org


Mime
View raw message