• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 230
  • Last Modified:

class for WIN-CGI

I have develop a class for Win-CGI but I cannot seem to be able to return the my response to client. Each time I run my program it seems to work but I get the following message in my browser window.

CGI Error
The specified CGI application misbehaved by not returning a complete set of HTTP headers. The headers it did return are:

I use the IIS 4.0 web server.
0
malaland
Asked:
malaland
  • 3
  • 2
1 Solution
 
d003303Commented:
In the CGI interface, you have to build the HTML header by yourself. The design of a HTTP response header is defined in RFC 2068, section 6.2 (ftp://ftp.leo.org/pub/comp/doc/standards/rfc/rfc-2000-2099/rfc2068). Briefly, a HTTP response header can look like:
(only the text between the lines count, CR+LF and blanks are important !)
----------------------------------
HTTP/1.0 200 OK
Server: MyPrivateServer
Content-length: 123
Content-type: text/html


----------------------------------
The header ends with 2 CR+LF, then comes the content. Note that the Content-length value should set appropriate.

Slash/d003303
0
 
d003303Commented:
I forgot, everything in the header is case sensitive.
0
 
malalandAuthor Commented:
No good, My server hangs with these lines.
0
What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

 
itamarCommented:
Hi (again) malaland,

could you send a piece of code, at least the response part of the program.

Just a guess:

    WriteLn('Content-type: text/html');
    WriteLn;
    WriteLn('<HTML>');
    WriteLn('<HEAD>');
    WriteLn('<TITLE>Hello !</TITLE>');
    WriteLn('</HEAD>');
    WriteLn('<BODY>');

Something like that should work.

Bye,
Itamar
0
 
d003303Commented:
Leave our the line with the "Server:" and "HTTP/1.0" Keywords. It seems that your server is providing these additional header. So, like itamars example, it should read

var MyHTML : string;
begin
  MyHTML := '<HTML><HEAD><TITLE>Hello !</TITLE></HEAD>';
  MyHTML := MyHTML + '<BODY>Hello World</BODY></HTML>';

  WriteLn(Format('Content-length: %d', [Length(MyHTML)]));
  WriteLn('Content-type: text/html');
  WriteLn;
  Write(MyHTML);
end;

Slash/d003303
0
 
malalandAuthor Commented:
I found a way. Unfortunately it did not have anything to do with what you told me.
0

Featured Post

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

  • 3
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now