Okay ... I think I can see how I can use web.l .... One problem I am facing
is to figure out how to read from *ContLen bytes from the input. What's a
good way to read *ContLen bytes from the input? Using (char) in a loop does
not seem right since it reads characters off the stream.

Regards,
Kashyap

On Sat, May 18, 2019 at 9:55 AM C K Kashyap <ckkash...@gmail.com> wrote:

> Thanks Alex,
> Although, I need a way to get raw access to the body (it happens to be
> json payload). I do not have control of the client code :(
> Regards,
> Kashyap
>
>
> On Sat, May 18, 2019 at 9:53 AM Alexander Burger <a...@software-lab.de>
> wrote:
>
>> Hi Kashyap,
>>
>> > I need a sample to handle HTTP post. All I need to do is listen for HTTP
>> > post request, read the payload in the body and respond.
>>
>> Perhaps web.l is more general and flexible, but as I said I haven't
>> studied it.
>> With the on-board server you could start this script:
>>
>>    (load "@lib/http.l")
>>
>>    (allowed ()
>>       "!work" *Var1 var2 )
>>
>>    (de work ()
>>       (msg *Var1 " *Var1")
>>       (msg (get 'var2 'http) " var2")
>>       (respond) )
>>
>>    (server 8080 "!work")
>>
>> It waits for HTTP requests. Now do in another terinal:
>>
>>    $ curl -F "*Var1=val1" -F "var2=val2" http://localhost:8080
>>
>> The first terminal echoes:
>>
>>    "val1" *Var1
>>    "val2" var2
>>
>> ☺/ A!ex
>>
>> --
>> UNSUBSCRIBE: mailto:picolisp@software-lab.de?subject=Unsubscribe
>>
>

Reply via email to