Re: Static file server with Ersatz

2015-03-16 Thread Joe Bogner
Christophe, I wrote up an article a few years ago about creating a web app
with ersatz and picoLisp:

http://picolisp.com/wiki/?ersatzwebapp

One of the subtle points of the article is that you need to modify the
ersatz sources to remove the Static initialization of variables, otherwise
it won't be thread safe.



On Mon, Mar 16, 2015 at 3:51 AM, Christophe Gragnic 
christophegrag...@gmail.com wrote:

 Hi list,
 I'm investigating a way to be able to fire up a static file server
 like in Python:

 python -m http.server 8000

 but with Ersatz. Has it been done ? If not, would it involve:
 1) the use of the -server function in http.l
 2) grab the path of the requested file
 3) read the file and send it to the client
 4) write a little file explorer when requesting a directory
 ?

 BTW, wouldn't it be more correct to say
 «Then the -server function is called»
 than
 «Then the server function is called»
 near the end of this section:
 http://software-lab.de/doc/app.html#server


 Thanks.

 --

 http://profgra.org/lycee/ (site pro)
 http://delicious.com/profgraorg (liens, favoris)
 https://twitter.com/profgraorg
 http://microalg.info
 --
 UNSUBSCRIBE: mailto:picolisp@software-lab.de?subjectUnsubscribe



An HTTP(S) client library for PicoLisp

2015-03-16 Thread Alexander Williams
Hi everyone,

Presenting another thing, this time it's an HTTPS library using a native C
lib for the hard stuff.

It includes functions for http/https GET/HEAD/POST/PUT/DELETE/*ANYTHING*,
and can perform authentication.

It returns the response body in a cons pair, or save to file, and returns
headers in a list of cons pairs.

Of course, I've documented most of the functionality here:

  https://github.com/aw/picolisp-https/blob/master/EXPLAIN.md

And you can get the code here:

https://github.com/aw/picolisp-https

Let me know if I missed something, as I haven't fully tested every scenario
(this was slightly more complex).

Thanks!


Re: An HTTP(S) client library for PicoLisp

2015-03-16 Thread Alexander Burger
On Mon, Mar 16, 2015 at 01:38:10PM -0400, Rick Hanson wrote:
 Great stuff.  Clean code and clear doc.  But I've already told AW this on
 IRC.  For others: I highly recommend!

I chime in! :)
-- 
UNSUBSCRIBE: mailto:picolisp@software-lab.de?subject=Unsubscribe


Re: Static file server with Ersatz

2015-03-16 Thread Christophe Gragnic
Hi Alex, hi Joe.

On Mon, Mar 16, 2015 at 9:41 AM, Alexander Burger a...@software-lab.de wrote:
 Hi Christophe,

 but with Ersatz. Has it been done ? If not, would it involve:
 1) the use of the -server function in http.l

 I haven't thought about this in depth. 'server' might be ported to
 Ersatz perhaps, by omitting the (fork) stuff.

Mmf. I'll try to try something.

 2) grab the path of the requested file
 3) read the file and send it to the client
 4) write a little file explorer when requesting a directory

 I think this can all be done, by porting parts of the 'http' function.

OK. Thanks for encouraging me !

On Mon, Mar 16, 2015 at 1:21 PM, Joe Bogner joebog...@gmail.com wrote:
 Christophe, I wrote up an article a few years ago about creating a web app
 with ersatz and picoLisp:

 http://picolisp.com/wiki/?ersatzwebapp

I read this page which ranked quite high in my searches, but couldn't
find enough info.

 One of the subtle points of the article is that you need to modify the
 ersatz sources to remove the Static initialization of variables, otherwise
 it won't be thread safe.

Subtle indeed. Isn't it something suitable for Ersatz upstream ?


chri

-- 

http://profgra.org/lycee/ (site pro)
http://delicious.com/profgraorg (liens, favoris)
https://twitter.com/profgraorg
http://microalg.info
-- 
UNSUBSCRIBE: mailto:picolisp@software-lab.de?subject=Unsubscribe


Re: An HTTP(S) client library for PicoLisp

2015-03-16 Thread Rick Hanson
Great stuff.  Clean code and clear doc.  But I've already told AW this on
IRC.  For others: I highly recommend!

On Mon, Mar 16, 2015 at 11:46 AM, Alexander Williams a...@unscramble.co.jp
wrote:

 Hi everyone,

 Presenting another thing, this time it's an HTTPS library using a native C
 lib for the hard stuff.

 It includes functions for http/https GET/HEAD/POST/PUT/DELETE/*ANYTHING*,
 and can perform authentication.

 It returns the response body in a cons pair, or save to file, and returns
 headers in a list of cons pairs.

 Of course, I've documented most of the functionality here:

   https://github.com/aw/picolisp-https/blob/master/EXPLAIN.md

 And you can get the code here:

 https://github.com/aw/picolisp-https

 Let me know if I missed something, as I haven't fully tested every
 scenario (this was slightly more complex).

 Thanks!



Static file server with Ersatz

2015-03-16 Thread Christophe Gragnic
Hi list,
I'm investigating a way to be able to fire up a static file server
like in Python:

python -m http.server 8000

but with Ersatz. Has it been done ? If not, would it involve:
1) the use of the -server function in http.l
2) grab the path of the requested file
3) read the file and send it to the client
4) write a little file explorer when requesting a directory
?

BTW, wouldn't it be more correct to say
«Then the -server function is called»
than
«Then the server function is called»
near the end of this section:
http://software-lab.de/doc/app.html#server


Thanks.

-- 

http://profgra.org/lycee/ (site pro)
http://delicious.com/profgraorg (liens, favoris)
https://twitter.com/profgraorg
http://microalg.info
--
UNSUBSCRIBE: mailto:picolisp@software-lab.de?subject=Unsubscribe


Re: Static file server with Ersatz

2015-03-16 Thread Alexander Burger
Hi Christophe,

 but with Ersatz. Has it been done ? If not, would it involve:
 1) the use of the -server function in http.l

I haven't thought about this in depth. 'server' might be ported to
Ersatz perhaps, by omitting the (fork) stuff.

 2) grab the path of the requested file
 3) read the file and send it to the client
 4) write a little file explorer when requesting a directory

I think this can all be done, by porting parts of the 'http' function.


 BTW, wouldn't it be more correct to say
 «Then the -server function is called»
 than
 «Then the server function is called»
 near the end of this section:
 http://software-lab.de/doc/app.html#server

Yes, that's true, though the final effect is the same. First '-server'
is called, which in turn calls 'server'. I have fixed it in app.html.
Thanks!

♪♫ Alex
-- 
UNSUBSCRIBE: mailto:picolisp@software-lab.de?subject=Unsubscribe