Commit Graph

431 Commits

Author SHA1 Message Date
Joel Martin 6748098152 Reference VNCAuthProxy in implementation list. 2011-09-29 16:15:15 -05:00
Joel Martin 724aa3aca0 HyBi fallback when no numpy. Python 3 close fix.
- Use array module for unmasking HyBi when no numpy module is
  available.

- Detect client close properly when using python 3.

- Print request URL path is specified.
2011-09-29 16:08:28 -05:00
Joel Martin 0f8b7580c6 Put include/util.js above include/websock.js.
websock.js uses Util so it needs to included first.
2011-09-23 12:09:16 -05:00
Joel Martin 636aba62ed Add --run-once and --timeout TIME parameters.
- --run-once will exit after handling a single WebSocket connection
  (but not ater flash policy or normal web requests).

- --timeout TIME will stop listening for new connections after exit
  after TIME seconds (the master process shuts down). Existing
  WebSocket connections will continue but once all connections are
  closed all processes will terminate.
2011-09-22 15:52:02 -05:00
Joel Martin 1c39c7f1f0 Fix python3 numpy buffer/string issue.
Simpler fix for this issue:
https://github.com/kanaka/websockify/pull/9

Use consistent string/byte type for HyBi decode with numpy.
2011-09-10 15:57:08 -05:00
Joel Martin 6e263063c2 Support HyBi 13.
Minor change to handshake (Sec-WebSocket-Origin renamed to Origin).

Reported version is 13 (bumped up from 8).
2011-08-31 18:05:03 -05:00
Joel Martin ada02f2c03 websocket.py: silence "Partial unmask" debug. 2011-08-31 15:36:36 -05:00
Joel Martin 0da91c7fdb Fix payload length off-by-one calculation. 2011-08-31 12:40:00 -05:00
Joel Martin 86af0b614d Fix HyBi support on 64-bit systems.
https://github.com/kanaka/noVNC/issues/76

- cleanup/update TODO.
- remove explicit check for ctypes module for HyBi.
2011-08-24 13:23:15 -05:00
Joel Martin 2e00f96431 Fix for python 2.4
Use rsplit(':', 1) instead of rpartition(':') in port argument
processing.

python2.4 may or may not work with HyBi which requires the numpy and
ctypes modules.
2011-08-10 17:48:33 -05:00
Joel Martin 4a84ab3777 More fighting with formating. 2011-08-04 11:13:28 -05:00
Joel Martin 1f7a87ecee Grr, links can't be in table fields apparently. 2011-08-04 11:12:57 -05:00
Joel Martin 7b496ce5bc Clarify that we support HyBi 07-10.
HyBi 07 reports version 7 in the handshake.
HyBi 08-10 report version 8 in the handshake.

Remove version 9 since that is not yet actually defined.
2011-08-04 11:09:12 -05:00
Joel Martin 475cfae4e5 Catch Mozilla prefixing of WebSocket.
In Firefox 7 Mozilla has added Websockets support but prefixed the
constructor with "Moz".
2011-08-02 07:59:37 -05:00
Joel Martin f1c8223a51 websocket.py: show web root, remove execute perm. 2011-07-14 15:55:26 -05:00
Joel Martin 80e1c38dd5 README: session recording no longer broken. 2011-07-14 12:32:06 -05:00
Joel Martin 6d5a137970 README: cleanup. 2011-07-14 12:30:07 -05:00
Joel Martin 6a7b56d56f READMEs: kumina features, clarifications. 2011-07-14 12:27:04 -05:00
Joel Martin 108b617eef Note kumina license, and link to kumina blog post.
Ed Schouten blog article:
http://blog.kumina.nl/2011/06/proxying-and-multiplexing-novnc-using-wsproxy/

Also, clarify external code licenses.
2011-07-13 13:01:03 -05:00
Joel Martin 9c2a41fe0e Merge commit 'kumina/master'
Conflicts:

	wsproxy.c

Conflicts:
	.gitignore
	Makefile
	README.md
2011-07-11 19:14:11 -05:00
Joel Martin 46e2fbee5f Replace addrinfo with socket() static method.
WebSocketServer.socket() is a static method takes a host and port and
an optional connect parameter. If connect is not set then it returns
a socket listening on host and port. If connect is set then
a connection will be made host and port and the socket returned. This
has IPv6 support like the addrinfo method it replaces.

Also, prefer IPv4 resolutions if they are in the list. This can be
overriden to prefer IPv6 resolutions for the same host using the
optional prefer_ipv6 parameter.
2011-07-09 13:34:53 -05:00
Joel Martin 7ae8711dc6 IPv6 and HyBi fixes.
- fix addrinfo to accept empty host as localhost

- use correct host variable in addrinfo error message

- accept HyBi 7, 8 and 9. No difference for now.

- send close buffer correctly.
2011-07-07 15:13:02 -05:00
Joel Martin 247b74950d Minor cleanup of IPv6 support code.
- Use self for static method call.

- Remove extraneous spaces.
2011-07-07 11:45:19 -05:00
Joel Martin e11012437a Merge pull request #5 from desaintmartin/master
Add support for IPv6
2011-07-07 09:19:46 -07:00
Ed Schouten d0e1fe6a3c Remove a faulty attribution from the Copyright.
The Copyright notice was copied from another source file, where I only
changed the Copyright line at the top.
2011-06-29 23:48:15 +02:00
Joel Martin 367ebb5597 Reformat feature table for readability/expansion. 2011-06-29 10:53:13 -05:00
Ed Schouten 8039dddced Add monitoring support to wsproxy. 2011-06-29 11:07:31 +02:00
Vivien Alger 78697b9663 Added static method addrinfo() 2011-06-29 10:19:52 +02:00
Joel Martin b590289de5 Remove extraneous question mark.
Part of https://github.com/kanaka/noVNC/issues/69
2011-06-28 16:28:42 -05:00
Joel Martin 9a2b50d80b Only append random string to swf path in IE.
Issue https://github.com/kanaka/noVNC/issues/69

Thanks https://github.com/EdSchouten for the catch.
2011-06-28 16:21:15 -05:00
Ed Schouten 306eab28da Add README. 2011-06-28 16:41:31 +02:00
Ed Schouten 7057e31fa0 Add support for Flash headers. This makes wsproxy work with Firefox. 2011-06-28 15:41:06 +02:00
Ed Schouten 631c5990f7 Remove all casting from the sockaddr code. 2011-06-28 12:20:21 +02:00
Ed Schouten d97d1b72d7 Add copy of strndup() for Lenny. 2011-06-28 12:11:35 +02:00
Ed Schouten c42612643a Add Debian package infrastructure and license. 2011-06-28 12:05:50 +02:00
Ed Schouten 52b07abe21 Prevent division by zero. 2011-06-28 11:46:59 +02:00
Ed Schouten 2aa2376e3a Add initial version of wsproxy source code. 2011-06-28 11:44:35 +02:00
Algervivien 30681a7018 Use of socket.getaddrinfo() to replace ipv6 attributes. Corrected error with ssl-only option 2011-06-27 18:49:01 +02:00
Algervivien 077279fe0f Refactoring of parsing 2011-06-27 17:07:29 +02:00
Algervivien eb62b2af6e Added data attributes and ipv6 condition for target 2011-06-27 11:01:01 +02:00
Algervivien a09d18b234 Added ipv6 related attributes 2011-06-27 10:21:20 +02:00
Algervivien 8d71c243b1 Modified parsing for ipv6 support 2011-06-27 09:45:49 +02:00
Joel Martin 7f487fdbd5 Fix recording, generic and part of websocket.py.
WebSocketServer(...,  record='FILE_PREFIX')

The reocrd parameter will turn on recording of all messages sent
to and from the client. The record parameter is a file prefix. The
full file-name will be the prefix with an extension '.HANDLER_ID'
based on the handler ID.

Recording required some restructing of the encode and decode function
to return more information so that the recording functions can record
just the payload data and ignore the WebSockets framing/headers.

Caveats:
- Not all messages recorded as sent to the client were necessarily
  received by the client. For example, if several messages are queued
  for the client, but the connection is shutdown before the messages
  are actually sent, these queued messages will still appear in the
  recording.
- If the server is also handling HTTP requests then the handler ID
  extensions for the recorded files will be monotonic but not
  contiguous because only WebSocket connections are recorded, not HTTP
  requests.
2011-06-26 13:55:52 -05:00
Joel Martin d91d89167f Do socket shutdown() of target before close(). 2011-06-26 13:26:59 -05:00
Algervivien 8ae73adbb7 Corrected wrong INET type in else condition 2011-06-24 19:01:47 +02:00
Cédric de Saint Martin d473f4b6d1 Use ipv6 socket when requested 2011-06-24 18:30:11 +02:00
Joel Martin c659bcb79e Refactor optional imports, make 'resource' optional.
Ticket #2: https://github.com/kanaka/websockify/issues/2 - win32
support. The 'resource' module is not available under Windows. We only
use it for daemonizing so make it optional and disable daemonizing
support on Windows for now.

Also, refactor how the optional imports to turn them into data instead
of code and iterate through them.

Add early warnings to indicate when modules are missing and
functionality is disabled.
2011-05-18 15:52:39 -05:00
Joel Martin c8587115bc Python 3.0 support. Use multiprocessing module.
Multiprocessing:
- Switch to using multiprocessing module for python >= 2.6. For python
  2.4 continue to use the os.fork() method.
- Move the new_client creation into top_new_client method to enable
  multiprocessing refactor.
- Only do SIGCHLD handling for os.fork/python 2.4. When doing our own
  SIGCHLD handling under python 3.0, we can run into a python futex
  hang when reloading a web page rapidly. Multiprocessing does it's
  own child reaping so we only need it with os.fork().

Python 3.0:
- Modify imports to reflect new locations: StringIO from io,
  SimpleHTTPRequestHandler from http.server, urlsplit from
  urllib.parse.
- Convert all print statements to print() calls. This also means no
  comma parameter idiom and only using string formatting.
- Define b2s (bytes-to-string) and s2b (string-to-bytes) which are
  no-ops on python versions prior to python 3. In python 3 these do
  the conversion between string and bytes.
- Use compatible try/except method. Exception variable must be
  extracted using sys.exc_info() rather than as part of the except
  statement.

Python 2.4:
- Now degrades more gracefully if ssl module is not found. It will
  still run, but will refuse SSL connections.
- Doesn't support HyBi-07 version due to numpy and struct.unpack_from
  requirement.
2011-05-18 11:09:10 -05:00
Joel Martin 85f84ef280 Refactor HTTP request/upgrade handling.
Instead of doing crazy things with file-descriptors in
SplitHTTPHandler, WSRequestHandler detects a WebSockets upgrade and
returns 101 as the 'last_code'. In addition to avoiding funkiness with
file-descriptors, this allows use of the already parsed headers and
removal of the parse_handshake routine.

This also makes it easier to explore adding python 3.X support
(https://github.com/kanaka/websockify/issues/1) since the
file-descriptor/string splitting is very difficult to integrate with
python 3.X.
2011-05-17 12:08:30 -05:00
Joel Martin 284ef3cc1a Send 'base64' sub-protocol. JSLint.
- Also report back sub-protocol that the server chooses.
2011-05-11 15:14:46 -05:00