d5 / tengo

A fast script language for Go
https://tengolang.com
MIT License
3.52k stars 304 forks source link

HTTP module #107

Open d5 opened 5 years ago

d5 commented 5 years ago

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.

Ma124 commented 5 years ago

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.

diyism commented 3 years ago

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.

NAICOLAS commented 2 years ago

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

luisdavim commented 8 months ago

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

diyism commented 8 months ago

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