Commit Graph

730 Commits

Author SHA1 Message Date
9ef61bf224 bump version 2024-03-27 22:06:32 -07:00
93e673da9f Merge branch 'master' of github.com:machinezone/IXWebSocket 2024-03-27 22:03:54 -07:00
92beef8348 avoid some object copies 2024-03-27 22:03:26 -07:00
755d98d918 Support URLs with no slash before the question mark (#507)
* Support Url No Slash Before Question Mark

* Support Url No Slash Before Question Mark

* unit test fix

---------

Co-authored-by: Giuseppe Penone <giuseppe.penone@delonghigroup.com>
2024-03-18 22:26:45 -07:00
98b4828e93 Update IXSelectInterruptPipe.cpp (#502)
Valgrind keeps complaining that close() on the invalid descriptor -1 is happening here. I suppose that close shouldn't be called when the descriptor value is known to be invalid. It's not a fatal error or something, but this practice is able to create a lot of flood in the logs.
2024-03-18 22:24:11 -07:00
39e085bebc Fix MbedTLS disconnect handling. (#500) 2024-03-18 22:23:14 -07:00
70602c4e6b Add ping interval to constructor params for WebSocketServer (#497)
* Update .gitignore for CLion compatibility

* Add pingIntervalSeconds to constructor for WebSocketServer

* Add Heartbeat section to WebSocketServer usage documentation

* Fix typo
2024-03-12 09:46:27 -07:00
RH
3b66efbb6a Fix C++/WinRT compile issue (#493) 2023-11-15 10:40:49 -08:00
f29906c72f Allow building without rtti (#487)
Since factory returns a ProxyConnectionState, setOnConnectionCallback
will be a ProxyConnectionState. The code already makes that assumption,
since it does not check of state return value. Using a
static_pointer_cast will allow the library to be build with rtti.
2023-10-13 19:56:24 -07:00
872f516ede allow building when cpp exceptions are disabled (#489)
IXWebSocket needs exceptions support because of the use of stoi. In
order to build when cpp exceptions are disabled, we can use strtol.
2023-10-13 19:55:26 -07:00
ef57e3a2b1 Fix hanging of WebSocket::stop() waiting for its thread to join (#481)
This might happen in some special cases where
WebSocketTransport::sendOnSocket() fails, closes the socket, and set
the ready state to CLOSED, but WebSocket::run() stills wait the
interrupt event to happen.

Possibly related to #474
2023-09-01 08:11:36 -07:00
28832f8732 Fix #286 - http response headers overwritten with request headers (#483) 2023-09-01 08:11:07 -07:00
0dd284267a Fix MinGW build warning (#482) 2023-09-01 08:00:35 -07:00
a7019631b7 Fix server empty thread name (#478) 2023-08-01 22:16:43 -07:00
632ee31509 Update IXSocketMbedTLS.cpp (#471) 2023-06-22 14:12:51 -07:00
688af99747 bump version 2023-06-05 10:06:53 -07:00
dfa10df5ae Set an origin header in websocket and http clients (#455) 2023-04-01 12:19:38 -07:00
eb9a7bed76 fix warning about member variable initialization order + minor makefile build fix 2023-04-01 09:03:39 -07:00
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
dc7b986e10 Build fix for FreeBSD (#449) 2023-03-13 09:36:25 -07:00
1e3560014f Prevent deadlock when server is stopping (#426) 2023-02-25 14:41:05 -08:00
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
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
6cc21f3658 HTTP should contain port in 'Host' header (#427) 2023-02-11 15:27:40 -08:00
679ce519dd Fix DNSLookup memory leak (#422)
* Fix memory leak with shared_ptr and -fsanitize=address

* Replace addrinfo* by shared_ptr

* fsanitize=address only on Linux

* Add USE_WS Linux CI test

* Remove fsanitize from the cmake files

* Remove USE_WS in linux test suite
2022-12-22 17:13:51 -08:00
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
472cf68c31 add Content-Type support (#405) 2022-10-12 06:43:05 -07:00
1e46466114 Add option to disable hostname check (#399)
* Suppress compiler warnings about unused elements.

* Enable CMake's compilation database.

* Add TLS option to disable checking a certificate's host name.

* Add `--disable-hostname-validation` to `ws`.

* Add test for disabling hostname validation.
2022-10-12 06:41:32 -07:00
7b1524d7ec Update IXWebSocketVersion.h 2022-05-13 10:43:32 -07:00
e8048ad826 BoringSSL does not allow setting the hostname with a null-terminated string. The length is always required: https://boringssl.googlesource.com/boringssl/+/master/crypto/x509/x509_vpm.c#93 (#391) 2022-05-05 08:11:18 -07:00
d7bfe89e43 Set shorter thread names (#379) 2022-04-30 10:18:20 -07:00
84aa652846 Set shorter thread names (#379) 2022-04-30 10:16:53 -07:00
edb6ded99f Fix Sec-WebSocket-Key to contain valid Base64. (#389)
The generated header only "looked like" Base64, but if the other side
actually tried to decode it as such, it could fail. This change fixes
that to always generate a valid Base64 value.

The Base64 code is copied from
https://gist.github.com/tomykaira/f0fd86b6c73063283afe550bc5d77594.
2022-04-29 00:05:06 -07:00
2f560ff4c0 Update IXWebSocketVersion.h 2022-04-28 23:56:40 -07:00
b8563eddd1 11.4.1 2022-04-23 22:52:32 -07:00
4420bc70b5 Revert "Export static symbols when building ws with shared library (#370)" (#383)
This reverts commit a3d2fa4b7e.
2022-04-12 08:55:43 -07:00
2829c62ef9 Fix error handling after calling X509_NAME_get_index_by_NID
This should fix #376
2022-03-27 19:14:40 -07:00
a3d2fa4b7e Export static symbols when building ws with shared library (#370) 2022-03-19 11:41:40 -07:00
7360333aca Handle overflow in IXExponentialBackoff.cpp 2022-02-17 09:17:02 -08:00
e12a6ddbdd Update IXSocketConnect.cpp (#356)
Part of the code is never executed
warning raised by clang
2022-02-10 20:50:55 -08:00
127cc4a023 Fix for MINGW32 and clang on windows (#352) (#357)
* Update IXSocket.h

Avoid "conflicting declaration 'typedef SSIZE_T ssize_t'"

* Update IXUdpSocket.h

* Update IXNetSystem.cpp

ENOSPC and EAFNOSUPPORT are not defined for clang on windows
2022-02-10 20:49:33 -08:00
7711cb1ae7 Feature/no libdeflate (#360)
remove libdeflate code in gzip codec
2022-02-10 20:47:32 -08:00
db7057de69 Add support for streaming transfers (#353)
This change adds onChunkCallback to the request. If defined it will be
called repeatedly with the incoming data. This allows to process data on
the go or write it to disk instead of accumulating the data in memory.
2022-01-31 21:54:32 -08:00
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
2bc3afcf6c Fixed missing header for gcc (9.3.0) compilation (#346) 2022-01-06 19:27:00 -08:00
60563d88f2 Feature/11.4.0 (#344)
* mbedls system certs

* missing curly brace ...

* windows uwp for appveyor

* try again uwp

* update version and changelog

* revert odd change in test/IXSocketTest.cpp

Co-authored-by: Benjamin Sergeant <bsergeant@mz.com>
2022-01-05 10:43:18 -08:00
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
9f00428d57 Fix "HTTP/1.1 400 Illegal character CNTL=0xf" caused by serverMaxWindowBits/clientMaxWindowBits being uint8_t (signed char). (#341) 2022-01-04 12:25:18 -08:00
47d0b70ebf Include <cerrno> to provide standard error constants (#338)
See https://en.cppreference.com/w/cpp/header/cerrno for additional details. Some of used constants are defined in this header.

Inclusion is necessary to avoid these errors:

```
/home/user/IXWebSocket/ixwebsocket/IXNetSystem.cpp:189:30: error: use of undeclared identifier 'EAFNOSUPPORT'
            default: errno = EAFNOSUPPORT; return 0;
                             ^
/home/user/IXWebSocket/ixwebsocket/IXNetSystem.cpp:191:17: error: use of undeclared identifier 'ENOSPC'
        errno = ENOSPC;
                ^
/home/user/IXWebSocket/ixwebsocket/IXNetSystem.cpp:175:25: warning: implicit conversion loses integer precision: 'size_t' (aka 'unsigned long long') to 'int' [-Wshorten-64-to-32]
                    j = strspn(buf + i, ":0");
                      ~ ^~~~~~~~~~~~~~~~~~~~~
/home/user/IXWebSocket/ixwebsocket/IXNetSystem.cpp:234:21: error: use of undeclared identifier 'EAFNOSUPPORT'
            errno = EAFNOSUPPORT;
                    ^
2 warnings and 3 errors generated.
```
2022-01-04 12:13:19 -08:00
5457217503 Improved compatibility - fix mingw crossbuild (#337) 2021-12-22 22:48:20 -08:00