Thread overview
(no subject)
Jun 06, 2010
new to d
CGI with D
Jun 06, 2010
new to d
Jun 06, 2010
Graham Fawcett
Jun 06, 2010
Robert Clipsham
Jun 06, 2010
new to d
Jun 06, 2010
Robert Clipsham
Jun 06, 2010
new to d
Jun 06, 2010
new to d
Jun 06, 2010
Michal Minich
Jun 06, 2010
Ali Çehreli
June 06, 2010
After reading on this newsgroup about the use of D with cgi i've tried it on my host. Even a simple hello world program gives me internal server error while equivalent c program compiled with gcc works fine. Does any one here have any idea what the problem could be?
June 06, 2010
new to d Wrote:

> After reading on this newsgroup about the use of D with cgi i've tried it on my host. Even a simple hello world program gives me internal server error while equivalent c program compiled with gcc works fine. Does any one here have any idea what the problem could be?

I forgot the subject in my previous post, sorry.
June 06, 2010
On 06/06/10 13:40, new to d wrote:
> After reading on this newsgroup about the use of D with cgi i've
> tried it on my host. Even a simple hello world program gives me
> internal server error while equivalent c program compiled with gcc
> works fine. Does any one here have any idea what the problem could
> be?

Could you show us your hello world code and tell us how you're compiling etc? Without more details it's hard to say what's going wrong.

Robert
June 06, 2010
Robert Clipsham Wrote:

> On 06/06/10 13:40, new to d wrote:
> > After reading on this newsgroup about the use of D with cgi i've tried it on my host. Even a simple hello world program gives me internal server error while equivalent c program compiled with gcc works fine. Does any one here have any idea what the problem could be?
> 
> Could you show us your hello world code and tell us how you're compiling etc? Without more details it's hard to say what's going wrong.
> 
> Robert


It's a typical hello world program:

import std.stdio;

void main(string[] args)
{
	writeln("Hello world!");
}

I also tried using printf instead of writeln. I'm compiling it with dmd test.d. I'm using dmd v2.046. I'm compiling the c program with gcc -otest2 test2.c.
June 06, 2010
On 06/06/10 14:00, new to d wrote:
> It's a typical hello world program:
>
> import std.stdio;
>
> void main(string[] args) { writeln("Hello world!"); }
>
> I also tried using printf instead of writeln. I'm compiling it with
> dmd test.d. I'm using dmd v2.046. I'm compiling the c program with
> gcc -otest2 test2.c.

And how are you interfacing each app with cgi? There could be some subtle difference there which is doing it, that app on its own looks fine and works here.
June 06, 2010
On Sun, 06 Jun 2010 09:00:25 -0400, new to d wrote:

> import std.stdio;
> 
> void main(string[] args)
> {
> 	writeln("Hello world!");
> }

Just a guess, but maybe the difference of your C and D programs is in return value, which can be differently interpreted by CGI host. try returning 1 or 0 from the program.
June 06, 2010
Robert Clipsham Wrote:

> On 06/06/10 14:00, new to d wrote:
> > It's a typical hello world program:
> >
> > import std.stdio;
> >
> > void main(string[] args) { writeln("Hello world!"); }
> >
> > I also tried using printf instead of writeln. I'm compiling it with dmd test.d. I'm using dmd v2.046. I'm compiling the c program with gcc -otest2 test2.c.
> 
> And how are you interfacing each app with cgi? There could be some subtle difference there which is doing it, that app on its own looks fine and works here.

It works now after i added

writeln("Content-Type: text/plain;charset=us-ascii\n\n");

I didn't know this is required, i have never used CGI before. I copied c example from some cgi tutorial and forgot to include that line in the D program. I'm sorry for wasting your time.
June 06, 2010
new to d Wrote:

> Robert Clipsham Wrote:
> 
> > On 06/06/10 14:00, new to d wrote:
> > > It's a typical hello world program:
> > >
> > > import std.stdio;
> > >
> > > void main(string[] args) { writeln("Hello world!"); }
> > >
> > > I also tried using printf instead of writeln. I'm compiling it with dmd test.d. I'm using dmd v2.046. I'm compiling the c program with gcc -otest2 test2.c.
> > 
> > And how are you interfacing each app with cgi? There could be some subtle difference there which is doing it, that app on its own looks fine and works here.
> 
> It works now after i added
> 
> writeln("Content-Type: text/plain;charset=us-ascii\n\n");
> 
> I didn't know this is required, i have never used CGI before. I copied c example from some cgi tutorial and forgot to include that line in the D program. I'm sorry for wasting your time.

And I guess this should really be writeln("Content-Type: text/plain;charset=utf-8\n\n") for D.
June 06, 2010
Michal Minich wrote:
> On Sun, 06 Jun 2010 09:00:25 -0400, new to d wrote:
> 
>> import std.stdio;
>>
>> void main(string[] args)
>> {
>> 	writeln("Hello world!");
>> }
> 
> Just a guess, but maybe the difference of your C and D programs is in return value, which can be differently interpreted by CGI host. try returning 1 or 0 from the program.

It should be ok. If there is no return statement, a D program returns 0 for successful exit, and non-zero for error.

This point has been stressed in Andrei Alexandrescu's "The Case for D" article when comparing the "hello world" programs of some languages.

Ali
June 06, 2010
On Sun, 06 Jun 2010 08:42:22 -0400, new to d wrote:

> new to d Wrote:
> 
>> After reading on this newsgroup about the use of D with cgi i've tried it on my host. Even a simple hello world program gives me internal server error while equivalent c program compiled with gcc works fine. Does any one here have any idea what the problem could be?
> 
> I forgot the subject in my previous post, sorry.

I would start by reading the output in your Web server's error_log. Internal Server Error just means 'something went wrong' -- the details are in your error log.

Graham