CRAN release 0.7.0
nanonext 0.7.0
nanonext 0.7 implements API optimisations after recent enhancements; the API is again intended to remain stable after these changes
New Features
status_code()
utility returns a translation of HTTP response status codes.
Updates
Please review the following potentially breaking changes, and only update when ready:
- The API has been re-engineered to ensure stability of return types:
socket()
,context()
andstream()
will now error rather than return an 'errorValue'. The error value is included in the error message.send_aio()
andrecv_aio()
now always return an integer 'errorValue' at$result
and$data
respectively.recv()
andrecv_aio()
now return an integer 'errorValue' at each of$raw
and$data
when 'keep.raw' is set to TRUE.ncurl()
now returns an integer 'errorValue' at each of$status
,$headers
,$raw
and$data
for both sync and async. Where redirects are not followed, the address is now returned as a character string at$data
.
- For functions that send and receive messages i.e.
send()
,send_aio()
,recv()
,recv_aio()
andncurl()
, 'errorValues' are now returned silently without an accompanying warning. Useis_error_value()
to explicitly check for errors. nano_init()
is deprecated due to the above change in behaviour.send()
no longer has a '...' argument. This has had no effect since 0.6.0, but will now error if additional arguments are provided (please check and remove previous uses of the argument 'echo'). Also no longer returns invisibly for consistency withrecv()
.listen()
anddial()
now only take a socket as argument; for nano objects, the$listen()
and$dial()
methods must be used instead.nano()
now creates a nano object with method$context_open()
for applicable protocols. Opening a context will attach a context at$context
and a$context_close()
method. When a context is active, all object methods apply to the context instead of the socket. Method$socket_setopt()
renamed to$setopt()
as it can be used on the socket or active context as applicable.- Non-logical values supplied to logical arguments will now error: this is documented for each function where this is applicable.
Other changes:
- Integer
send()
/recv()
arguments for 'mode' andsetopt()
arguments for 'type' implemented in 0.5.3 are now documented and considered part of the API. This is a performance feature that skips matching the character argument value. - Fixes bug introduced in 0.6.0 where Aios returning 'errorValues' are not cached with the class, returning only integer values when accessed subsequently.
- Fixes potential crash when
base64dec()
encounters invalid input data. Error messages have been revised to be more accurate. - Fixes the
$
method for 'recvAio' objects for when the object has been stopped usingstop_aio()
. - Using the
$listen()
or$dial()
methods of a nano object specifying 'autostart = FALSE' now attaches the$listener_start()
or$dialer_start()
method for the most recently added listener/dialer. device()
no longer prompts for confirmation in interactive environments - as device creation is only successful when binding 2 raw mode sockets, there is little scope for accidental use.- Print method for 'errorValue' now also provides the human translation of the error code.
- Bundled 'libnng' source updated to v1.6.0 pre-release (5385b78).
- Internal performance enhancements.