Article ID: 189280
Article Last Modified on 9/1/1999
APPLIES TO
- Microsoft Internet Explorer 4.0 128-Bit Edition
This article was previously published under Q189280
SYMPTOMS
When data is posted from the Internet Explorer to a CGI application, the
browser will display an hourglass. At some point, the browser will time out
and display an error message indicating that it has done so.
CAUSE
The behavior of the Internet Explorer was changed with Internet Explorer
4.0 to more closely reflect the HTTP specification (RFC 2068). This comment
is taken from RFC 2068.
NOTE: Certain buggy HTTP/1.0 client implementations generate an extra CRLFs
after a POST request. To restate what is explicitly forbidden by the BNF,
an HTTP/1.1 client must not preface or follow a request with an extra CRLF.
CGI applications that rely on the CRLF will not work correctly with
Internet Explorer 4.0. The following code is an example that will fail:
if (!gets(cgiinput)) {
printf("Couldn't read CGI input from STDIN.\n") ;
exit(1) ;
}
Data posted to a CGI application is read by the CGI application from STDIN.
The gets() call above causes the CGI application to hang as it is dependant
on the CRLF.
RESOLUTION
A well-behaved CGI application will read exactly the number of bytes
specified by the browser in the content-length header. The following code
behaves correctly:
if ( !(content_length = atoi(getenv("CONTENT_LENGTH"))) ) {
printf("No Content-Length was sent with the POST request.\n") ;
exit(1) ;
}
if (!fread(cgiinput, content_length, 1, stdin)) {
printf("Couldn't read CGI input from STDIN.\n") ;
exit(1) ;
}
STATUS
Keywords: kbprb KB189280