Tiny Core Linux

General TC => Programming & Scripting - Unofficial => Topic started by: mocore on April 20, 2019, 12:42:07 PM

Title: socat httpd server
Post by: mocore on April 20, 2019, 12:42:07 PM
the dasht project : https://github.com/sunaku/dasht - "Search API docs offline, in terminal or browser https://sunaku.github.io/dasht/man"

has an interesting server using socat and /bin/sh 

https://github.com/sunaku/dasht/blob/master/bin/dasht-server

https://github.com/sunaku/dasht/blob/master/bin/dasht-server-http

a lot of other examples of similar sort of thing can be found on tha interwebz

eg another using socat and bash : https://gist.github.com/mbbx6spp/0ba0406afe65db556eef - "ZOMG a bash powers HTTP web service that runs via the `socat` web app container"  :)

i search the forum and was surprised that
this minimal server method did not appear to be mentioned !  :o
and so now it has .



Title: Re: socat httpd server
Post by: mocore on April 21, 2019, 06:08:10 AM
Many possibility's exists for potential uses for this simple script server exist

Caching Server Scenario - http://forum.tinycorelinux.net/index.php/topic,4677.msg138694.html#msg138694

i just happened to find the one above while browsing the forum

its my intention to return to this thread at some point and post a simple example of how the above script/setup can be used/modified

but for now , in case it's not obvious it is requited to
Code: [Select]
tce-load -i socat
to run the scripts !!


another good/simple example use could be to create a fav-icon server

Title: Re: socat httpd server
Post by: mocore on August 09, 2019, 11:25:44 AM
a few more interesting examples

https://gitlab.com/girror-git-mirror/svr/shellscripthttpd - HTTPD written entirely in shell (works with Busybox)

and this one that requires bash

https://github.com/TooTallNate/bashttpd

 which makes some interesting changes from its original fork

 https://github.com/TooTallNate/bashttpd/commit/e46ca8994eba703a2ffb853c39599f0e5c0ef9b0 #Simplify things by using pipes instead of fds

 https://github.com/TooTallNate/bashttpd/commit/1b79633adf7809dc2244c1c325bdea475cbb8dd4#Make stdin be the HTTP request body

 * see also : http://forum.tinycorelinux.net/index.php/topic,22762.0.html# more shell !!
;D

(imho) it might be an interesting experiment to condense the functional style "pipes/stdin/stdout" ect  of the ba shttpd and rework it to work with sh

like dasht or shellscripthttpd 


could be ideal to create/host  a local index.html of extensions
as  was requested in http://forum.tinycorelinux.net/index.php/topic,22843.msg143165.html#msg143165# could we have a web-site index.html of extensions for tc10 64 and 32 bits?