On Wednesday, 31 July 2019 at 05:56:46 UTC, BoQsc wrote:
what causes the Internal Server Error.

Internal Server Error might as well appear when D language syntax is not correct.

Considering this: this example has Internal Server Error, since writeln argument and argument content cannot contain the same type quotes: Internal Server Error
#!/usr/bin/env rdmd
import std.stdio;
void main()
{
   writeln("Content-type: text/html");
   writeln("");
writeln("<body style="background: green">CGI D Example</body>");

}

This can be solved by using single quotes in the argument content places
#!/usr/bin/env rdmd
import std.stdio;
void main()
{
   writeln("Content-type: text/html");
   writeln("");
writeln("<body style='background: green'>CGI D Example</body>");

}


Or even escaping argument content quotes:
#!/usr/bin/env rdmd
import std.stdio;
void main()
{
   writeln("Content-type: text/html");
   writeln("");
writeln("<body style=\"background: green\">CGI D Example</body>");

}

That is good to know.

Reply via email to