Ioto 1.4.0 Update

I’m pleased to announce the release of Ioto 1.4.0.
This release provides some important developer usability tools that make tracing web server HTTP requests simpler and clearer.
We’ve also continuted to extend our suite of unit and service tests and this has resulted in a solid set of minor bug fixes.
All users of previous Ioto versions 1.X are encouraged to update to the new version.
Major Changes
The most significant changes in this release are:
- A new client HTTP test program called “url”.
- New HTTP request/response tracing for web server and URL client.
- Improved control for web server redirections.
HTTP Client Test Program
This release includes an HTTP client test program called “url”. This is a developer aid to issue test requests and simulate load tests on the Ioto web server. While there are many other HTTP clients available, the URL program has a very terse syntax suitable for daily test needs. It also demonstrates how to elegantly use the URL API in your programs.
The url command makes it easy to issue test HTTP requests via a smart command line:
url [options] [Method] url [items, ...]
For example:
url /
url /index.html
url POST /test/show name=louise
url POST /test/show '{name:"louise"}'
url PUT /upload @file
url POST /switch op=on 'X-Auth=1828442'
In most cases, you can abbreviate the URL to just the non-default components you require.
You can also perform load tests. For example:
url --benchmark --clients 16 --count 10000 /test
This will issue 10,000 requests to the /test with up to 16 simultaneous clients.
See the documentation at: https://www.embedthis.com/ioto/doc/man/url.html
Web Redirects
The Ioto embedded web server can be configured to redirect requests to preferred destinations and protocols.
The Ioto config/web.json5 configuration file defines URL redirections from one URL to a new URL via the redirect collection. For example:
redirect: [
{ status: 302, from: "http", to: "http" },
{ status: 302, from: "example.com", to: "new-example.com" },
{ status: 302, from: "http://example.com:8080", to: "https://new-example.com" },
{ status: 302, from: "http://example.com", to: "https://new-example.com" },
{ status: 302, from: ":443", to: "https://:4443" },
{ status: 301, from: "/old", to: "/new.html" },
],
This release enhances the redirection matching algorithm using the “from” URL components to match the current request to the appropriate redirection.
If the “from” URL component matches, the “to” property is used to define additional or overriding URL components that are blended with the current request and the client is redirected to this new request URL.
Each redirection defines a matching pattern. If the from argument matches the current request, then that redirection definition is applied.
The “from” property defines a URL portion that must match for the redirect. You only need to specify the URL portion that you wish to use as a matching pattern. If the “from” property is omitted, it will match all URLs.
The “from” and “to” URLs are of the form:
[http|https][://][hostname][:port][/path][?query][#hash]
Any of the URL components may be present or absent. For example, if only a path is supplied for the “to” property, then the client will be redirected to the new path on the current site.
The “to” URL defines a URL portion that will be combined with the existing URL. The to URL may be local to the system, in which case it will begin with a ”/” character, or it may be on another system, in which case it will begin with “http://” or “https://”. In both cases, the user will receive a HTTP redirection response informing them of the new location of the document.
The status argument may be either 301 for a permanent redirect or 302 for a temporary redirect. The default is 302.
Web Server HTTP Tracing
This Ioto release adds special control for tracing web server HTTP requests and responses.tracing. You can selectively trace HTTP request and response headers and bodies via the show property in the ioto.json5 configuration file.
log: {
show: 'hH',
path: 'ioto.log',
format: '%D %H %A[%P] %T %S %M',
types: 'error,info',
sources: 'all',
},
Setting “show” to “hH” will trace the request headers and response headers.
The “show"" property is a string set comprised of the following characters:
| Character | Description |
|---|---|
| b | Show the response body |
| h | Show the response HTTP headers |
| B | Show the client request HTTP body |
| H | Show the client request HTTP headers |
| empty | Show no HTTP trace |
You can override the ioto.json5 show property configuration via the —show Ioto command line option.
For example:
ioto --show hH
You can also override the tracing configuration via the WEB_SHOW environment variable.
Command Line Options | Environment Variable | Description
- | - | - —show | WEB_SHOW | Override the show definition
The order of precedence of configuration is:
- Command line —show option value
- Environment variable LOG_FILTER, LOG_FORMAT values
- ioto.json5 configuration
In other words, the command line will override all other settings.
HTTP Client Tracing
Similar to the web server HTTP tracing, you can trace client HTTP requests and responses. Tracing HTTP client requests can be enabled via the “URL_SHOW” environment variable.
For example:
URL_SHOW=hH ioto --trace trace.log
Additional Ioto Environment Variables
You can override the Ioto trace log configuration via two environment varables: LOG_FILTER and LOG_FORMAT.
These variables take the same string values as their ioto.json5 counterparts.
The order of precedence of configuration is:
- Command line —trace, —debug or —verbose options
- Environment variable LOG_FILTER, LOG_FORMAT values
- ioto.json5 configuration
Release Features
Here is a more detailed list of features and fixes in the 1.4.0 release:
- Add URL test program “url”
- Improve web redirections
- Extend unit and service tests
- Build with OpenSSL by default on Linux
- Unify TLS configuration for various services
- Add detailed HTTP client and server request/response tracing
- Add web server test URL endpoint (/test/show)
- Extend building on more CPU architectures
- Improve error and trace handling for network errors
- Add environment variable control of trace via LOG_FILTER and LOG_FORMAT
- Add scloneNull API to preserve NULLs.
Release Fixes
- Rename dbcmd to db
- Eliminate some memory leaks
- Fix inconsistency with TLS config settings
- Fix blending JSON trees
- Fix URL client requests with query/hash URL components
- Fix database saving to non-default file location
- Split rTestFile into rGetFileSize and rFileExists
- Rename jsonGet to jsonGetRef and add allocating jsonGet
- webAllocHost and urlAlloc APIs takes new flags argument to control tracing
- Fix documentation regarding thread safety in the runtime API
- Change ioto —exit argument from minutes to seconds for higher granularity
- Fix HTTP pipelined requests where handler does not read all body data
- Add (void) definitions for newer compiler warnings
Upgrading
This should be a simple upgrade for all users from previous 1.X releases. API compatibility is high.
Download
Go to the Builder and navigate to the Product List to download. Select a product using “Ioto” as the device agent and click the Download icon.
Ongoing Maintenance
If you have questions, please contact us at: sales@embedthis.com.
Comments