View previous topic :: View next topic |
Author |
Message |
blu fire -
Joined: 25 Aug 2004 Posts: 4
|
Posted: Sun Aug 29, 2004 3:18 am Post subject: CGI program, 500 internal server error. |
|
|
I have a web form with just a submit button. The code is as follows:
Code: | <form action="cgi-bin/program.bash" method="post">
<input type="submit" />
</form> |
In program.bash I have the following:
Code: | #!/bin/bash
echo 'Content-Type: text/html'
echo '<html><body>Boo</body></html>'
echo '' |
This all works perfectly.
But if I change cgi-bin/program.bash in the form to cgi-bin/program.cgi (a C++ binary) which has the following in it:
Code: | #include <iostream>
int main() {
std::cout << "Content-Type: text/html\n" << "<html><body>Blah</body></html>\n";
return 0;
} | I receive a 500 internal server error. Whats happening? Its the same program....
Thanks for your time,
Paul _________________ -- |
|
Back to top |
|
|
aprelium-beta -
Joined: 24 Jun 2004 Posts: 383
|
Posted: Sun Aug 29, 2004 4:08 pm Post subject: Re: CGI program, 500 internal server error. |
|
|
Your CGI header is missing the empty line (which separates the Header from the body.) So change your code to (add another \n):
Code: |
std::cout << "Content-Type: text/html\n\n" << "<html><body>Blah</body></html>\n";
| [/code] _________________ Beta Testing Team
Aprelium - http://www.aprelium.com |
|
Back to top |
|
|
blu fire -
Joined: 25 Aug 2004 Posts: 4
|
Posted: Mon Aug 30, 2004 12:05 pm Post subject: |
|
|
Thanks, that solved it :) _________________ -- |
|
Back to top |
|
|
|