Commit Graph

50 Commits (master)

Author SHA1 Message Date
Slávek Banko f3f392caec
Merge tag 'LibVNCServer-0.9.12'
Signed-off-by: Slávek Banko <slavek.banko@axis.cz>
7 years ago
Remi Gacogne 716bd27235
Fix -Wmisleading-indentation warnings 7 years ago
Michele Calgaro 8c081c8888
Removed _BSD_SOURCE, _SVID_SOURCE, _GNU_SOURCE, _XOPEN_SOURCE.
Signed-off-by: Michele Calgaro <michele.calgaro@yahoo.it>
7 years ago
Christian Beier 459046efc0
websockets: remove Flash fallback
Closes #162
7 years ago
Jocelyn Le Sage e8a1ca2035 Fixed compilation of websockets on system where there is no implementation of base64 functions. 9 years ago
Christian Beier ada4b4fc5a Merge pull request #158 from kempniu/gtk-vnc-0.7.0-compat
websockets: Ensure compatibility with gtk-vnc 0.7.0+
9 years ago
Christian Beier f48921becf
websockets: restore webSocketCheckDisconnect() to keep API compatibility 9 years ago
Andreas Weigel 5d9d6a8712
add decode support for continuation frames
use FIN bit and implement opcode 0x00

make consistent use of uint64_t for big frame sizes
9 years ago
Andreas Weigel a90a43cda5
remove Hixie-specific MD5 and check functions 9 years ago
Andreas Weigel f19d6ee225
add ws_decode tests
modify automake to include ws_decode test

add python frame generator for decode tests

modify configure to only include ws_decode test if preconditions are
fulfilled
9 years ago
Andreas Weigel a2322e7006
remove obsolete hixie protocol support 9 years ago
Andreas Weigel bcefa591cd
factor out hybi decode part to make it testable
remove direct dependency on rfbClientPtr structure in hybi decode
function(s)
9 years ago
Andreas Weigel aac95a9dcf
fix overflow and refactor websockets decode (Hybi)
fix critical heap-based buffer overflow which allowed easy modification
of a return address via an overwritten function pointer

fix bug causing connections to fail due a "one websocket frame = one
ws_read" assumption, which failed with LibVNCServer-0.9.11

refactor websocket Hybi decode to use a simple state machine for
decoding of websocket frames
9 years ago
Michał Kępień 75f04c14e4 Ensure compatibility with gtk-vnc 0.7.0+ 9 years ago
Christian Beier 7368417239 Various #ifdef fixes to allow building with MSVC2014 9 years ago
Christian Beier 1d1d2090b7 Make websockets code build on OSX without SSL. 9 years ago
Christian Beier 16cf35b2bf
Use unprefixed b64_* functions in websockets code. 9 years ago
Kyle Russell aed23ae5c3 websockets: Don't supply Sec-WebSocket-Protocol if not in request 9 years ago
plettix 455ba61e4f fix for issue 81
use different buffers for decode and encode
11 years ago
Floris Bos 6836ccb208 Fix handling of multiple VNC commands per websockets frame
- When processing input, check if there is any extra data
  pending in the internal websocket frame and SSL buffers.
- Prevents input events lagging behind because they get
  stuck in one of the buffers.
  Data pending in our own buffers cannot be detected with
  select() so was not processed until more input arrives
  from the network.
- Closes # 55

Signed-off-by: Floris Bos <bos@je-eigen-domein.nl>
11 years ago
Daniel Cohen Gindi fbf48c65f3 `strings.h` and `resolv.h` are not available on MSVC, and some POSIX functions are renamed or deprecated
For all of those missing/deprecated POSIX functions, we just add a macro mapping to the _underscored version of MSVC.
11 years ago
Joel Martin 7b9fc019de Set opcode correctly for binary frames. 13 years ago
Raphael Kubo da Costa 8f544bd276 Work around a gcc bug with anonymous structs and unions.
GCC < 4.6 failed to parse the declaration of ws_header_t correctly because
it did not accept anonymous structs and unions. [1]

Work around the bug by adding names to the unions and structs. Ugly, but
works.

[1] http://gcc.gnu.org/bugzilla/show_bug.cgi?id=4784
13 years ago
Raphael Kubo da Costa 252f5d9c7c Add the required headers for read(2) 13 years ago
Raphael Kubo da Costa 95dd76327b Use htobeNN(3) to convert numbers in websocket.c.
byteswap.h exists only on glibc, so building libvncserver with websockets
support was not possible in other systems.

Replace the inclusion of byteswap.h and the WS_* definitions with calls to
htobeNN, which should perform the same conversions, be more portable and
avoid the need to check for the platform's endianness.
13 years ago
Raphael Kubo da Costa 4c148e5f74 Tune the definitions needed when building with -ansi.
The current definitions were mostly useful to glibc and followed its
feature_test_macros(3) documentation.

However, this means other platforms still had problems when building with
strict compilation flags. _BSD_SOURCE, for example, is only recognized by
glibc, and other platforms sometimes need _XOPEN_SOURCE instead, or even the
removal of some definitions (such as the outdate _POSIX_SOURCE one).

_POSIX_SOURCE also had to be conditionally defined in some places, as what
it enables or disables during compilation varies across systems.
13 years ago
Raphael Kubo da Costa 8f1ef3d66c Add some missing feature macro definitions.
Building with -ansi failed due to some code (as well as system
headers) using non-C89 features. Fix that by adding the usual
_POSIX_SOURCE and _BSD_SOURCE definitions already present in some
other files.
13 years ago
Raphael Kubo da Costa 3cbef1a976 Use C-style comments in rfbconfig.h.cmake and C source code.
Using C++-style comments when building the code with -ansi does not
work, so be more conservative with the comment style.
13 years ago
Raphael Kubo da Costa 88e6043585 Correctly include rfbconfig.h.
build_dir/rfb is not passed as an include directory automatically to
the compiler, so including that file fails.
13 years ago
Christian Beier 6f9a9160c4 Fix some compiler warnings thrown with newer gcc. 14 years ago
Gernot Tenchio f597599d2a websockets: removed debug message 14 years ago
Gernot Tenchio 4d9178dcf2 websockets: restore errno after logging an error 14 years ago
Gernot Tenchio bd9cae3d12 Add support for different crypto implementations 14 years ago
Christian Beier 98a9d49c05 Update AUTHORS regarding the websocket guys. 14 years ago
Gernot Tenchio 2c45d08dd8 websocket: Use a single buffer for both, encoding and decoding 15 years ago
Gernot Tenchio 3eec976558 Merge branch 'kanaka/websockets' into websockets
Conflicts:
	libvncserver/websockets.c
15 years ago
Gernot Tenchio b1671e6de9 websockets: fix webSocketCheckDisconnect()
Do not consume the peeked data if no close frame was detected.
15 years ago
Gernot Tenchio 0f2ac00f6e websockets: use 32bit Xor in webSocketsDecodeHybi() 15 years ago
Gernot Tenchio fd73186769 websockets: nothing to worry about 15 years ago
Gernot Tenchio 7b80ff5b3a websockets: added gcrypt based sha1 digest funtion 15 years ago
Joel Martin d8b7f7a7d6 Add sha1.*. Remove UTF-8 encode. Protocol handling.
Add common/sha1.h and common/sha1.c so that we have the SHA routines
even if openssl is not available. From the IETF SHA RFC example code.

Remove the UTF-8 encoding hack. This was really just an experiment.

If the protocol passed in the handshake has "binary" then don't base64
encode for the HyBi protocol. This will allow noVNC to request the
binary data be passed raw and not base64 encoded. Unfortunately, the
client doesn't speak first in VNC protocol (bad original design). If
it did then we could determine whether to base64 encode or not based
on the first HyBi frame from the client and whether the binary bit is
set or not. Oh well.

Misc Cleanup:

- Always free response and buf in handshake routine.

- Remove some unused variables.
15 years ago
Gernot Tenchio 099e5c8251 websockets: Removed debugging left over 15 years ago
Gernot Tenchio 72b18fdfb7 websockets: Use callback functions for encode/decode 15 years ago
Gernot Tenchio 55234a37fd websockets: Move Hixie disconnect hack to websockets.c
Move the hixie disconnect hack to websockets.c. Removed
the remaining websockets vars from rfbClientPtr, so all
websockets stuff is hidden behind an opaque pointer.
15 years ago
Gernot Tenchio 1408866c86 websockets: Initial HyBi support 15 years ago
Gernot Tenchio 297072a691 websockets: Add wspath member to rfbClientRec
Added wspath member to rfbClientRec which holds the
path component of the initial websocket request.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
15 years ago
Gernot Tenchio 4aa3586367 websockets: Add encryption support
[jes: moved out GnuTLS and OpenSSL support, added a dummy support, to
separate changes better, and to keep things compiling]

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
15 years ago
Joel Martin 7a77cc32b2 websockets: Properly parse Hixie-76 handshake.
Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
15 years ago
Joel Martin 430b8f2449 websockets: Add UTF-8 encoding support.
This is not completely standard UTF-8 encoding. Only code points 0-255
are encoded and never encoded to more than two octets. Since '\x00' is
a WebSockets framing character, it's easier for all parties to encode
zero as '\xc4\x80', i.e. 194+128, i.e. UTF-8 256.

This means that a random stream will be slightly more than 50% larger
using this encoding scheme. But it's easy CPU-wise for client and
server to decode/encode. This is especially important for clients
written in languages that have weak bitops, like Javascript (i.e. the
noVNC client).

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
15 years ago
Joel Martin 6fac22a74b websockets: Initial WebSockets support.
Has a bug: WebSocket client disconnects are not detected.
rfbSendFramebufferUpdate is doing a MSG_PEEK recv to determine if
enough data is available which prevents a disconnect from being
detected.

Otherwise it's working pretty well.

[jes: moved added struct members to the end for binary compatibility with
previous LibVNCServer versions, removed an unused variable]

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
15 years ago