summaryrefslogtreecommitdiff
path: root/src/supplemental
Commit message (Collapse)AuthorAge
* fix a number of cppcheck complaints (not all)Garrett D'Amore2018-04-24
|
* fixes #346 nng_recv() sometimes acts on null `msg` pointerGarrett D'Amore2018-04-20
| | | | | | | | | | | | | | | | | | | | | | | | | | | This closes a fundamental flaw in the way aio structures were handled. In paticular, aio expiration could race ahead, and fire before the aio was properly registered by the provider. This ultimately led to the possibility of duplicate completions on the same aio. The solution involved breaking up nni_aio_start into two functions. nni_aio_begin (which can be run outside of external locks) simply validates that nni_aio_fini() has not been called, and clears certain fields in the aio to make it ready for use by the provider. nni_aio_schedule does the work to register the aio with the expiration thread, and should only be called when the aio is actually scheduled for asynchronous completion. nni_aio_schedule_verify does the same thing, but returns NNG_ETIMEDOUT if the aio has a zero length timeout. This change has a small negative performance impact. We have plans to rectify that by converting nni_aio_begin to use a locklesss flag for the aio->a_fini bit. While we were here, we fixed some error paths in the POSIX subsystem, which would have returned incorrect error codes, and we made some optmizations in the message queues to reduce conditionals while holding locks in the hot code path.
* We need to declare the TLS structure here.Garrett D'Amore2018-04-11
| | | | | Applications which may not even be using TLS should not have to know about the TLS configuration structure.
* fixes #324 nni_aio_set_synch leads to race conditionGarrett D'Amore2018-04-04
| | | | | | | | fixes #325 synchronous aio completion crash fixes #327 move nni_clock() operations to outside the nni_aio_lk. This work was done for the context tree, and is necessary to properly enable that branch.
* fixes #315 WebSocket message handling errorsGarrett D'Amore2018-03-30
| | | | | This also gives a performance benefit to WebSocket, by making the completion logic run synchronously.
* Add documentation for supplemental functions.Garrett D'Amore2018-03-22
| | | | | | This includes platform portability stuff like mutexes and threads, etc. While here we fixed a problem with nng_opts_parse and we addressed the type of the platform API.
* Fixes issues found by (and submitted by) @nonnenmacher when workingVincent Nonnenmacher2018-03-19
| | | | | | | on a python wrapper (cffi). Mostly this is fixing inconsistencies in our public API and the actual implementation.
* Fix for Windows compilation warnings.Garrett D'Amore2018-03-05
|
* fixes #262 NNG_OPT_URL should be resolvedGarrett D'Amore2018-03-04
| | | | | | | | This causes TCP, TLS, and ZT endpoints to resolve any wildcards, and even IP addresses, when reporting the listen URL. The dialer URL is reported unresolved. Test cases for this are added as well, and nngcat actually reports this if --verbose is supplied.
* Isolate TLS functions into separate tls.h header file.Garrett D'Amore2018-03-02
|
* fixes #247 nngcat needs TLS optionsGarrett D'Amore2018-03-02
| | | | | | | While here we also fixed a bug in the --file handling that we noticed while writing the TLS handling. We also fixed a warning in the core (msgqueue) for set but unused variables.
* fixes #240 nngcat is MIAGarrett D'Amore2018-02-28
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This is intended to provide compatibility with, and has been tested against, legacy nanocat. There are a few differences though. At this time support for the alias names (where argv[0] is set to something like nngreq or somesuch) is missing. By default this library operations without NNG_FLAG_NONBLOCK on dial and listen, so that failures here are immediately diagnosable. (This behavior can be changed with the --async flag.) By default --pair means PAIRv1, but you can specify --pair0 or --pair1 explicitly. (There is also a --compat mode, and in that mode --pair means PAIRv0. The --compat mode also turns on NNG_FLAG_NONBLOCK by default.) The "quoted" mode also quotes tabs. (Legacy nanocat did not.) It is possible to connect to *multiple* peers by using the --dial or --listen (or similar) options multiple times. Shorthands can be used for long options that are not ambiguous. For example, --surv can be used to mean surveyor, but --re is invalid because it can mean req, rep, or respondent. We assume you have a reasonable standard C environment. This won't work in embedded environments without support for FILE *. TLS options are missing but to be added soon. A man page is still to be written.
* Add nng_opts_parse() API for handling command line options.Garrett D'Amore2018-02-22
| | | | | | | | | | | We have implemented this alternative to getopt() so that we can create nngcat. The reason we did not just use getopt() is that getopt() does not understand long options (which nanocat uses, and we want to preserve for compatibility) and getopt() is not available on Windows (and possibly other non-POSIX platforms.) This function handles long and short options, but does not have support for option clustering. It also is threadsafe & reentrant, unlike getopt.
* Modularize HTTP headers somewhat.Garrett D'Amore2018-02-21
| | | | | | We move the HTTP definitions out of the core nng.h and into a supplemental header. Most of this change was trivial updates to all of the HTTP related manual pages.
* CMake & CPack improvements.Garrett D'Amore2018-02-21
| | | | | | | | | These are incremental updates... we avoid using install() in the subdirectories, so that we can adapt properly to them in the single parent directory. We have started some of the work to improve support for CPack. This is still not yet done, but work in progress.
* Introduce 'porting layer' Public API.Garrett D'Amore2018-02-20
| | | | | | | This introduces portable primitives for time, random numbers, synchronization primitives, and threading. These are somewhat primitive (least common denominiators), but they can help with writing portable applications, especially our own demo apps.
* fixes #234 Investigate enabling more verbose compiler warningsGarrett D'Amore2018-02-14
| | | | | | | We enabled verbose compiler warnings, and found a lot of issues. Some of these were even real bugs. As a bonus, we actually save some initialization steps in the compat layer, and avoid passing some variables we don't need.
* fixes #171 Refactor aio to use generic data fieldsGarrett D'Amore2018-02-08
| | | | | | | | This addresses the use of the pipe special field, and eliminates it. The message APIs (recvmsg, sendmsg) need to be updated as well still, but I want to handle that as part of a separate issue. While here we fixed various compiler warnings, etc.
* fixes #224 Windows pipe name restrictions, unicodeGarrett D'Amore2018-02-07
| | | | While here, we cleaned up a few other unused variables in the HTTP code.
* HTTP public API should initialize the library.Garrett D'Amore2018-02-07
|
* fixes #228 aio iov should have larger limits (dynamically allocated)Garrett D'Amore2018-02-05
|
* Add, and document, the url->u_requri member.Garrett D'Amore2018-02-02
| | | | | This member is the value passed in actual HTTP protocol, so it is useful with the function nng_http_req_set_uri().
* fixes #174 Define public HTTP client APIGarrett D'Amore2018-02-01
|
* fixes #173 Define public HTTP server APIGarrett D'Amore2018-02-01
| | | | | | | | | | | | | | | | | | | | | | | This introduces enough of the HTTP API to support fully server applications, including creation of websocket style protocols, pluggable handlers, and so forth. We have also introduced scatter/gather I/O (rudimentary) for aios, and made other enhancements to the AIO framework. The internals of the AIOs themselves are now fully private, and we have eliminated the aio->a_addr member, with plans to remove the pipe and possibly message members as well. A few other minor issues were found and fixed as well. The HTTP API includes request, response, and connection objects, which can be used with both servers and clients. It also defines the HTTP server and handler objects, which support server applications. Support for client applications will require a client object to be exposed, and that should be happening shortly. None of this is "documented" yet, bug again, we will follow up shortly.
* Expose scatter/gather I/O vectors; we will use for HTTP API.Garrett D'Amore2018-01-29
|
* fixes #219 transports should take URL structure instead of string addressGarrett D'Amore2018-01-22
| | | | | | | | | | This eliminates a bunch of redundant URL parsing, using the common URL logic we already have in place. While here I fixed a problem with the TLS and WSS test suites that was failing on older Ubuntu -- apparently older versions of mbedTLS were unhappy if selecting OPTIONAL verification without a validate certificate chain.
* fixes #216 HTTP server side API refactoring, directory serving supportGarrett D'Amore2018-01-20
| | | | | | | | | | | This changes the backend (internal) HTTP API to provide a much more sensible handler scheme, where the handlers are opaque objects and we can allocate a handler for different types of tasks. We've also added support serving up directories of static content, and added code to validate that the directory serving is working as intended. This is a key enabling step towards the public API.
* fixes #211 Restore handling of '*' in URL logicGarrett D'Amore2018-01-17
|
* fixes #209 NNG_OPT_TLS_VERIFIED is bustedGarrett D'Amore2018-01-17
| | | | | fixes #210 Want NNG_OPT_TLS_* options for TLS transport fixes #212 Eliminate a_endpt member of aio
* fixes #206 Want NNG_OPT_TLS_VERIFIED optionGarrett D'Amore2018-01-16
| | | | | | | | | | | | | | It is useful to have support for validating that a peer *was* verified, especially in the presence of optional validation. We have added a property that does this, NNG_OPT_TLS_VERIFIED. Further, all the old NNG_OPT_WSS_TLS_* property names have also been renamed to generic NNG_OPT_TLS property names, which have been moved to nng.h to facilitate reuse and sharing, with the comments moved and corrected as well. Finally, the man pages have been updated, with substantial improvements to the nng_ws man page in particular.
* fixes #201 TLS configuration should support files for certificates and keysGarrett D'Amore2018-01-16
| | | | | | | | | | | | | | | | | | | | | | | | | This adds support for configuration of TLS websockets using the files for keys, certificates, and CRLs. Significant changes to the websocket, TLS, and HTTP layers were made here. We now expect TLS configuration to be tied to the HTTP layer, and the HTTP code creates default configuration objects based on the URL supplied. (HTTP dialers and listeners are now created with a URL rather than a sockaddr, giving them access to the scheme as well.) We fixed several bugs affecting TLS validation, and added a test suite that confirms that validation works as it should. We also fixed an orphaned socket during HTTP negotiation, responsible for an occasional assertion error if the http handshake does not complete successfully. Finally several use-after-free races were closed. TLS layer changes include reporting of handshake failures using newly created "standard" error codes for peer authentication and cryptographic failures. The use of the '*' wild card in URLs at bind time is no longer supported for websocket at least. Documentation updates for all this are in place as well.
* Refactored file API.Garrett D'Amore2018-01-11
| | | | | | | | | This refactor of the file API provides a simpler and easier to use interface for our needs (and simpler to implement) in both the ZeroTier transport and the HTTP/TLS file accesses. It also removes some restrictions present on the old one, although it is still not suitable for working with large files. (It will work, just be very inefficient as the entire file must be loaded into memory.)
* Clarifications around nng_fini(), and remove old http_msg structure.Garrett D'Amore2018-01-10
|
* fixes #186 Suggested API changes for nng TLS certsGarrett D'Amore2018-01-09
|
* Convert existing websocket and http code to use new URL framework.Garrett D'Amore2018-01-05
| | | | | | This also fixes a use-after-free bug in the HTTP framework, where the handler could be deleted why callbacks were still using it. (We now reference count the handlers.)
* Fix websocket hang after sending one message.Garrett D'Amore2018-01-03
| | | | | | | | | | | | | This fixes a problem where the websocket would only send one message, then no others, due to not clearing the "frame" busy flag on completion of the frame transmit. We have also added a test that tries to send 10 messages back and forth to make sure that we catch this kind of problem in the future. Finally we've fixed some problems that were found when testing edge cases around the protocol, which were responsible for invalid memory accesses.
* Do not free the request structure on error -- the http server needs it.Garrett D'Amore2018-01-03
|
* Don't hold the lock while stopping HTTP!Garrett D'Amore2018-01-02
|
* fixes #191 Several HTTP problems foundGarrett D'Amore2018-01-02
| | | | | | | | | | | | | | | | First, httpbin.org was having some high latency (load) earlier today, so we needed to bump the timeout up. Next, this also uncovered a bug where our cancellation of http channels was a bit dodgy. This is changed to be a bit more robust, separating the "current" active http streams (for read or write) into separate tracking variables variables. Also, now cancellation immediately calls the aio finish for those -- there were assumptions elsewhere (expire timeouts) that cancellation caused nni_aio_finish() to be called. Finally there was a use after free bug in the websocket listener code where the listener could be freed while still having outstanding streams waiting to send the websocket reply.
* Websocket handshake was broken (no base64 decode step needed).Garrett D'Amore2018-01-02
| | | | | Big thanks to @bertrand- for figuring this out, and a prototype of the fix.
* SHA1 should just use void * for message pointers in API.Garrett D'Amore2018-01-02
|
* Fix HTTP sconn race, and compile bugs introduced.Garrett D'Amore2018-01-01
|
* Rename config init/fini to alloc/free, add documentation for them.Garrett D'Amore2017-12-31
|
* fixes #166 Websocket TLS mappingGarrett D'Amore2017-12-30
| | | | | | | | | | | | | | | | | This introduces the wss:// scheme, which is available and works like the ws:// scheme if TLS is enabled in the library. The library modularization is refactored somewhat, to make it easier to use. There is now a single NNG_ENABLE_TLS that enables TLS support under the hood. This also adds a new option for the TLS transport, NNG_OPT_TLS_CONFIG (and a similar one for WSS, NNG_OPT_TLS_WSS_CONFIG) that offer access to the underlying TLS configuration object, which now has a public API to go with it as well. Note that it is also possible to use pure HTTPS using the *private* API, which will be exposed in a public form soon.
* fixes #172 HTTP and websocket need better conditional inclusionGarrett D'Amore2017-12-28
|
* Fix compilation warnings, bugs, and crashes found on Windows.Garrett D'Amore2017-12-28
| | | | | This addresses a number of problems that were found on Windows, including one bug that actually turned up in testing on POSIX.
* One more set of Windows fixes.Garrett D'Amore2017-12-27
|
* Compilation fixes for Windows.Garrett D'Amore2017-12-27
|
* fixes #180 add websocket header propertiesGarrett D'Amore2017-12-27
|
* fixes #165 Add address properties for websocket pipesGarrett D'Amore2017-12-26
|