Re: Aku, Your ambilPost() Function

new topic     » goto parent     » topic index » view thread      » older message » newer message

CKL> Aku!!! Why did you do this to me?

CKL> In your ambilPost() function you've got this code:

CKL> if atom(lenq) or length(lenq) < 1 then
CKL>     qs = no10(gets(0)) --<-- look here
CKL> else
CKL>     qs = get_bytes(0,val(lenq))
CKL> end if

CKL> Why do you wait for a keystroke (ENTER) here when it's supposed to be
CKL> processing a web page?!?! :)

CKL> Anyway, you might want to change that.

I think it doesn't have to be a keystroke, but a '\n'.
But actually this is the flow:

global procedure ambilPost()

    -- get the length of the input, will be set by HTTP server
    lenq = getenv("CONTENT_LENGTH")

    -- if the CONTENT_LENGTH is not set,
    if atom(lenq) or length(lenq) < 1 then
        qs = no10(gets(0))
        
    -- but in normal case, this code will be executed.
    else
        qs = get_bytes(0, val(lenq))
    end if
    
    parse()
end procedure

I made this so that you can use the cgi program in 2 methods:

1. The normal method: the script is executed by the HTTP server,
   it will set the CONTENT_LENGTH variable and feed the input via the
   stdin (fn = 0).

2. Manual method: you execute the script yourself (exu ./script.exu)
   so the CONTENT_LENGTH variable is not set, and you type the
   parameters yourself, followed by an Enter key (hence the gets(0)).
   - For example:
     [user at domain]$ exu ./script.exu
     name=me&age=12<press enter here>
     
     so the variable qs (see above) will contain "name=me&age=12"


Sorry for not stating this.

new topic     » goto parent     » topic index » view thread      » older message » newer message

Search



Quick Links

User menu

Not signed in.

Misc Menu