Commit Graph

159 Commits

Author SHA1 Message Date
Joel Martin a93c955538 Opera works! Fix message event drops/reorders.
Instead of relying on FABridge AS -> JS event delivery, we just use
the events to notify JS of pending data. The message handler then
calls the AS readSocketData routine which sends back an array of
the pending WebSocket frames.

There is still a minor bug somewhere that happens after the first
connect where the web-socket-js throws an "INVALID_STATE_ERR: Web
Socket connection has not been established". But, Opera is now usable
and we should be able to drop the packet sequence numbering and
re-ordering code.

Another minor issue to better support Opera is to move JS script
includes to the <head> of the page instead of after the body.
2010-07-01 09:53:38 -05:00
Joel Martin 5235b29ddf Significant firefox perf improvement. Update TODOs.
Interesting. Enough has changed in the Canvas tile operations, that
Canvas.prefer_js=true is better for firefox/gecko too. Approximately
2X improvement in firefox for large hextile renders.
2010-06-29 14:36:18 -05:00
Joel Martin dfa8db8f38 Fix issue #7: security scheme list parsing.
Also, lower connect timeout to 2 seconds.
2010-06-26 17:41:39 -05:00
Joel Martin 48eed1ac05 Refactor canvas imageData test slightly. 2010-06-24 17:09:54 -05:00
Joel Martin 486cd527f2 Support WebSockets 76 (hixie-76, hybi-00).
Looks like disabling web-socket-js debug messages by default that we
get a minor speedup.

Python proxy should support both 75 and 76 (00) modes. Also, update ws
test to more reliably hit the WebSockets ordering/drop issue.
2010-06-24 17:04:57 -05:00
Joel Martin 7dfa20b8fd Remove invalid pos check from web-socket-js. 2010-06-24 17:01:58 -05:00
Joel Martin 094b489b76 Missed change web-socket-js to dd80a1807758abfab4a0fde840f94c5d649e4a24. 2010-06-24 17:00:41 -05:00
Joel Martin 2ddd6214a5 Add web-socket-js debug flag and default to off. 2010-06-24 16:59:53 -05:00
Joel Martin 76053e2bae Squelch MD5.as build warnings. 2010-06-24 16:58:24 -05:00
Joel Martin 35f5b11ce5 Update gimite/web-socket-js to dd80a1807758abfab4a0fde840f94c5d649e4a24 2010-06-24 12:42:34 -05:00
Joel Martin d93d3e09ab Various cross-browser fixes.
Now working under Arora 0.5.

But not Konqueror 4.2.2 (WebSockets never connects).

IE support with excanvas still pending.
2010-06-23 16:08:36 -05:00
Joel Martin 11bb7a4ae4 Fix browser detection code in IE. 2010-06-21 16:30:32 -05:00
Joel Martin 3915e5365e Update README.md with browser support. 2010-06-21 13:20:57 -05:00
Joel Martin 3b7575b219 Better support console debug under Opera (DragonFly). 2010-06-20 15:10:34 -05:00
Joel Martin 2a4e7d8a93 Timeout connection. 2010-06-18 15:18:41 -05:00
Joel Martin f755ca9631 Remove debug sendCtrlC function. 2010-06-16 09:48:49 -05:00
Joel Martin 160fabf65c Disabled ctrlAltDel button when N/A. 2010-06-15 17:56:38 -05:00
Joel Martin 63708ff5a8 Add CtrlAltDel send button to status bar.
Some default_controls.js jslinting.

Needs to be some modularity between controls you probably always want
(like sending CtrlAltDel) and how the interface is presented and
controlled.
2010-06-15 17:47:01 -05:00
Joel Martin 15046f0042 No mootools dep outside of default_controls.js.
Some basic functions from mootools implemented in util.js.

Also, some more DOM separation. Move clipboard focus logic into
default_controls and canvas and out of vnc.js.

JSLint cleanup.
2010-06-15 15:21:41 -05:00
Joel Martin 61dd52c983 Add mouse position routines to util.js.
On path towards removing dependency on mootools in non-UI code.
2010-06-15 11:10:18 -05:00
Joel Martin e2e7c22494 Move DOM event handling from vnc.js to canvas.js. 2010-06-15 09:36:23 -05:00
Joel Martin 96a6eaadbc Move vnc.js into include directory.
Also, allow 'include/' to be overridden in VNC_uri_prefix.
2010-06-14 14:56:19 -05:00
Joel Martin 30e5396326 Less debug output. 2010-06-14 14:42:34 -05:00
Joel Martin 3954ae149a Fix mouse focus issues. 2010-06-13 10:57:23 -05:00
Joel Martin 888d5813ed Fix scrolled mouse position. 2010-06-10 16:05:15 -05:00
Joel Martin 4b4496ad67 DesktopResize and compression level pseudo-encodings.
- Implement resizing of desktop pseudo-encoding.

- Also send lowest (fastest) compression level pseudo-encoding.
  Ought be user tweakable.
2010-06-10 15:44:42 -05:00
Joel Martin 2e041cf225 Fix Alt keysym.
From kevinychan/vnc-html5 ebfffdc36.
2010-06-03 09:28:44 -05:00
Joel Martin 913083993b Direct example. Move all DOM code default_controls.js.
Move DOM manipulation into include/default_controls.js and update
vnc.html to use it.

Add an example vnc_auto.html which automatically connects using
parameters from the query string and doesn't use default_controls.js.

Reorder functions in vnc.js to put external interface functions at the
top of the RFB namespace.
2010-06-02 17:08:25 -05:00
Joel Martin d41c33e4b7 Add colour map support (non-true-color).
In colourMap mode there are 256 colours in a colour palette sent from
the server via the SetColourMapEntries message. This reduces the
bandwidth by about 1/4. However, appearance can be somewhat less than
ideal (pinks instead of gray, etc).

It also increases client side rendering performance especially on
firefox. Rendering a full 800x600 update takes about 950ms in
firefox on my system compared to about 1400ms. Round-trip time for
a full frame buffer update is even better on firefox (due to
performance of the flash WebSocket emulator). Reduced from about
1800ms to 1100ms on firefox (for 800x600 full update).
2010-06-01 14:34:27 -05:00
Joel Martin 507b473a2e Test non-base64 (straight UTF-8) encoding.
Also add a wsencoding test client/server program to test send a set of
values between client and server and vice-versa to test encodings.

Not turned on by default.

Add support for encode/decode of UTF-8 in the proxy. This leverages
the browser for decoding the WebSocket stream directly instead of
doing base64 decode in the browser itself.

Unfortunately, in Chrome this has negligible impact (round-trip time
is increased slightly likely due to extra python processing).

In firefox, due to the use of the flash WebSocket emulator the
performance is even worse. This is because it's really annoying to get
the flash WebSocket emulator to properly decode a UTF-8 bytestream.
The problem is that the readUTFBytes and readMultiByte methods of an
ActionScript ByteArray don't treat 0x00 correctly. They return
a string that ends at the first 0x00, but the index into the ByteArray
has been advanced by however much you requested.

This is very silly for two reasons: ActionScript (and Javascript)
strings can contain 0x00 (they are not null terminated) and second,
UTF-8 can legitimately contain 0x00 values. Since UTF-8 is not
constant width there isn't a great way to determine if those methods
in fact did encounter a 0x00 or they just read the number of bytes
requested.

Doing manual decoding using readUTFByte one character at a time slows
things down quite a bit. And to top it all off, those methods don't
support the alternate UTF-8 encoding for 0x00 ("\xc0\x80"). They also
just treat that encoding as the end of string too.

So to get around this, for now I'm encoding zero as 256 ("\xc4\x80")
and then doing mod 256 in Javascript. Still doesn't result in much
benefit in firefox.

But, it's an interesting approach that could use some more exploration
so I'm leaving in the code in both places.
2010-05-28 15:39:38 -05:00
Joel Martin d38406e6b5 Fix web-socket-js: encode sent data across FABridge. 2010-05-28 15:34:54 -05:00
Joel Martin af6b17ce06 Change license to LGPL-3 and add some implementation notes.
The purpose of the code is to be incorporated into other web projects
(whether those are free or not). AGPL prevents combination with other
HTML and javascript that is under a weaker (or proprietary) license.
Better would be a lesser AGPL, but there is not GNU standard for that.
So LGPL-3 meets most of my requirements. If somebody modifies the
actual client code and conveys it, then they must release the changes
under LGPL-3 also.

Add some implementation notes in docs/notes.
2010-05-26 15:43:00 -05:00
Joel Martin a575a383fb Add mouse wheel support and input test page. 2010-05-25 11:05:55 -05:00
Joel Martin 7f4f41b0c7 Don't shift off subencoding in hextile. 2010-05-20 17:13:59 -05:00
Joel Martin 8fe2c2f915 Fix web-socket-js loading issue. 2010-05-17 17:11:13 -05:00
Joel Martin 97763d0eb8 Double Chrome hextile perf again. Add canvas test.
- By dereferencing the 'data' field of the imageData object before the
  loop, the hextile performance on Chrome is down to 140ms or so for
  a full 800x600 update. Still have to fall back to Canvas operations
  for firefox.

- Fix RQ empty after reorder bug.
2010-05-17 13:07:53 -05:00
Joel Martin 3c1bead9a0 Add styling classes for status line state. 2010-05-16 19:58:51 -05:00
Joel Martin af180155a8 Create FABridge tester. Move wstest into tests subdir. 2010-05-16 19:21:21 -05:00
Joel Martin f9583f1f98 Move canvas.js to include/canvas.js. 2010-05-15 15:45:09 -05:00
Joel Martin 56ec48bec8 Move vars into RFB namespace. Extend array in util.js. 2010-05-15 14:55:33 -05:00
Joel Martin 3a5ddcf737 Pull and modify stylesheet from kevinykchan/vnc-html5.
Pull and modify vnc.css version
b747e284c0e417df1599b1d95724518b07be8df6 to include/black.css
2010-05-11 16:58:36 -05:00
Joel Martin db504ade0c Isolate DOM references in load() and connect().
- Other misc cleanups.
2010-05-11 16:39:17 -05:00
Joel Martin ded9dfae10 Styling/integration refactoring.
- Instead of onload override, move to RFB.load function that takes
  a parameter for the target DOM ID. This allows the user to have
  their own onload function.

- Add "VNC_" prefix to all element ID names. Only create DOM elements
  if they don't already exist on the page, otherwise use the existing
  elements.

- Move all styling to separate stylesheet.

- Use list model for control styling.
2010-05-11 16:13:52 -05:00
Joel Martin c539e4dcda DES that works with KVM's VNC. RFB 3.8 fixes. 2010-05-05 15:40:05 -05:00
Joel Martin ef764d3b9b Support for RFB 3.8 handshake. 2010-05-02 14:19:13 -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 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 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 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 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 b7ec54870a Switch to much faster console.log and separate utils into util.js. 2010-04-13 09:28:53 -05:00
Joel Martin cc0410a39b Cleanup of files and vnc.js namespace.
- Trim unused code in base64.js
2010-04-06 16:44:45 -05:00
Joel Martin 8580b98979 Got DES encryption of password working and colors corrected.
- DES encryption for VNC bit mirrors every bytes of the password. This
  commit has a hard-coded mirrored password. Need to ask user and bit
  mirror it.

- With image data across the wire it's Blue,Green,Red, so twiddle
  things around a bit.
2010-04-06 10:35:25 -05:00
Joel Martin a793fa460f Base64 Javascript encode/decode library.
From http://www.webtoolkit.info/
2010-04-02 19:17:01 -05:00
Joel Martin 8b945f2a94 Add RFB specs and move *.js files into include/ 2010-03-31 19:43:09 -05:00