LUA-URI-DATA(3) | Lua uri.data module | LUA-URI-DATA(3) |
lua-uri-data - data URI support for Lua URI library
The class "uri.data" is used for URIs with the "data" scheme. It inherits from the uri class.
Some of the features of this module require the lua-datafilter(3) library to be installed, but URI objects can still be created from "data" URIs even if it isn't available.
Any "data" URI containing an authority part is considered to be invalid, as is one whose path does not contain a comma. If the URI has the ";base64" parameter, then the data must consist only of characters allowed in base64 encoded data (upper and lowercase ASCII letters, digits, and the forward slash and plus characters).
All the methods defined in lua-uri(3) are supported. The "userinfo", "host", and "port" methods will always return nil, and will throw an exception when passed anything other than nil. The "path" method will throw an exception if given a new path which is nil or not valid for the "data" scheme.
The following additional methods are supported:
An exception is thrown if the datafilter module is not installed and the data in the URI is encoded as base64, although a data URI using percent encoding will not cause an exception.
The data passed in and returned should not be encoded in any special way, that is taken care of by the library.
If there is no media type given in the URI then the default value of "text/plain" will be returned, and if there is no "charset" parameter given then the default ";charset=US-ASCII" will be included.
The media type is encoded and decoded automatically by this method.
This class is based on "RFC 2397".
2012-00-00 | 1.1 |