Downloads from URL url_string and stores the returned data in the file local_name. Includes console feedback.
Example:
# Example for download
println download("https://example.com") # saved file name
Converts HTML special characters to ampersand values.
Example:
# Example for html_escape
println html_escape("<b>hi</b>") # "<b>hi</b>"
Converts a string containing ampersand values to include HTML special characters.
Example:
# Example for html_unescape
println html_unescape("<div>") # <div>
newline separated list of device names.
Example:
# Example for net_interfaces println net_interfaces()
Set the number of requests between cache cleanups.
Enable or disable web caching globally.
Set the maximum age of cached entries in seconds.
Set the maximum memory usage for cache in MB.
Set the maximum number of cached entries.
Manually purge all cached entries.
Return cache statistics: size, hits, misses, memory usage.
Returns a string with content downloaded from loc_string.
Example:
# Example for web_custom
println web_custom("GET","https://example.com") # response content
Show configured request routing.
Downloads from URL url_string and stores the returned data in the file local_file.
Example:
# Example for web_download
println web_download("https://example.com","/tmp/example")
Returns a structure with content downloaded from loc_string. .result is the content string. .code is the status code.
Example:
# Example for web_get
println web_get("https://example.com").result
Enable or disable gzip compression for responses.
Makes a HEAD request of the given loc_string. Returns true if retrieved successfully.
Example:
# Example for web_head
println web_head("https://example.com") # true
(read-only) returns the maximum permitted client count for a web server.
Example:
# Example for web_max_clients println web_max_clients() # e.g., 100
Perform a HTTP POST.
Example:
# Example for web_post
println web_post("https://example.com",["key","val"])
Send HTTP request with custom method, headers, and raw body. Returns [body, headers, status_code].
Returns a struct representing details of an inbound web request.
[#SOL]web_serve_decode() returns the following member fields:
[#SOL] .host (host:port), .method, .path, .remote (remote_ip:port) and .data (POST data).
Example:
# Example for web_serve_decode
var w={"host":"localhost:80","path":"/","data":"hi"}
println web_serve_decode(w) # struct fields
Write arguments to the web log file, if available.
Example:
# Example for web_serve_log
web_serve_log("entry")
Set the throttle controls for web server logging.
Example:
# Example for web_serve_log_throttle web_serve_log_throttle(10,20)
Provides a traffic routing instruction to a web server.
Example:
# Example for web_serve_path
id=web_serve_start(".",8080)
web_serve_path(id,"s","/old","/new")
Returns an identifier for a new http server.
Example:
# Example for web_serve_start
println web_serve_start("/var/www",8080)
Stops and discards a running http server.
Example:
# Example for web_serve_stop
id=web_serve_start(".",8080)
web_serve_stop(id)
Checks if a web server is still running.
Example:
# Example for web_serve_up println web_serve_up(server_handle) # true/false