Mail Archives: djgpp/1999/10/12/07:11:14
I was aware that the Windows environment (16 or 32-bit) does not do IPC with MS-
DOS programs (which either points to MS-DOS' major weaknesses in trying to
emulate Unix or to making bad assumptions about the potential of a single-user
single-task system). The original poster did not actually say what development
system he was using: I had assumed he was using a system that developed Win32
programs like RSXNTDJ rather than making a 32-bit DOS program.
On systems I work with the client (browser) would just wait and wait and
possibly timeout with a confusing message when the server is requested to run a
CGI app, and then the server itself waits for something that will never come.
I don't think I have ever seen a client or server report something like the
proper headers didn't come.
> "S. M. Halloran" wrote:
> >
> > >
> > > Been using djgpp for a little while now on windows nt.
> > > Today I decided to try to write a CGI application to use via
> > > Windows NT's Peer web service's web server. The code ( fairly
> > > simplistic, included below ). I get an error when I try to run
> > > it, claiming that the application didn't return the proper http
> > > headers, it then includes nothing as the error.
> > > I compiled the same code under Visual C++ on my work PC, and
> > > it runs fine... what gives ?
> > >
> > > I couldn't find any references to CGI or problems related to it
> > > in the DJGPP FAQ.
> > >
> > > TIA !
> > >
> > >
> > > - Bub
> > >
> > > /*----------- foo.c --------------------
> > > cgi app that prints blah blah in red
> > > */
> > >
> > > #include <stdio.h>
> > >
> > > int
> > > main(int argc, char **argv)
> > > {
> > > fprintf(stdout,"Content-Type: text/html\n\n");
> > ^^^^^
> > Try this: "Content-Type: text/html\r\n\r\n"
> > Read the RFCs on HTTP 1.0 and 1.1 so that you understand why.
> >
> > You should also be aware of your server's capabilities. The server must lead
> > the response to the client with a 3-digit code and an optional message,
> > followed by valid HTTP headers, and then the message body. If your CGI app is
> > expected to supply all headers and the server merely transfers the output, you
> > may have to supply an entire response that conforms with HTTP. If so, then
> > know the spec.
> >
> > The Visual C++ compiler may be translating the '\n' as '\r\n' for you. Try
> > this: instead of stdout, save to a file the DJGPP- and Visual C++ output and
> > look at it with a binary editor (such as MS-DOS Edit with the 'open binary'
> > checked).
> The main problem is that most of Windows HTTP-servers could not execute
> DOS-based CGIs. DJGPP is not an environment that can be used for CGI
> programming under Windows. Use CygWin instead.
> --
> Sincerely yours,
> Alexander Bokovoy
> <!-- 2:450/144.58 --- bokovoyATminsk.lug.net --- FractalsAtTheEdge -->
Mitch Halloran
Research (Bio)chemist
Duzen Laboratories Group
Ankara TURKEY
- Raw text -