Commit Graph

210 Commits

Author SHA1 Message Date
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
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 88b71ce171 Refactor and add IETF-07 protocol version support.
- Add initial IETF-07 (HyBi-07) protocol version support. This version
  still uses base64 encoding since the API for binary support is not
  yet finalized.

- Move socket send and recieve functions into the WebSocketServer
  class instead of having the sub-class do this. This simplifies
  sub-classes somewhat. The send_frame routine now returns the number
  of frames that were unable to be sent. If this value is non-zero
  then the sub-class should call again when the socket is ready until
  the pending frames count is 0.

- Do traffic reporting in the main class instead.

- When the client is HyBi style (i.e. IETF-07) then use the
  sub-protocol header to select whether to do base64 encoding or
  simply send the frame data raw (binary). Update include/websock.js
  to send a 'base64' protocol selector. Once the API support binary,
  then the client will need to detect this and set the protocol to
  'binary'.
2011-05-01 22:17:04 -05:00
Joel Martin 8765971e06 Use /usr/bin/env shebang to make more crossplatform.
Based on noVNC pull request from Decorum.
2011-03-26 15:27:08 -05:00
Joel Martin 9c4cf4ada2 Do not hang on non-ready client connection.
Wait 3 seconds for the client to send something. If no data is
available within 3 seconds then close the connection. It's probably
a non-WebSockets client that is waiting for the server to say
something first.
2011-01-13 12:22:22 -06:00
Joel Martin 6d1e216115 fork noVNC, rename to websockify, cleanup.
Split of wsproxy from noVNC and rename it websockify.
2011-01-12 18:09:54 -06:00
Renamed from utils/wsproxy.py (Browse further)