Commit graph

84 commits

Author SHA1 Message Date
Rémi Verschelde
538328898b Style: Fix copyright headers in new files 2019-08-28 09:19:52 +02:00
Rémi Verschelde
99980d856b
Merge pull request #29871 from Faless/crypto/initial_pr
More Crypto, SSL server, crt/key as Resource, HashingContext
2019-08-21 18:03:03 +02:00
Rémi Verschelde
f2c9252b6e
Merge pull request #31483 from Faless/ws/fix_double_relay
Fix WebSocketServer relaying message twice.
2019-08-20 12:49:15 +02:00
Fabio Alessandrelli
d1539db2c6 Fix WebSocketServer relaying message 2 times.
The WebSocketMultiplayerPeer was relaying the same message two times,
both in _server_relay and _process_multiplayer (which was only supposed
to store the packet, given the server was one of the destination).

_process_multiplayer now only store the packet, and calls _server_relay
which will relay the message to other clients if needed.
2019-08-19 18:18:13 +02:00
Fabio Alessandrelli
17be67b8c7 WebSocketServer now sanitize destination peers.
When relaying messages in multiplayer mode.
Could cause a crash in case a malicious client sends a bogus packet and
for those cases where a peer has just disconnected and a message arrive
from another peer with the disconnected one as destination.
2019-08-19 17:26:07 +02:00
Fabio Alessandrelli
c19871af6d Move CryptoCore to it's own folder.
Crypto classes will be placed in core/crypto.
2019-08-19 16:31:05 +02:00
Rémi Verschelde
d3153c28f0 Replace last occurrences of 'ERR_EXPLAIN' with 'ERR_FAIL_*_MSG'
The last remaining ERR_EXPLAIN call is in FreeType code and makes sense as is
(conditionally defines the error message).

There are a few ERR_EXPLAINC calls for C-strings where String is not included
which can stay as is to avoid adding additional _MSGC macros just for that.

Part of #31244.
2019-08-17 13:31:22 +02:00
Robin Hübner
8aeade74db Replace 'ERR_EXPLAIN' with 'ERR_FAIL_*_MSG' in rest of 'modules/' 2019-08-12 10:15:54 +02:00
Fabio Alessandrelli
d6c9b377b9 Fix WebSocketClient crash when unref during signal
Always call disconnect before emitting signals, to avoid calling it on a
freed object if the user decides to unreference it in a signal.
2019-07-28 15:23:20 +02:00
Fabio Alessandrelli
3e305ea036 Fix WebSocketClient consuming data during hanshake
Was missing a break of the while loop on connection.
This potentially caused early data frames to be trashed.
2019-07-08 19:24:27 +02:00
Rémi Verschelde
9da5fdc955
Merge pull request #30419 from Faless/ws/wslay_server_proto
(Re-)Implement subprotocols in websocket server.
2019-07-08 08:18:00 +02:00
Fabio Alessandrelli
11452dcf91 (Re-)Implement subprotocols in websocket server. 2019-07-08 07:48:26 +02:00
qarmin
9a77d748c0 Fixes minor issues found by static analyzer 2019-07-07 23:08:51 +02:00
Fabio Alessandrelli
3380dc9638 Optimize header reads (avoid extra allocs) 2019-07-04 15:03:04 +02:00
Fabio Alessandrelli
aae6c075aa Remove libwebsocket. No longer used, yay! 2019-07-04 15:03:04 +02:00
Fabio Alessandrelli
9e303ef71c WebSocket module now uses wslay library.
Both client and server are supported on native builds (as usual).

SSL server is still not supported, but will soon be possible with this
new library.

The API stays the same, we just need to work out potential issues due to
this big library switch.
2019-07-04 15:03:04 +02:00
Rémi Verschelde
b0d41847ed SCons: Use CPPDEFINES instead of CPPFLAGS for pre-processor defines
It's the recommended way to set those, and is more portable
(automatically prepends -D for GCC/Clang and /D for MSVC).

We still use CPPFLAGS for some pre-processor flags which are not
defines.
2019-07-03 09:59:04 +02:00
Hugo Locurcio
f7f6115f76
Proofread and improve the whole class reference
- Document a few more properties and methods
- Add more information to many classes
- Fix lots of typos and gramar mistakes
- Use [code] tags for parameters consistently
- Use [b] and [i] tags consistently
- Put "Warning:" and "Note:" on their own line to be more visible,
  and make them always bold
- Tweak formatting in code examples to be more readable
- Use double quotes consistently
- Add more links to third-party technologies
2019-06-27 22:30:19 +02:00
Rémi Verschelde
bc82781f7d doc: Replace all [code]CONSTANT[/code] by new [constant CONSTANT] hyperlinks 2019-06-27 13:49:36 +02:00
qarmin
4e5310cc60 Some code changed with Clang-Tidy 2019-06-26 15:08:25 +02:00
Fabio Alessandrelli
5b2f098ed4 Expose WebSocket set_buffers and document it. 2019-06-15 17:21:08 +02:00
Fabio Alessandrelli
ee90da4acb Allow setting websocket buffers sizes internally.
Needed by LSP.
2019-06-15 16:57:23 +02:00
Fabio Alessandrelli
be414e4476 Revert "Update libwebsockets to 3.1 (plus UWP patch)"
This reverts commit 90210c4862.
2019-05-01 14:41:47 +02:00
Rémi Verschelde
d52b70fb5e SCons: Always use env.Prepend for CPPPATH
Include paths are processed from left to right, so we use Prepend to
ensure that paths to bundled thirdparty files will have precedence over
system paths (e.g. `/usr/include` should have lowest priority).
2019-04-30 13:12:06 +02:00
Rémi Verschelde
c2a669a9f0 SCons: Review uses of CCFLAGS, CXXFLAGS and CPPFLAGS
Many contributors (me included) did not fully understand what CCFLAGS,
CXXFLAGS and CPPFLAGS refer to exactly, and were thus not using them
in the way they are intended to be.

As per the SCons manual: https://www.scons.org/doc/HTML/scons-user/apa.html

- CCFLAGS: General options that are passed to the C and C++ compilers.
- CFLAGS: General options that are passed to the C compiler (C only;
  not C++).
- CXXFLAGS: General options that are passed to the C++ compiler. By
  default, this includes the value of $CCFLAGS, so that setting
  $CCFLAGS affects both C and C++ compilation.
- CPPFLAGS: User-specified C preprocessor options. These will be
  included in any command that uses the C preprocessor, including not
  just compilation of C and C++ source files [...], but also [...]
  Fortran [...] and [...] assembly language source file[s].

TL;DR: Compiler options go to CCFLAGS, unless they must be restricted
to either C (CFLAGS) or C++ (CXXFLAGS). Preprocessor defines go to
CPPFLAGS.
2019-04-24 16:57:58 +02:00
Rémi Verschelde
6af69f851a doc: Drop unused <demos> tag 2019-04-19 11:03:46 +02:00
Fabio Alessandrelli
6a1bf006a3 Move IDHandler JS module to platform from Websock 2019-04-12 12:41:49 +02:00
marxin
e7f22ebdcd Enable warnings=extra on clang and GCC testers.
And remove 2 warnings from warnings=extra.
2019-04-02 17:14:47 +02:00
Rémi Verschelde
39c868171e doc: Bump version to 3.2 2019-04-01 12:33:56 +02:00
Fabio Alessandrelli
90210c4862 Update libwebsockets to 3.1 (plus UWP patch) 2019-03-06 02:02:52 +01:00
marxin
e5f665c718 Fix -Wsign-compare warnings.
I decided to modify code in a defensive way. Ideally functions
like size() or length() should return an unsigned type.
2019-02-27 07:45:57 +01:00
marxin
8d51618949 Add -Wshadow=local to warnings and fix reported issues.
Fixes #25316.
2019-02-20 19:44:12 +01:00
marxin
155cbe0b37 Fix warnings seen with warnings=all and recent GCC 8.2. 2019-02-18 21:54:31 +01:00
Rémi Verschelde
fe7e11e008 Modules: Ensure classes match their header filename
Renamed:
- `modules/mono/mono_gd/gd_mono_class_member.h` -> `i_mono_class_member.h`
- `modules/upnp/upnpdevice.h` -> `upnp_device.h`
- `modules/websocket/websocket_multiplayer.h` -> `websocket_multiplayer_peer.h`
2019-02-12 22:59:56 +01:00
Fabio Alessandrelli
14e59ff112 Update docs and errors for WebSocket module 2019-01-28 02:12:50 +01:00
Rémi Verschelde
26fddb77be doc: Fix wrong references found by new makerst.py
Thanks @PJB3005
2019-01-07 10:06:12 +01:00
Rémi Verschelde
b16c309f82 Update copyright statements to 2019
Happy new year to the wonderful Godot community!
2019-01-01 12:58:10 +01:00
Rémi Verschelde
d1f3b622f0 Fix missing/malformed license headers 2019-01-01 12:46:36 +01:00
Fabio Alessandrelli
77466285f2 Fix HTML5 WebSocket client buffers size. 2018-12-26 17:51:12 +01:00
Rémi Verschelde
6cdcde7114 doc: Add missing commas after "If true/false" 2018-12-20 13:47:12 +01:00
Fabio Alessandrelli
c3d3f1dedb Websocket LWS keep servicing till no CB are left
Apparently, only a single WRITABLE/READABLE callback is called at each
servicing. For this reason, we want to keep servicing until we end up
not receiving any callback.
When that happens, we can assume that we can't (or don't want to) write
more, and that there is nothing left to read in the socket buffer.
2018-11-25 17:25:03 +01:00
Fabio Alessandrelli
c066db4d59 Convert WebSocket module to use PacketBuffer class 2018-11-12 22:55:17 +01:00
Fabio Alessandrelli
4847b5bff5 Add new PacketBuffer class for buffered peers 2018-11-12 21:49:50 +01:00
Rémi Verschelde
c02cd5139f
Merge pull request #23490 from Faless/lws_client_memfix
Fix access to freed mem in WS client after #23241
2018-11-10 22:18:42 +01:00
Juan Linietsky
f2e54057ae -Moved EditorDefaultValue to ClassDB, made it core
-Removed one and zero hints for properties, replaced by default value
2018-11-08 11:30:59 -03:00
Fabio Alessandrelli
e3008b71c3 Fix access to freed mem in WS client after #23241
I was wrong in assuming that String had to survive long enough to avoid
it, what actually needed to survive was the CharString obtained from the
acsii() or utf8() function.
At least according to valgrind
2018-11-03 23:39:15 +01:00
Fabio Alessandrelli
e6a069119b Add missing EMWSServer::poll function.
Empty of course as server is not supported in HTML5, but the symbol must
be defined.
2018-10-23 12:49:24 +02:00
Fabio Alessandrelli
bafcde805c Remove unneeded strncpy in lws_client.
Pass the String buffer directly, lws_client_connect_via_info will copy
them for us.
2018-10-23 12:31:47 +02:00
Dualtagh Murray
b902a2f2a7 Fixing warnings generated by MSVC
Fixes #22684.
2018-10-19 11:45:24 +02:00
Fabio Alessandrelli
d65afb2c74 Fix LWSClient connect_to_host string termination.
Coming from strncpy might get you a non-NULL terminated buffer.
The solution, if you accept trunction, is to give one less byte to
strncpy and manually set the last char in the buffer to '\0'.
If the source string is shorter, than the buffer is padded with '\0'
automatically.
2018-10-07 14:50:14 +02:00