summaryrefslogtreecommitdiff
path: root/Userland/Libraries/LibWebSocket
AgeCommit message (Collapse)Author
2022-02-12LibWebSocket: Don't try to send empty payload inside of frameDerpyCrabs
According to RFC 6455 sections 5.5.2-5.5.3 Ping and Pong frames can have empty "Application data" that means payload can be of size 0. This change fixes failed "buffer.size()" assertion inside of Core::Stream::write_or_error by not trying to send empty payload in WebSocket::send_frame.
2022-02-06LibCore+Userland: Remove Core::TCPSocket :^)sin-ack
This was deprecated in favor of Core::Stream::TCPSocket, and now has no users.
2022-02-06LibWebSocket: Switch to using Core::StreamAli Mohammad Pur
As LibTLS now supports the Core::Stream APIs, we can get rid of the split paths for TCP/TLS and significantly simplify the code as well. Provided to you free of charge by the Core::Stream-ification team :^)
2022-02-06Userland: Convert TLS::TLSv12 to a Core::Stream::SocketAli Mohammad Pur
This commit converts TLS::TLSv12 to a Core::Stream object, and in the process allows TLS to now wrap other Core::Stream::Socket objects. As a large part of LibHTTP and LibGemini depend on LibTLS's interface, this also converts those to support Core::Stream, which leads to a simplification of LibHTTP (as there's no need to care about the underlying socket type anymore). Note that RequestServer now controls the TLS socket options, which is a better place anyway, as RS is the first receiver of the user-requested options (though this is currently not particularly useful).
2022-01-24Everywhere: Convert ByteBuffer factory methods from Optional -> ErrorOrSam Atkins
Apologies for the enormous commit, but I don't see a way to split this up nicely. In the vast majority of cases it's a simple change. A few extra places can use TRY instead of manual error checking though. :^)
2022-01-04Userland: Resolve tautological-constant-out-of-range-compare warningsAndrew Kaster
Stop comparing platform-specific sized integer types to max() values of other interger types. Enable the warning everywhere.
2021-11-02Libraries: Fix visibility of Object-derivative constructorsBen Wiederhake
Derivatives of Core::Object should be constructed through ClassName::construct(), to avoid handling ref-counted objects with refcount zero. Fixing the visibility means that misuses like this are more difficult.
2021-10-06LibWebSocket: Add missing headers to Message.hBen Wiederhake
2021-09-19LibTLS: Use a setter for on_tls_ready_to_write with some more smartsAli Mohammad Pur
The callback should be called as soon as the connection is established, and if we actually set the callback when it already is, we expect it to be called immediately.
2021-09-18LibWebSocket: Use deferred_invoke() when discarding a connectionAndreas Kling
We don't want to destroy the WebSocketImpl while we're still using it higher up the stack. By using deferred_invoke(), we allow the stack to unwind before actually destroying any objects. This fixes an issue with the WebSocket service crashing on immediate connection failure.
2021-09-18LibWebSocket: Fix confusion about sizeof(size_t) on 64-bit platformsAndreas Kling
sizeof(size_t) is 8 on 64-bit platforms, not 64.
2021-09-18LibWebSocket: Fix a handful of clang-tidy warnings in WebSocket.{cpp,h}Andreas Kling
2021-09-14AK: Make URL::m_port an Optional<u16>, Expose raw port getterIdan Horowitz
Our current way of signalling a missing port with m_port == 0 was lacking, as 0 is a valid port number in URLs.
2021-09-06Everywhere: Make ByteBuffer::{create_*,copy}() OOM-safeAli Mohammad Pur
2021-09-02Userland: Migrate to argument-less deferred_invokesin-ack
Only one place used this argument and it was to hold on to a strong ref for the object. Since we already do that now, there's no need to keep this argument around since this can be easily captured. This commit contains no changes.
2021-06-06AK+Everywhere: Disallow constructing Functions from incompatible typesAli Mohammad Pur
Previously, AK::Function would accept _any_ callable type, and try to call it when called, first with the given set of arguments, then with zero arguments, and if all of those failed, it would simply not call the function and **return a value-constructed Out type**. This lead to many, many, many hard to debug situations when someone forgot a `const` in their lambda argument types, and many cases of people taking zero arguments in their lambdas to ignore them. This commit reworks the Function interface to not include any such surprising behaviour, if your function instance is not callable with the declared argument set of the Function, it can simply not be assigned to that Function instance, end of story.
2021-05-18LibWebSocket: Fixed occasional infinite loop with TLS socketsDexesTTP
This was caused by a double notifier on the TLS socket, which caused the TLS code to freak out about not being able to read properly. In addition, the existing loop inside of drain_read() has been replaced by code that actually works, and which includes new warnings when the drain method is called before initialization is done or after the websocket gets closed.
2021-05-17Everywhere: Fix a bunch of typosLinus Groh
2021-04-25Services: Add a WebSocket serviceDexesTTP
The WebSocket service isolates communication with a WebSocket to its own isolated process. Similar to other isolating services, it has its own user and group.
2021-04-25LibWebSocket+telws: Use my own copyright headers :^)DexesTTP
Since I guess I'll start attributing my own code, might as well change it for the previously written WebSocket code too !
2021-04-23AK: Rename adopt() to adopt_ref()Andreas Kling
This makes it more symmetrical with adopt_own() (which is used to create a NonnullOwnPtr from the result of a naked new.)
2021-04-22Everything: Move to SPDX license identifiers in all files.Brian Gianforcaro
SPDX License Identifiers are a more compact / standardized way of representing file license information. See: https://spdx.dev/resources/use/#identifiers This was done with the `ambr` search and replace tool. ambr --no-parent-ignore --key-from-file --rep-from-file key.txt rep.txt *
2021-04-18LibWebSocket: Add a new websocket libraryDexesTTP
This library currently contains a basic WebSocket client that can handle both standard TCP websockets and TLS websockets.