[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: CGI Error
Xiangrong Fang schrieb:
>
> Hi,
^^^^ Hi,
>
> I tried to write a simple cgi program under Pi3, but there's something
> wrong, please help me.
>
> I use Turbo Pascal 7 to write this program (also tried to write a batch
> file under 4dos, same result, it seems not a problem of pascal :-), it
> worked and saved POST data in to a file CGI_TEST.TXT, but it does not
> return, the client can't see the program output and will wait forever.
> The following is source code:
>
> program cgi_test;
> uses dos;
> type
> oar=array [1..65000] of char;
> var
> f,g:file of char;
> buf:pointer;
> size,code,i:word;
> begin
> val(getenv('CONTENT_LENGTH'),size,code);
> getmem(buf,size);
> assign(f,'');
> reset(f);
> assign(g,'CGI_TEST.TXT');
> rewrite(g);
> for i:=1 to size do
> begin
> read(f,oar(buf^)[i]);
> write(g,oar(buf^)[i]);
> end;
> close(f);
> close(g);
> writeln('Content-Type: text/html');
> writeln;
> write('<HTML><BODY>');
> write('<H1>Thank you for using CGI_TEST<BR>');
> write('Your information was send to the webmaster</H1>');
> writeln('</BODY></HTML>');
> halt(0);
> end.
^^^^
I think that 16 bit DOS/Windows code can't be used from Pi3's CGI handler.
I suppose (but hasn't a look at the related parts of the source code) that
WIN32 process/thread mechanisms are used to launch CGI applications and to
wait for them.
Your code works principal - tried it with TP 6.0. I did also build a Delphi
3 binary from it (made some minor modifications to use environment funcions
of the Win32 API) and it works too - now also from the server.
Look for a 32 Bit Windows Compiler.
>
> Tks.
> Xiangrong Fang
--
with regards
Holger
---------------------------------------------------------
Holger 'Zimpel' Zimmermann Contact me:
---------------------------------------------------------
Wendishain tel./fax company: on demand
Germany tel./fax private: on demand
---------------------------------------------------------
homepage: http://home.t-online.de/home/zimpel@t-online.de
web server: surf to it from my homepage (online every
Sunday 20:00-24:00 GMT, start 1. Jule 1998)
e-Mail: zimpel@t-online.de
--------------------------------------------------------
- References:
- CGI Error
- From: Xiangrong Fang <xrfang@usa.net>