bsergean
dfa10df5ae
Set an origin header in websocket and http clients ( #455 )
2023-04-01 12:19:38 -07:00
Benjamin Sergeant
eb9a7bed76
fix warning about member variable initialization order + minor makefile build fix
2023-04-01 09:03:39 -07:00
ouwou
f184a7adef
fix incorrect closures with code 1011 Internal error ( #450 )
...
* fix incorrect closures with code 1011 Internal error
* enable IXWebSocketCloseTest
2023-03-29 20:45:29 -07:00
Azamat H. Hackimov
9157873f5b
Fix compilation on GCC-13 ( #443 )
...
* Fix compilation on GCC-13
GCC-13 changes internal cstdint includes, and now files that uses
standart integer types should directly include cstdint header.
See: https://gcc.gnu.org/gcc-13/porting_to.html#header-dep-changes
Bug: https://bugs.gentoo.org/865117
Bug: https://bugs.gentoo.org/895440
* Convert line endings to Unix format
2023-02-25 13:50:35 -08:00
YuHuanTin
aa2ca19895
Added support for setting custom ping messages with support for any 'ping' message type (binary ping message, text ping message) ( #438 )
...
* Added support for setting custom ping messages with support for any 'ping' message type (binary ping message, text ping message)
* Add default value
---------
Co-authored-by: YuHuanTin <2@>
2023-02-23 08:29:07 -08:00
TheArtfulBodger
b0fd119d14
Host HTTP and WS on the same port ( #414 )
...
* Quick hack to host HTTP and WS on the same port #373
* Quick hack to host HTTP and WS on the same port #373 - simplify code
* ran clang-format
Co-authored-by: En Shih <seanstone5923@gmail.com>
Co-authored-by: The Artful Bodger <TheArtfulBodger@users.noreply.github.com>
2022-11-05 18:53:11 -07:00
Andreas Hausladen
b5cf33a582
Introduction of IXWebSocketSendData ( #347 )
...
* Introduction of IXWebSocketSendData that makes it possible to not only send std::string but also std::vector<char/uint8_t> and char* without copying them to a std::string first.
Add a sendUtf8Text() method that doesn't check for invalid UTF-8 characters. The caller must guarantee that the string only contains valid UTF-8 characters.
* Updated usage.md: sendUtf8Text() and IXWebSocketSendData
2022-01-10 10:34:24 -08:00
Andreas Hausladen
1f2895a469
Win wsa select event ( #342 )
...
* Fix #323 : Missing SelectInterrupt implementation for Windows
Using WSAEventSelect, WSAWaitForMultipleEvents and WSAEnumNetworkEvents to emulate poll() with an interrupt-event.
* Cleanup
* Fixed incomplete comment.
* Switched ifdefs to support other Unixes with pipe file descriptors
* Fixed: SelectInterrupt fallback code for getFd()==-1 && getEvent()==nullptr converted a PollResultType::Timeout into a ReadyForRead causing the HttpClient to fail because it uses a hard-coded "SelectInterrupt" instance that doesn't implement getFd() and getEvent().
* Fixed gcc compile errors
* - HttpClient now uses the SelectInterruptFactory
- Fixed wrong ix::poll result when using Windows WSA functions
* We must deselect the networkevents from the socket event. Otherwise the socket will report states that aren't there.
2022-01-05 10:21:33 -08:00
Benjamin Sergeant
0813eb1788
mention disablePerMessageDeflate in the doc
2021-03-16 09:56:08 -07:00
Benjamin Sergeant
8f5134528b
(ixwebsocket) use a C++11 compatible make_unique shim
2020-11-15 09:56:54 -08:00
Benjamin Sergeant
261095fa12
(socket server) do not create a select interrupt object everytime when polling for notifications while waiting for new connections, instead use a persistent one which is a member variable
2020-08-15 15:28:15 -07:00
Benjamin Sergeant
ed2ed0f7ae
(ixwebsocket client) handle HTTP redirects
2020-08-14 18:13:34 -07:00
Benjamin Sergeant
2e3d625c1e
(websocket client) onProgressCallback not called for short messages on a websocket ( fix #233 )
2020-07-29 17:47:33 -07:00
Benjamin Sergeant
4d51098c86
(websocket client) heartbeat is not sent at the requested frequency ( fix #232 )
2020-07-29 11:24:42 -07:00
Benjamin Sergeant
22dffd5b7e
WebSocket::close is re-entrant
2020-07-27 17:38:33 -07:00
Benjamin Sergeant
0f026c5da2
(websocket client) reset WebSocketTransport onClose callback in the WebSocket destructor
2020-07-24 10:03:29 -07:00
Benjamin Sergeant
d5e51840ab
use const iterators
2020-07-08 10:34:14 -07:00
Benjamin Sergeant
543c2086b2
more templates in WebSocketTransport
2020-07-07 21:26:42 -07:00
Benjamin Sergeant
ccfd196863
clang-format
2020-04-16 11:58:06 -07:00
Benjamin Sergeant
9b8cfa0a37
(websocket) add a positive number to the heartbeat message sent, incremented each time the heartbeat is sent
2020-04-15 18:33:36 -07:00
Benjamin Sergeant
bea582c208
cobra subscriber in fluentd mode insert a created_at timestamp entry
2020-04-14 15:30:30 -07:00
Benjamin Sergeant
37a054723a
(websocket) use persistent member variable as temp variables to encode/decode zlib messages in order to reduce transient allocations
2020-04-13 21:38:15 -07:00
Benjamin Sergeant
0fffb1e894
(websocket) fix data race accessing _socket object without mutex protection when calling wakeUpFromPoll in WebSocketTransport.cpp
2020-03-26 19:31:59 -07:00
Benjamin Sergeant
179e17895d
unique_ptr for sockets
2020-03-24 12:48:55 -07:00
Benjamin Sergeant
9dcc2538ae
(websocket) reset per-message deflate codec everytime we connect to a server/client
2020-03-23 18:46:30 -07:00
Benjamin Sergeant
5ce846f48b
indent files
2020-03-20 17:00:18 -07:00
Benjamin Sergeant
6085839ef7
minor refactoring
2020-03-18 11:45:28 -07:00
Benjamin Sergeant
b287730c19
Simplify ping/pong based heartbeat implementation
2020-03-18 01:14:08 -07:00
Benjamin Sergeant
a844dbc587
websocket closing / handle failure to flush send buffer as an error case
2020-01-09 12:17:37 -08:00
Benjamin Sergeant
fe29579755
refactor receiving socket code in its own method
2020-01-09 12:00:42 -08:00
Benjamin Sergeant
a5bc39be55
(websocket client) better error propagation when errors are detected while sending data + (ws send) detect failures to send big files, terminate in those cases and report error (troubleshooting #140 )
2020-01-06 14:34:43 -08:00
Benjamin Sergeant
536a502b60
(client) error handling, quote url in error case when failing to parse on
2019-12-22 20:30:29 -08:00
Benjamin Sergeant
cae016564e
(server) attempt at fixing #131 by using blocking writes in server mode
2019-12-12 12:17:29 -08:00
fcojavmc
708969c126
Compile bug ( #122 )
...
* 1) IXWebSocketTransport: BUG: int type has no warranty of number of bits. It depends on compiler and architecture. In my system (64 bit) is 32 bit.
1 << 63 is bad idea in this case because the final number is 0 by overflow.
The symptom observed is that the server can't receive messages.
2) IXSocketFactory: Compilation Warning: Variable not in use.
* Better aproach suggested by Benjamin.
2019-11-20 11:12:24 -08:00
Benjamin Sergeant
b07827790f
check max frame size ( #119 )
2019-10-28 21:53:31 -07:00
Benjamin Sergeant
afed387bcf
Socket Factory has only one function which works for server and client code, and can do tls for both
2019-09-30 22:06:46 -07:00
Benjamin Sergeant
313949f087
SocketServer::handleConnection takes an std::shared_ptr<Socket> instead of a file descriptor
2019-09-30 21:48:55 -07:00
Benjamin Sergeant
d3cee46e93
wrong mutex being used ...
2019-09-24 14:10:41 -07:00
Benjamin Sergeant
94c589f696
Fix 2 race conditions detected with TSan, one in CobraMetricsPublisher::push and another one in WebSocketTransport::sendData (that one was bad).
2019-09-24 11:46:54 -07:00
Benjamin Sergeant
cd3c9d879c
reformat everything with clang-format
2019-09-23 10:25:23 -07:00
Matt DeBoer
408ee41990
WIP: support configurable certificates/keys, and root trust CAs ( #114 )
...
* wip: tls options implemented in openssl
* update naming, remove #define guard
* assert compiled with USE_TLS for tls options
* apply autoformatter
* include tls options impl
* style cleanup; auto ssl_err
* ssl_err -> sslErr
* be explicit about SSL_VERIFY_NONE
2019-09-22 18:06:15 -07:00
Benjamin Sergeant
64d3c99f99
improve some websocket error messages + add a utility function with unittest to parse status line and stop using scanf which triggers warnings on Windows
2019-09-09 21:23:57 -07:00
Benjamin Sergeant
95a97a197a
Fragmentation: for sent messages which are compressed, the continuation fragments should not have the rsv1 bit set (fix all autobahn tests for zlib compression 12.X)
...
Websocket Server / do a case insensitive string search when looking for an Upgrade header whose value is websocket. (some client use WebSocket with some upper-case characters)
2019-09-04 18:23:56 -07:00
Benjamin Sergeant
0bf185e143
Per message deflate/compression: handle fragmented messages (fix autobahn test: 12.1.X and probably others)
2019-09-03 17:42:48 -07:00
Benjamin Sergeant
da3d134be0
Receiving invalid UTF-8 TEXT message should fail and close the connection (fix remaining autobahn test: 6.X UTF-8 Handling)
2019-09-03 16:07:48 -07:00
Benjamin Sergeant
b4c4746d43
IXWebSocketTransport message processing refactoring
2019-09-03 15:48:55 -07:00
Benjamin Sergeant
fdd1ad9b17
Validate close codes. Autobahn 7.9.*
2019-09-03 15:43:16 -07:00
Benjamin Sergeant
1be8d9d46f
Validate that the close reason is proper utf-8. Autobahn 7.5.1
2019-09-03 14:35:40 -07:00
Benjamin Sergeant
3ad13a592d
Framentation: data and continuation blocks received out of order (fix autobahn test: 5.9 through 5.20 Fragmentation)
2019-09-03 12:02:56 -07:00
Benjamin Sergeant
ab93e4f168
Message type (TEXT or BINARY) is invalid for received fragmented messages (fix autobahn test: 5.3 through 5.8 Fragmentation)
2019-09-03 09:13:38 -07:00