Re: A quick way to write an http endpoint to handle post body

2019-05-18 Thread C K Kashyap
Super! ... almost what I was looking for I mean one minor fix is that I have to call a (line) after (read) to read up the newline after the content length. Also, I need to figure out how to capture the body do I do a pipe? Regards, Kashyap On Sat, May 18, 2019 at 11:53 AM Alexander

Re: A quick way to write an http endpoint to handle post body

2019-05-18 Thread Alexander Burger
On Sat, May 18, 2019 at 08:11:20PM +0200, Alexander Burger wrote: > You can easily write a stand-alone server without any library: > ... Hmm, this was too short. I haven't tested, but at least we should respond something. Perhaps this is a better starting point: (setq *Port (port 8080))

Re: A quick way to write an http endpoint to handle post body

2019-05-18 Thread C K Kashyap
Okay .. this works for me - (setq *Port (port 3000)) (de process (Input) (if Input Input "Empty")) (loop (setq *Sock (listen *Port)) (unless (fork) (close *Port) (let Body (pipe (in *Sock (when (= "POST" (read)) (when (from "Content-Length: ") (let Len (read)

Re: A quick way to write an http endpoint to handle post body

2019-05-18 Thread Alexander Burger
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

Re: A quick way to write an http endpoint to handle post body

2019-05-18 Thread C K Kashyap
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 wrote: > Hi Kashyap, > > > I need a sample to handle HTTP post. All I need to do is

Subscribe

2019-05-18 Thread shshoshin
Sent from ProtonMail mobile

Re: A quick way to write an http endpoint to handle post body

2019-05-18 Thread Alexander Burger
On Sat, May 18, 2019 at 10:18:42AM -0700, C K Kashyap wrote: > 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

Re: A quick way to write an http endpoint to handle post body

2019-05-18 Thread C K Kashyap
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,

A quick way to write an http endpoint to handle post body

2019-05-18 Thread C K Kashyap
Hi Alex et al, 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. Before you get tempted to say a variation of RTFM - let me say that I promise to share an interesting demo once I have that :) Regards, Kashyap

Re: A quick way to write an http endpoint to handle post body

2019-05-18 Thread Alexander Burger
On Sat, May 18, 2019 at 04:39:07PM -0700, C K Kashyap wrote: > Okay .. this works for me - Great :) Yes, a pipe seems the best way here, especially if you can put the main work into it to distribute the CPU load. ☺/ A!ex -- UNSUBSCRIBE: mailto:picolisp@software-lab.de?subject=Unsubscribe

Re: Strange database behavior

2019-05-18 Thread Alexander Burger
Hi Grant, welcome here :) > My name is Grant and I'm just getting started with picolisp. I'm trying an > exercise to model user-groups and memberships with the Entity/Relation > database. > I must be misunderstanding something, or doing something strange because I > can't seem to