tengo icon indicating copy to clipboard operation
tengo copied to clipboard

HTTP module

Open d5 opened this issue 6 years ago • 5 comments

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.

d5 avatar Feb 21 '19 05:02 d5

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

Ma124 avatar Aug 01 '19 22:08 Ma124

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.

diyism avatar Dec 10 '20 11:12 diyism

@ganehag Mind sharing your implementation of the HTTP module? :)

NAICOLAS avatar Apr 15 '22 17:04 NAICOLAS

It would be nice to have something like this in the standard library https://github.com/damiva/TengoHTTP

luisdavim avatar Dec 16 '23 18:12 luisdavim

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

diyism avatar Dec 16 '23 22:12 diyism