aboutsummaryrefslogtreecommitdiff
path: root/src/supplemental/websocket/websocket.c
Commit message (Collapse)AuthorAge
* Various header file fixes... also fix compilation errors when HTTP is disabled.v2.0.0-alpha.6Garrett D'Amore2025-10-05
| | | | | | Also, some instances nni_aio are changed to nng_aio. We think we want to harmonize some of these types going forward as it will reduce the need to include headers hopefully letting us get away with just "defs.h" in more places.
* Converted property functions to use nng_err.Garrett D'Amore2025-04-27
|
* Transport listen: use nng_errGarrett D'Amore2025-04-27
|
* More nng_err -- this time for dialer and listener allocations.Garrett D'Amore2025-04-27
|
* AIO: Use nng_err for cancellation callback instead of int.Garrett D'Amore2025-04-27
| | | | | | This is part of our work to improve type safety/awareness, and also improve debugger support, for NNG error codes. There are still quite a few more but this should help.
* http: The big HTTP API refactoring of January 2025.v2.0.0-alpha.3http-client-transGarrett D'Amore2025-01-09
| | | | | | | | | | | | | | | | | | | | | | This represents a major change in the HTTP code base, consisting of a complete revamp of the HTTP API. The changes here are too numerous to mention, but the end result should be a vastly simpler API for both server and client applications. Many needless allocations were removed by providing fixed buffers for various parameters and headers when possible. A few bugs were fixed. Most especially we have fixed some bugs around very large URIs and headers, and we have also addressed conformance bugs to more closely conform to RFCs 9110 and 9112. As part of this work, the APIs for WebSockets changed slightly as well. In particular the properties available for accessing headers have changed. There is still documentation conversion work to do, and additional functionality (such as proper support for chunked transfers), but this is a big step in the right direction.
* http: server callback API simplifiedGarrett D'Amore2025-01-06
| | | | | | | | | | This simplified API lets callbacks obtain the response from the connection objection directly, and does not require the aio to carry it as a parameter. Further, the request and response are both stored inline in the connection, reducing allocations. This is at present only for the server; the client will get a similar set of changes.
* base64: move it to private for websocketsGarrett D'Amore2025-01-01
| | | | | | There are no other consumers for this, and reasonably unlikely to be others for now. (Other use cases are JWTs, but that would be another whole set of functionality that we're not ready to take on.)
* sha1: move this to private websocket APIGarrett D'Amore2025-01-01
| | | | | | Nothing else uses it, and nothing else *should* use it because SHA1 is insecure. WebSockets have to use it by definition, unfortunately. The implementation is not very fast, but doesn't have to be for the use case of websocket keying.
* websocket: use nni_aio_startGarrett D'Amore2024-12-26
|
* http: nng_http_handler_set_data is now void return (API break)Garrett D'Amore2024-12-22
|
* HTTP handler: limit host names to 256 bytes (RFC 1035 specifies 253.)Garrett D'Amore2024-12-22
| | | | This also makes `nng_http_handler_set_host` never fail (API break).
* http: setting response status never fails (breaking API change)Garrett D'Amore2024-12-22
|
* streams: add explicit stop functionsGarrett D'Amore2024-12-12
| | | | | | | | | | | | This allows us to explicitly stop streams, dialers, and listeners, before we start tearing down things. This hopefully will be useful in resolving use-after-free bugs in http, tls, and websockets. The new functions are not yet documented, but they are nng_stream_stop, nng_stream_dialer_stop, and nng_stream_listener_stop. They should be called after close, and before free. The close functions now close without blocking, but the stop function is allowed to block.
* websocket: inline the aiosGarrett D'Amore2024-12-07
| | | | This covers both the ttransport and the supplemental layers.
* ws: remove NNG_OPT_URLGarrett D'Amore2024-11-23
|
* TLS configuration changed to use discret _set_tls and _get_tls functions.Garrett D'Amore2024-11-09
| | | | This is simpler, and more reliable than using socket options.
* websocket: fix for setting user headersGarrett D'Amore2024-11-05
| | | | This was a crasher bug (found by test suite).
* Remove NNI_TYPE_OPAQUE altogether.Garrett D'Amore2024-11-03
| | | | | | | | This also fixes a couple of minor bugs -- changing the socket name could be incorrect as the termination was not applied properly, and the ZeroTier code got a change -- note that it is only possible in this revised version to pass a single moon ID for ZT orbit. The ZT code is a bit stale, and untested anyway.
* Remove nng_stream_set function family.Garrett D'Amore2024-10-28
| | | | This was not really used or useful.
* Remove the legacy transport registration functions.Garrett D'Amore2024-10-06
| | | | | | This also allows to remove most of the transport headers. Only zerotier.h sticks around, and only for now. (We expect to eject it into a separate module.)
* fixes #1734 websocket dialer hang on shutdownGarrett D'Amore2023-12-17
| | | | | | It's not absolutely clear that this fixes all of the possible cases, but we're hopeful that this does -- and in any event the bug does not seem to reproduce easily anymore.
* fixes #1735 websocket should send, and wait for, WS_CLOSE frames on shutdownGarrett D'Amore2023-12-17
| | | | fixes #1733 deadlock in websocket listener close
* Replace nni_aio_prov_set_extra with nni_aio_prov_set_data.Garrett D'Amore2021-12-31
| | | | | | This takes one less parameter, and is simpler. It will let us reclaim the aio_prov_extra data space as well, so that we can use it for other purposes.
* fixes #1403 http ws listeners added without a lockGarrett D'Amore2021-01-10
|
* fixes #1372 nni_reap could be smallerGarrett D'Amore2020-12-19
|
* fixes #1071 tran_chkopt can be cleaned upGarrett D'Amore2020-11-15
| | | | | | | | | | | | | | | | | This is a sweeping cleanup of the transport logic around options, and also harmonizes the names used when setting or getting options. Additionally, legacy methods are now moved into a separate file and can be elided via CMake or a preprocessor define. Fundamentally, the ability to set to transport options via the socket is deprecated; there are numerous problems with this and my earlier approaches to deal with this have been somewhat misguided. Further these approaches will not work with future protocol work that is planned (were some options need to be negotiated with peers at the time of connection establishment.) Documentation has been updated to reflect this. The test suites still make rather broad use of the older APIs, and will be converted later.
* fixes #1337 nni aio user data could be removedGarrett D'Amore2020-11-10
|
* Minor spelling tweaks for the aio framework.Garrett D'Amore2020-11-09
|
* fixes #914 websocket stream mode should support TEXTGarrett D'Amore2020-10-26
| | | | | | | This adds new options, NNG_OPT_WS_SEND_TEXT and NNG_OPT_WS_RECV_TEXT that permit communication with WebSocket peers that insist on using TEXT frames (stream mode only). The support is limited, as NNG does no validation of the frame contents to check for UTF-8 compliance.
* fixes #1094 Consider in-lining task and aioGarrett D'Amore2020-01-08
| | | | | This only does it for rep, but it also has changes that should increase the overall test coverage for the REP protocol
* Fixup a few codacy complaints.Garrett D'Amore2020-01-01
|
* fixes #986 ws_read_finish_str free invalid pointerGarrett D'Amore2019-12-28
| | | | | | Also, this has refactored the websocket stream test to the new acutest.h, and includes a much deeper test of fragmentation and reassembly of websocket streams.
* fixes #1004 Warning found by clang --analyzeGarrett D'Amore2019-11-11
| | | | | It's possible for an empty chunk to have a NULL data pointer. Even when copying zero bytes, this makes clang somewhat unhappy.
* fixes #976 websocket stream calls incorrect completion callbackGarrett D'Amore2019-08-12
|
* fixes #937 Memory Leak in wsstreamGarrett D'Amore2019-05-19
|
* Introduce nni_plat_printf()Garrett D'Amore2019-05-07
| | | | | This permits the stats dump to avoid some extra buffering, and resolves a complaint about possible format buffer overruns.
* fixes #882 websocket stream mode doesn't copy received dataGarrett D'Amore2019-02-17
|
* fixes #872 create unified nng_stream APIGarrett D'Amore2019-02-16
| | | | | | | | | This is a major change, and includes changes to use a polymorphic stream API for all transports. There have been related bugs fixed along the way. Additionally the man pages have changed. The old non-polymorphic APIs are removed now. This is a breaking change, but the old APIs were never part of any released public API.
* fixes #825 TCP public API should use generic setopt/getoptGarrett D'Amore2018-12-31
| | | | | | | | | | | | This changes much of the internal API for TCP option handling, and includes hooks for some of this in various consumers. Note that the consumers still need to have additional work done to complete them, which will be part of providing public "raw" TLS and WebSocket APIs. We would also like to finish addressing the call sites of nni_tcp_listener_start() that assume the sockaddr is modified -- it would be superior to use the NNG_OPT_LOCADDR option. Thaat will be addressed in a follow up PR.
* fixes #789 Websocket ping request crashBertrand2018-11-17
|
* fixes #673 transports could benefit from access to upper layerGarrett D'Amore2018-08-27
|
* fixes #664 aio cancellation could be betterGarrett D'Amore2018-08-20
| | | | | | | | | This changes the signature of the aio cancellation routines to take the argument for cancellation directly, so we do not need to lookup the argument using the nni_aio_get_prov_data. We should probably consider eliminating nni_aio_get_prov_data, and co, and changing the prov_extra to reflect prov_data. Later.
* fixes #638 Race condition detected in websocketGarrett D'Amore2018-08-19
| | | | fixes #651 Use after free in websocket
* fixes #584 Use after-free in websocketGarrett D'Amore2018-07-06
|
* fixes #545 uaio assertion error in wsGarrett D'Amore2018-06-14
|
* fixes #518 Panic in compat_ws -- use after free?Garrett D'Amore2018-06-14
|
* fixes #484 crashes in websocket transportGarrett D'Amore2018-05-29
| | | | | | | | | | | | | | | | | | | | | | | fixes #490 posix_epdesc use-after-free bug fixes #489 Sanitizer based testing would help fixes #492 Numerous memory leaks found with sanitizer This introduces support for compiler-based sanitizers when using clang or gcc (and not on Windows). See NNG_SANITIZER for possible settings such as "thread" or "address". Furthermore, we have fixed the issues we found with both the thread and address sanitizers. We believe that the thread issues pointed to a low frequency use-after-free responsible for rare crashes in some of the tests. The tests generally have their timeouts doubled when running under a sanitizer, to account for the extra long times that the sanitizer can cause these to take. While here, we also changed the compat_ws test to avoid a particularly painful and time consuming DNS lookup, and we made the nngcat_unlimited test a bit more robust by waiting before sending traffic.
* fixes #474 websocket listen on ws://*:<x> failsGarrett D'Amore2018-05-22
| | | | | | | | | | | | fixes #464 Support NN_WS_MSG_TYPE option (compat) fixes #415 websocket does not honor recv maxsize This fixes a significant (and security) issue in websocket, where the code does not honor a maximum receive size. We've exposed new API (internal) to set the limit on the frame size, and we've changed the default to *unlimited* for that internal API. (But the default for SP sockets, which are the only consumers at present, is still 1MB just like all other SP transports.)
* fixes #419 want to nni_aio_stop without blocking (#428)Garrett D'Amore2018-05-15
| | | | | | | | | | | | | | | | * fixes #419 want to nni_aio_stop without blocking This actually introduces an nni_aio_close() API that causes nni_aio_begin to return NNG_ECLOSED, while scheduling a callback on the AIO to do an NNG_ECLOSED as well. This should be called in non-blocking close() contexts instead of nni_aio_stop(), and the cases where we call nni_aio_fini() multiple times are updated updated to add nni_aio_stop() calls on all "interlinked" aios before finalizing them. Furthermore, we call nni_aio_close() as soon as practical in the close path. This closes an annoying race condition where the callback from a lower subsystem could wind up rescheduling an operation that we wanted to abort.