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
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))
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)
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
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
Sent from ProtonMail mobile
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
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,
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
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
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
11 matches
Mail list logo