tengo
tengo copied to clipboard
HTTP module
More specifically, HTTP client-side stuffs are more useful at this point.
One challenge here is to have some security/diagnostic measures implemented, because one would want to control/limit the outbound network accesses from arbitrary user script.
I've created gitlab.com/Ma_124/httpbox
a library that sandboxes outbound requests according to a Policy, a function or anything else that implements
a simple interface using a custom http.RoundTripper.
I could create a pull request where a user can set a Policy and every request from the stdlib module would need to pass it.
- How do you like that idea?
- Any improvement ideas?
- And how could one specify the policy? I thought about something like
-
func HttpModule(p httpbox.RequestPolicy) map[string]objects.Object
- or
scr.HttpPolicy = p
-
Indeed, an HTTP client is the first need for developer, while an HTTP server is the second need.
For example there is algernon web server(https://github.com/xyproto/algernon), its script language is gopher-lua. Since tengo is faster than gopher-lua, and tengo language/syntax is similar to go, if there's a Web server that can support tengo script language, it will be very attractive.
@ganehag Mind sharing your implementation of the HTTP module? :)
It would be nice to have something like this in the standard library https://github.com/damiva/TengoHTTP
It would be nice to have something like this in the standard library https://github.com/damiva/TengoHTTP
@luisdavim , thanks for your wonderful sharing of a simple web server that supports tengo script, so that we can use it as easy as the Mako server(lua script, https://realtimelogic.com/ba/doc/en/Mako.html) in personal project.
Nowadays, my strongest wish is a caddy module that supports tengo,in my mind, it should be the best combination of the best golang server(caddy) and the best golang script(tengo): https://github.com/caddyserver/caddy/issues/4255