Commit Graph

426 Commits

Author SHA1 Message Date
Joel Martin ef764d3b9b Support for RFB 3.8 handshake. 2010-05-02 14:19:13 -05:00
Joel Martin 5aca52e18d Cleanup. Move note files into docs/. 2010-05-01 15:59:52 -05:00
Joel Martin adfe6ac166 Support for SSL/TLS ('wss://') on both sides.
On the client side, this adds the as3crypto library to web-socket-js
so that the WebSocket 'wss://' scheme is supported which is WebSocket
over SSL/TLS.

Couple of downsides to the fall-back method:

    - This balloons the size of the web-socket-js object from about 12K to 172K.

    - Getting it working required disabling RFC2718 web proxy support
      in web-socket-js.

    - It makes the web-socket-js fallback even slower with the
      encryption overhead.

The server side (wsproxy.py) uses python SSL support. The proxy
automatically detects the type of incoming connection whether flash
policy request, SSL/TLS handshake ('wss://') or plain socket
('ws://').

Also added a check-box to the web page to enable/disabled 'wss://'
encryption.
2010-04-30 16:41:09 -05:00
Joel Martin ca5785f570 Automatically detect TLS/SSL during handshake.
Use MSG_PEEK flag on recv to detect whether we are getting a flash
policy request, an SSL/TLS header, or a plain socket connection.
2010-04-30 16:00:12 -05:00
Joel Martin 0e486e1ba0 Import as3crypto_patch: ffda6e9cd8b1d74f45472c676afda8360ae1e5aa
as3crypto is actionscript 3 crypto library with TLS engine support.

From: http://github.com/lyokato/as3crypto_patched

Which was forked from: http://code.google.com/p/as3crypto/
2010-04-30 14:13:32 -05:00
Joel Martin 7b99f70bd0 Don't erase failed state error messages on disconnect. 2010-04-19 10:46:48 -05:00
Joel Martin 0166284a64 Also send errors to console.error 2010-04-19 10:43:21 -05:00
Joel Martin 1e633bc8ee wstest*. Fix Opera problems. Flash policy. Misc bugs.
Lame. Opera doesn't support javascript reduce().

Also, Opera seems to just plain be pathetic when it comes to
delivering the web-socket-js events. Around 1/5 to 1/3 of all received
packets are never received as an event at all.

- Change default delay for send side to 10ms.

- Use a textarea for errors so that even without console.* support
  (ala firebug) we still see the errors that are happening.
2010-04-19 10:41:06 -05:00
Joel Martin 9e12c1a941 README.md typo and clarify. 2010-04-18 20:57:34 -05:00
Joel Martin 1626e0f8f8 Update README.md and TODO. 2010-04-18 20:53:54 -05:00
Joel Martin 07287cfd89 Send seq nums and b64 encode based on query string.
Query string variable 'b64encode' determine if wsproxy b64 encodes the
results. Variable 'seq_num' determines if sequence numbers are
prepended. This way, sequence numbers are only used with the flash
WebSocket proxy.
2010-04-18 20:35:43 -05:00
Joel Martin 8759ea6f90 Status/error refactor. Fix firefox bugs.
- All state/status updates go through updateState routine which
  updates the status line also.

- Old firefox (and opera) don't support canvas createImageData, so use
  getImageData as replacement.

- Add console.warn and console.error stubs so that firefox without
  firebug doesn't crap out.

- If no WebSockets then error if no flash or if URL is location (flash
  will refuse to load the object for security reasons).
2010-04-18 18:43:03 -05:00
Joel Martin 07f6ca751d Remove mootools-more references. 2010-04-18 16:28:54 -05:00
Joel Martin 9fec75c08f Fix firefox '-' key mapping. 2010-04-18 16:19:10 -05:00
Joel Martin d1616107c3 Add fixing firefox '-' key mapping issue to TODO. 2010-04-18 16:17:27 -05:00
Joel Martin 10ae1427f8 Handle socket policy response in proxy itself. 2010-04-17 17:53:28 -05:00
Joel Martin 5d8e7ec068 Add web-socket-js support with packet re-ordering.
- web-socket-js is from http://github.com/gimite/web-socket-js. It is
  a flash object that emultates WebSockets.

Unfortunately, events (or packets) from the web-socket-js object can
get re-ordered so we need to know the packet order.

- So wsproxy.py prepends the sequence number of the packet when
  sending.

- If the client receives packets out of order it queues them up and
  scans the queue for the sequence number it's looking for until
  things are back on track. Gross, but hey: It works!

- Also, add packet sequence checking to wstest.*
2010-04-17 17:24:14 -05:00
Joel Martin d920595453 Import web-socket-js: a0fb3933ce5c824bcb882f5a1cf87e46de773ea8
web-socket-js is a flash based WebSockets emulator.

From: http://github.com/gimite/web-socket-js
2010-04-17 17:23:31 -05:00
Joel Martin 5d2c386400 Reassemble partial client packets in wsproxy.py 2010-04-16 16:34:19 -05:00
Joel Martin af7a319387 Assemble partial received frames.
Apparently both native and flash WebSockets implementations can send
partial packets.
2010-04-16 15:53:59 -05:00
Joel Martin 89fbd66fa9 Add WebSockets test frontend and backend. 2010-04-16 13:58:08 -05:00
Joel Martin 14b665f1da Remove uneeded mootools functions and used compressed version. 2010-04-15 12:28:53 -05:00
Joel Martin 7345dba44c Clarify DES code origination. 2010-04-15 11:14:42 -05:00
Joel Martin b5537b60b0 Switch to MPL/GPL base64 from Mozilla.
- Also slightly better performance.
2010-04-15 11:01:40 -05:00
Joel Martin 1a623f7502 Update TODO and small perf cleanups. 2010-04-15 10:16:30 -05:00
Joel Martin 30059bdf24 Add cut and paste support.
- A textarea below the VNC area represents the state of the current
  VNC clipboard. If there is a server cut event, the textarea will be
  updated. If the user updates the contents of the textarea, the new
  data will be sent as a client paste (cut) event.

- One important change was to detect if the clipboard is focused and
  allow the user to type in the clipboard instead of in the VNC area.
2010-04-15 01:40:03 -05:00
Joel Martin 66a529d70a In TODO: RRE framing bug fixed in prev refactor. 2010-04-14 23:42:38 -05:00
Joel Martin 1098b5bf01 Refactor FBU.bytes handling to simplify.
- raw encoding displays horizontal lines as they arrive for better
  feedback and less time hanging waiting for something.
2010-04-14 23:41:12 -05:00
Joel Martin 6321aff0cf stop routine stops mouseMove events too. 2010-04-14 23:40:29 -05:00
Joel Martin 9e5065ab83 Note WSS/SSL and C wsproxy in TODO. 2010-04-14 13:33:27 -05:00
Joel Martin 503c6c5be9 Add TODO. 2010-04-14 13:03:18 -05:00
Joel Martin 8cf206154c Working VNC client! Add mouse movement support.
- Mouse movements are accumulated and sent about 5 times a second.
- Normal polling happens at about 1.5 seconds intervals.

This commit represents a very functional VNC client under Google
Chrome.

Remaining work:

    - Cut and paste support.

    - Framing bugs when using RRE encoding.

    - Better status and error feedback.

    - Get working in firefox using flash web-socket-js:
        http://github.com/gimite/web-socket-js

    - Version without mootools (but test cross-browser).
2010-04-14 12:44:47 -05:00
Joel Martin 48ebcdb110 Rename canvas.js routines to not have "rfb" prefix.
- Also, try making set fillStyle called less often.
2010-04-14 12:22:47 -05:00
Joel Martin 31af85b996 Don't clear canvas if debug mode 2010-04-14 12:13:59 -05:00
Joel Martin 28a5f29357 Re-order routines, no functional changes. 2010-04-14 12:10:23 -05:00
Joel Martin fb99d81ccc Better hextile performance: index subrects instead of slicing/shifting.
- Many times better performance. Before this, browser was spending all
  it's time garbage collecting or doing something. Now the bottleneck
  is in set fillStyle and fillRect which is probably where it should
  be.
2010-04-14 12:03:01 -05:00
Joel Martin 410960bac8 Fix some framing bugs. Cleanup console logs. 2010-04-14 11:28:29 -05:00
Joel Martin 484a4696aa Refactor data processing. Ignore other server messages.
- Refactor to pull off all the data received into RFB.d array and then
  process it. This allows a bit more flexibility in handling
  data that isn't sent in frame boundary packets.

- Properly ignore these server messages: SetColourMapEntries, Bell,
  ServerCutText.
2010-04-14 09:48:46 -05:00
Joel Martin d064769ccf Initial mouse support. Down and Up only. 2010-04-13 17:39:01 -05:00
Joel Martin 9f4af5a722 Hextile working. Improve latency by coallescing sends.
- Hextile has an undocumented weirdness where RAW frames are often
  followed by a 0 byte that should be ignored.

- Coallesce client messages that are one after another. Without
  this the server seems to often ignore frames that are send right
  after another frame has been sent. This fixes a reconnect issue
  where setEncodings seems to be ignored. Also results in a huge
  performance increase after key strokes (by adding a update request
  to the key event message) because the server always sends an update
  instead of sometimes waiting for the next poll to be sent.
2010-04-13 12:59:11 -05:00
Joel Martin 2bcb2d5b15 Remove event handlers on disconnect. 2010-04-13 09:39:29 -05:00
Joel Martin b7ec54870a Switch to much faster console.log and separate utils into util.js. 2010-04-13 09:28:53 -05:00
Joel Martin 0f62806499 Refactor processing to allow hextile processing.
With hextile you can't know how many bytes are pending. So restructure
so that all the received data so far is passed to the processsing
routines.
2010-04-12 13:21:44 -05:00
Joel Martin f761808540 Process RRE in chunks instead of 1 at a time. 2010-04-12 11:46:43 -05:00
Joel Martin cf67217cbf Change to RGB ordering. 2010-04-12 11:21:03 -05:00
Joel Martin 6dab56f914 Working RRE implementation. 2010-04-12 11:08:40 -05:00
Joel Martin ed7e776db2 First pass at RRE encoding 2010-04-11 23:11:21 -05:00
Joel Martin d628147bca WebWorkers example with two way messages.
- Prime number background worker that can be started, stopped and
  reset that calculates prime numbers and sends them back to the main
  page/thread.
2010-04-10 15:52:27 -04:00
Joel Martin 85b7a7d411 Handle undefined URL values correctly. 2010-04-10 15:52:08 -04:00
Joel Martin 4b835baeb9 Change depth to count down correctly. Trim long lines. 2010-04-10 12:00:35 -04:00