Help with reading STDIN when clipper is called via CGI 
Author Message
 Help with reading STDIN when clipper is called via CGI

Using the following code

I get the following result.
nRead == 0 and FERROR() = 5 (Which is, I believe, access denied)

Using the following code
nHandle := FOPEN( aSystem[ CONTENT_FILE ], FO_READWRITE + FO_SHARED)

I get the following results. nRead == 0 and FERROR() = 6 (Which is, I
believe, invalid handle, understandable).
The variable aSystem[ CONTENT_FILE ] == somefile.INP. This is the file
containing the form data sent by the html page.

If this is the incorrect use, how do I read STDIN when programming for
CGI.
Thank you for the help.
--
the WEB Solutions, P.O.Box 43,Caversham Glen,3616, South Africa
Tel: +27 (031) 7008628, Fax: +27 (031) 7001979



Fri, 07 Apr 2000 03:00:00 GMT  
 Help with reading STDIN when clipper is called via CGI

Quote:

> Using the following code


What exactly is 'STDIN'? Variable? Manifest constant? What value does it
result in? If you want to read stdin you probably want to be reading handle
0. Here is the code of a function I've used for reading CGI input that
handles the GET and POST methods:

----------------------------------------------------------------------
Function cgiGetInput()
Local cInput := ""

   If cgiMethod() == "GET"
      cInput := getenv( "QUERY_STRING" )
   ElseIf cgiMethod() == "POST"
      If len( cInput := space( val( getenv( "CONTENT_LENGTH" ) ) ) ) > 0

      EndIf
   EndIf

Return( cInput )
----------------------------------------------------------------------

The function cgiMethod() is simply:

----------------------------------------------------------------------
Function cgiMethod()
Return( upper( getenv( "REQUEST_METHOD" ) ) )
----------------------------------------------------------------------

HTH

--
Take a look in Hagbard's World: |     w3ng - The WWW Norton Guide reader.
http://www.acemake.com/hagbard/ |  ng2html - The NG to HTML converter.
http://www.hagbard.demon.co.uk/ |       eg - Norton Guide reader for Linux.
Free software, including........|   dgscan - DGROUP scanner for Clipper.



Fri, 07 Apr 2000 03:00:00 GMT  
 Help with reading STDIN when clipper is called via CGI



Quote:
>Using the following code

>I get the following result.
>nRead == 0 and FERROR() = 5 (Which is, I believe, access denied)

STDIN is handle # 0, it needs to be opened as read-only.

Also, since it't a character device, I believe you'll need to read 1
char at a time until it comes back empty, although I haven't tested
this.

Terry

--------------------

Terry Carmen
Meadowbrook Software

NOTE TO SPAMMERS:
BAD THINGS will happen to any site that sends me email spam.



Fri, 07 Apr 2000 03:00:00 GMT  
 
 [ 3 post ] 

 Relevant Pages 

1. Library to Allow 16-bit Clipper apps CGI, stdin-stdout

2. Reading STDIN in Clipper 5.2

3. Window NT: need to allow client to make system call via CGI script

4. sys.stdin.read() HELP!

5. read .zip files via fortran calls

6. program and data via stdin

7. read next after reading record via another key

8. Clarion/Dos STDIN functions for CGI?

9. cgi.parse from stdin problem

10. Stdin problems in cgi

11. cgi-bin read/print inefficiency - help?

12. CGI calling CGI (...again!)

 

 
Powered by phpBB® Forum Software