You are viewing a plain text version of this content. The canonical link for it is here.
Posted to apache-bugdb@apache.org by Harsih Mahindra <ha...@ix.netcom.com> on 1997/11/28 19:59:20 UTC

os-windows/1490: CGI- with POST does not show QUERY_STRING environment variable.

>Number:         1490
>Category:       os-windows
>Synopsis:       CGI- with POST does not show QUERY_STRING environment variable.
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    apache
>State:          open
>Class:          sw-bug
>Submitter-Id:   apache
>Arrival-Date:   Fri Nov 28 11:00:00 PST 1997
>Last-Modified:
>Originator:     harish1@ix.netcom.com
>Organization:
apache
>Release:        1.3b3
>Environment:
Windows NT 4.0  build 1381 Service Pack 2.  
Visual C++ 5.0
Running with AMD 200 Meg Pentium-MMX,  64 Meg RAM and about 100 Meg free HD space. 
>Description:
A CGI program writen in C (instead of shell samle program provided withe the server) which simply echo back all the environment variables supported by the server.

The server runs the CGI my echo.exe program but sends "blank" for the environment variable QUERY_STRING. 

Your bug fix list about "POST" method used by MSIE 3.0X which gives an extra CR LF and Apache server "eats up that extra CRLF does seam to be working under Windows NT version server.
>How-To-Repeat:
Use following  program - compile it. Use compiled program as a CGI program  call it as "echo.exe"

-----------------------[ program begin] ---------------
#include <stdio.h>
#include <stdlib.h>

void main(int argc, char *argv[])
{
	
	printf("Content-type: text/plain\n");
	printf("\n");

	printf("SERVER_SOFTWARE = %s\n", getenv("SERVER_SOFTWARE") );
    printf("SERVER_NAME = %s\n", getenv("SERVER_NAME") );
    printf("GATEWAY_INTERFACE = %s\n", getenv("GATEWAY_INTERFACE") );
    printf("SERVER_PROTOCOL  = %s\n", getenv("SERVER_PROTOCOL") );
    printf("SERVER_PORT = %s\n", getenv("SERVER_PORT") );
    printf("REQUEST_METHOD = %s\n", getenv("REQUEST_METHOD") );
    printf("HTTP_ACCEPT = %s\n", getenv("HTTP_ACCEPT") );
    printf("PATH_INFO = %s\n", getenv("PATH_INFO") );
    printf("PATH_TRANSLATED = %s\n", getenv("PATH_TRANSLATED") );
    printf("SCRIPT_NAME = %s\n", getenv("SCRIPT_NAME") );
    printf("QUERY_STRING = %s\n", getenv("QUERY_STRING") );
    printf("REMOTE_HOST = %s\n", getenv("REMOTE_HOST") );
    printf("REMOTE_ADDR = %s\n", getenv("REMOTE_ADDR") );
    printf("AUTH_TYPE = %s\n", getenv("AUTH_TYPE") );
    printf("CONTENT_TYPE = %s\n", getenv("CONTENT_TYPE") );
    printf("CONTENT_LENGTH = %s\n", getenv("CONTENT_LENGTH") );
}
--------------------------[end of program] ----------------------------

On the client side use following HTML form to POST the form contents-

--- begin HTML ---------------------
<HTML>
<HEAD>
<TITLE>GGI Simple test</TITLE>
</HEAD>

<H1 ALIGN="CENTER">Welcome to CGI Test on Apache!</H1>

<FORM ACTION="http://your_server_name/cgi-bin/t3" METHOD=POST>

<INPUT NAME="CONTROL1" TYPE=TEXT VALUE="Your Name">
<P>Password
<BR><INPUT TYPE="PASSWORD" NAME="CONTROL2">
<P>Color
<BR><INPUT TYPE="RADIO" NAME="CONTROL3" VALUE="0" CHECKED>Red
<INPUT TYPE="RADIO" NAME="CONTROL3" VALUE="1">Green
<INPUT TYPE="RADIO" NAME="CONTROL3" VALUE="2">Blue
<P>Comments
<BR><INPUT TYPE="TEXTAREA" NAME="CONTROL4" SIZE="20,5" MAXLENGTH="250">
<P><INPUT NAME="CONTROL5" TYPE=CHECKBOX CHECKED>Send receipt

<P><INPUT TYPE="SUBMIT" VALUE="OK"><INPUT TYPE="RESET" VALUE="Reset">
</FORM>
</FORM>

------- end HTML --------------------
>Fix:
Most probable reason for theis problem is - Extra CRLF sent by MSIE to the server between the POST method. 

Your documentation some where says you have taken care of these "legacy" problem by eating away the extra CRLF. However this fix is not working on "Win-NT" server.
>Audit-Trail:
>Unformatted:
[In order for any reply to be added to the PR database, ]
[you need to include <ap...@Apache.Org> in the Cc line ]
[and leave the subject line UNCHANGED.  This is not done]
[automatically because of the potential for mail loops. ]