email-my
asked on
How to check Web Server is install correctly
I have 17 years programming experience out of which 7 years in C/C++. In fact my biggest problem is some confusion. I donot know why I am not able to test CGI programs. It is just a matter of some one showing me running of CGI program.
Let me explain to you what I have done in CGI programming and why I have failed.
* I have installed a omni HTTPd web server on my pentium machine running Win95.
* I have written the following small C program and compiled it as DOS program in BC++ 3.1
// browser.c
#include <stdlib.h>
#include <stdio.h>
int main(void)
{
printf("Content-type: text/html%c%c", 10, 10);
printf("I detect the following Web Browser: %s\n",
getenv("HTTP_USER_AGENT") );
return(0);
}
Following is its html document
browser.htm
<html>
<head>
<title>Which Browser</title>
</head>
<body>
<h4>
<form action = "cgi-bin/browser.exe" method="post" target="main">
I can tell what Web Broser you're using<p>
Press OK to <p>
<input type="submit" value="OK">
</h4>
</body>
</html>
* OmniHTTPd server is installed in d:\httpd directory
browser.exe is stored in d:\httpd\cgi-bin directory
browser.htm is stored in d:\httpd\htdoc
* When I open d:\httpd\htdoc in Internet Explorer (or navigator), and click
the OK switch, the system displays "File down load dialog". Where as I expected it to tell me name of browser
* Kindly let me know whether some thing wrong with my program, its html or installation of my web server. If you think neccessary, I will send you browser.exe so that you may check it on your server and let me know.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
I tried the following things and got result.
* In my source program, I added html tags like printf("<html>\n"), prinf("<body>\n"), then the browser line
printf("</body>\n"); printf(</html\n");
* rename browser.exe to browser.cgi
* while testing instead of opening document as d:\httpd\browser.htm I opened document as http://ipaddress/browser.htm. I worked.
* Now I have to check why Web server was not able to resolve ip address as I expected.
Note: If you expert can help me in this matter, I would really love it.