bug-apl
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Bug-apl] How do you handle the contents of POST in a CGI script


From: Kacper Gutowski
Subject: Re: [Bug-apl] How do you handle the contents of POST in a CGI script
Date: Sat, 10 Oct 2015 07:50:27 +0200

On Sat, Oct 10, 2015 at 3:29 AM,  <address@hidden> wrote:
> I am struggling to follow our previous conversation. Pretty much, I am
> confused about the source of the POST contents. I believe you mentioned that
> it should come from stdin, and if I understood, it is not possible to use it
> jointly with CGI scripting:

I don't think you will be able to make use of it as real CGI; but to
read from stdin, you can use either ⍞ or FILE_IO functions.  Both seem
to work fine for me when used in a separate script file rather than in
interactive session.

Some of your options are thus:
ContentsOfPOST←⍞            ⍝ get single line of parsed character input
ContentsOfPOST←FIO∆fgets 0  ⍝ get single line of raw bytes

(Note: descriptor of stdin is zero.)

Or something like:
ContentsOfPOST←{⍵, FIO∆fread 0}⍣{⍺⊢FIO∆feof 0}''

to read up everything from stdin in one go (it might add unnecessary 0
at the end if length of input data is a multiple of fread's block size).

As a side note, you probably want to add -s at the end of your #! line.

-k



reply via email to

[Prev in Thread] Current Thread [Next in Thread]