Click here to Skip to main content
15,887,175 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:

I am using an Apache Server and I wrote a CGI to spit out a HTML Page, basically (for now)returning the submitted parameters.
I am using it on the LocalHost in order to get a feel of how these things work.

The page is also printed to File.

When trying to fire the CGI, I get the Following Error.:

[Mon Aug 09 23:34:58 2010] [error] [client 127.0.0.1] malformed header from script. Bad header=<HTML>: EchoHtm.cgi, referer: http://localhost/


However, the printed page is perfectly acceptable to both the server and the browser.

example:
<pre>
<HTML>
<HEAD>
<META NAME="GENERATOR" Content="Softguard\EchoHtm.cgi">
<META HTTP-EQUIV="Content-Type" content="text/html; charset=iso-8859-1">
<TITLE>Default</TITLE>
</HEAD>
<BODY>
<TABLE border="1">
<tr>
<th width="25%">Parameter</th>
<th width="55%">Value</th>
</tr>

<tr>
<td width="25%">AccNr<br></td>
<td width="55%">12345<br></td>
</tr>


<tr>
<td width="25%">UserId<br></td>
<td width="55%">abcde<br></td>
</tr>


</TABLE>

</BODY>
</HTML>



Is there something I am Missing ?

The Page is Called by the Following HTML File:

<pre>
<HTML>
<HEAD>
<META NAME="GENERATOR" Content="Microsoft Developer Studio">
<META HTTP-EQUIV="Content-Type" content="text/html; charset=iso-8859-1">
<TITLE>Softguard Sales and Support</TITLE>
</HEAD>
<BODY>

<center>
<H1>Welcome to Softguard</H1><br>
<Form Action="cgi-bin/EchoHtm.cgi" Method="GET" >

<H2>Please enter your Account Number and User ID</H2><br>
<Table Border=0 Cellspacing =20 width=400 height=20>
<TR><TD><P>Account Number</td><td><input type="text" Name="AccNr" size=48>
</td></tr>
<TR><TD><P>User ID</td><td><input type="text" Name="UserId" size=48>
</td></tr>
</Table>
<input type="submit" Value="Submit">
<input type="Reset" Value="Reset">


</Form>
</BODY>
</HTML>



Is this an Apache Configuration Issue, or, is a page generated by a cgi supposed to have some extra magic incantations in the header.

Regards


Bram van Kampen
Posted

1 solution

Hi Bram. I found some useful stuff here[^] See particularly the section headed "Writing a CGI program". It tells you exactly what to start with. As a member of the Apache users mailing list, I'd recommend you join it if you are going to do anything significant with Apache. [I host 3 sites here, and manage another on the other side of the planet.] Also the Apache online docs are good if you read carefully. [The mailing list shows up those that can't! ;P ]
Cheers,
Peter
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900