dart-lang / sdk

The Dart SDK, including the VM, JS and Wasm compilers, analysis, core libraries, and more.
https://dart.dev
BSD 3-Clause "New" or "Revised" License
10.21k stars 1.57k forks source link

Add compression to dart:io WebSockets #14441

Closed sgjesse closed 8 years ago

sgjesse commented 10 years ago

There is a draft for compression frames: https://tools.ietf.org/id/draft-tyoshino-hybi-websocket-perframe-deflate-05.txt.

WebKit currently implements some draft of this, and advertises it as:

Sec-WebSocket-Extensions:x-webkit-deflate-frame

floitschG commented 10 years ago

Added Triaged label.

kevmoo commented 10 years ago

Removed Area-IO label. Added Library-IO, Area-Library labels.

kasperl commented 10 years ago

Removed this from the Later milestone. Added Oldschool-Milestone-Later label.

kasperl commented 10 years ago

Removed Oldschool-Milestone-Later label.

sethladd commented 9 years ago

We met with a customer today who asked for WebSocket compression. Useful in an Internet of Things scenario.


Removed Priority-Low label. Added Priority-Medium label.

sgjesse commented 9 years ago

The specification is now on the standards track: https://tools.ietf.org/html/draft-ietf-hybi-permessage-compression-19.

Chrome 40 advertises support in the headers (using attached test program), and Firefox 35 does not.

Chrome 40 headers:

user-agent: Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/40.0.2214.111 Safari/537.36 connection: Upgrade cache-control: no-cache accept-language: en-US,en;q=0.8,da;q=0.6 accept-encoding: gzip, deflate, sdch origin: http://localhost:8000 sec-websocket-version: 13 host: localhost:8000 sec-websocket-extensions: permessage-deflate; client_max_window_bits pragma: no-cache sec-websocket-key: F5XDg2hXWRf43AVF9wh1Xg== upgrade: websocket

Firefox 35 headers:

user-agent: Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:35.0) Gecko/20100101 Firefox/35.0 connection: keep-alive, Upgrade cache-control: no-cache accept: text/html,application/xhtml+xml,application/xml;q=0.9,/;q=0.8 accept-language: en-US,en;q=0.5 accept-encoding: gzip, deflate origin: http://localhost:8000 sec-websocket-version: 13 host: localhost:8000 pragma: no-cache sec-websocket-key: PfPVtFH1ixCW/5SrSWYL7g== upgrade: websocket


Attachment: websocket_server.dart (2.20 KB)

rinick commented 9 years ago

It's already implemented in Firefox nightly version (39.0) https://bugzilla.mozilla.org/show_bug.cgi?id=792831

Can we fast-track the Dart implementation?

sethladd commented 9 years ago

Removed Priority-Medium label. Added Priority-High label.

sethladd commented 9 years ago

Added C13 label.

sethladd commented 9 years ago

Here's the version as of April 15 2015 https://tools.ietf.org/html/draft-ietf-hybi-permessage-compression-21

sethladd commented 9 years ago

Headers from Chrome 43:

user-agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_10_3) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/43.0.2357.65 Safari/537.36 connection: Upgrade cache-control: no-cache accept-language: en-US,en;q=0.8 accept-encoding: gzip, deflate, sdch origin: http://localhost:8000 sec-websocket-version: 13 host: localhost:8000 sec-websocket-extensions: permessage-deflate; client_max_window_bits pragma: no-cache sec-websocket-key: 3nFjJkd6W3v0EYq59e4d8A== upgrade: websocket

firefox 38:

user-agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.10; rv:38.0) Gecko/20100101 Firefox/38.0 connection: keep-alive, Upgrade cache-control: no-cache accept-encoding: gzip, deflate pragma: no-cache sec-websocket-key: y9gRSKNDwy3KG3GrpRY80g== upgrade: websocket accept: text/html,application/xhtml+xml,application/xml;q=0.9,/;q=0.8 accept-language: en-US,en;q=0.5 origin: http://localhost:8000 sec-websocket-version: 13 host: localhost:8000 sec-websocket-extensions: permessage-deflate

safari 8.0.6:

/ws user-agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_10_3) AppleWebKit/600.6.3 (KHTML, like Gecko) Version/8.0.6 Safari/600.6.3 connection: Upgrade cache-control: no-cache origin: http://localhost:8000 sec-websocket-version: 13 host: localhost:8000 sec-websocket-extensions: x-webkit-deflate-frame pragma: no-cache sec-websocket-key: 3/GcCvUhCfnLSnnrpU7Lig== upgrade: websocket

DartBot commented 9 years ago

This comment was originally written by @kaendfinger


I'm targeting mid-next week for completion of a patch. I'll make sure to link it here.

sethladd commented 9 years ago

Does that patch enable extensions in general, or just specifically this compression support?

DartBot commented 9 years ago

This comment was originally written by @kaendfinger


Just compression. I'll write another patch which enables extensions after that. If I would have thought about full extensions support beforehand, I would have done it first, but I already have too much existing code to backtrack it all :)

DartBot commented 9 years ago

This comment was originally written by @kaendfinger


Here is my basic implementation. I would like some comments on what I currently have before I make any more changes.

https://codereview.chromium.org/1158593002

butlermatt commented 9 years ago

I took over this change from Kenneth. Current review:

https://codereview.chromium.org/1390353005/

sgjesse commented 8 years ago

Fix from @butlermatt and @kaendfinger landed in https://github.com/dart-lang/sdk/commit/95bb2159d9fb7f44d3bbc99932a57173e1b464aa.