Compare commits
20 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 60318127e2 | |||
| 392c672dd8 | |||
| 7ef1451923 | |||
| 76dbd000d4 | |||
| 4e7ae0b1f2 | |||
| ff9af49c92 | |||
| c44d436241 | |||
| 7b2ecb164c | |||
| 8592fb0288 | |||
| 7fe88150b2 | |||
| 14967f5e89 | |||
| afe3c6c6aa | |||
| 125807a973 | |||
| 92cead666f | |||
| 5b54b66cc1 | |||
| 3d143d2c3e | |||
| bb1179bc8c | |||
| 033020e78a | |||
| cc1d6196fe | |||
| b9da251798 |
+11
-4
@@ -1,11 +1,18 @@
|
||||
sudo: false
|
||||
language: ruby
|
||||
|
||||
rvm:
|
||||
- 1.9.3
|
||||
- 2.0.0
|
||||
- 2.1.5
|
||||
- 2.2.0
|
||||
- 2.1.10
|
||||
- 2.2.8
|
||||
- 2.3.5
|
||||
- 2.4.2
|
||||
- jruby-19mode
|
||||
- rbx-2.2
|
||||
- jruby-head
|
||||
|
||||
script: bundle exec rspec -c spec/
|
||||
before_install:
|
||||
- '[[ "$(ruby --version)" == *"1.9.3"* ]] && gem update --system 2.4.8 || true'
|
||||
|
||||
script:
|
||||
- bundle exec rspec -c spec
|
||||
|
||||
@@ -1,3 +1,7 @@
|
||||
### 0.1.3 / 2017-11-11
|
||||
|
||||
* Accept extension names and parameters including uppercase letters
|
||||
|
||||
### 0.1.2 / 2015-02-19
|
||||
|
||||
* Make it safe to call `Extensions#close` if the handshake is not complete
|
||||
|
||||
@@ -0,0 +1,4 @@
|
||||
# Code of Conduct
|
||||
|
||||
All projects under the [Faye](https://github.com/faye) umbrella are covered by
|
||||
the [Code of Conduct](https://github.com/faye/code-of-conduct).
|
||||
+20
@@ -0,0 +1,20 @@
|
||||
# The MIT license
|
||||
|
||||
Copyright (c) 2014-2017 James Coglan
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy of
|
||||
this software and associated documentation files (the 'Software'), to deal in
|
||||
the Software without restriction, including without limitation the rights to
|
||||
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
|
||||
the Software, and to permit persons to whom the Software is furnished to do so,
|
||||
subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
|
||||
FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
|
||||
COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
|
||||
IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
||||
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
@@ -311,26 +311,3 @@ the session to release any resources it's using.
|
||||
|
||||
* Consumer: [websocket-driver](https://github.com/faye/websocket-driver-ruby)
|
||||
* Provider: [permessage-deflate](https://github.com/faye/permessage-deflate-ruby)
|
||||
|
||||
## License
|
||||
|
||||
(The MIT License)
|
||||
|
||||
Copyright (c) 2014-2015 James Coglan
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy of
|
||||
this software and associated documentation files (the 'Software'), to deal in
|
||||
the Software without restriction, including without limitation the rights to
|
||||
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
|
||||
the Software, and to permit persons to whom the Software is furnished to do so,
|
||||
subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
|
||||
FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
|
||||
COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
|
||||
IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
||||
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
|
||||
@@ -98,9 +98,9 @@ module WebSocket
|
||||
end
|
||||
|
||||
def generate_response(header)
|
||||
offers = Parser.parse_header(header)
|
||||
sessions = []
|
||||
response = []
|
||||
offers = Parser.parse_header(header)
|
||||
|
||||
@in_order.each do |ext|
|
||||
offer = offers.by_name(ext.name)
|
||||
|
||||
@@ -4,8 +4,8 @@ module WebSocket
|
||||
class Extensions
|
||||
|
||||
class Parser
|
||||
TOKEN = /([!#\$%&'\*\+\-\.\^_`\|~0-9a-z]+)/
|
||||
NOTOKEN = /([^!#\$%&'\*\+\-\.\^_`\|~0-9a-z])/
|
||||
TOKEN = /([!#\$%&'\*\+\-\.\^_`\|~0-9A-Za-z]+)/
|
||||
NOTOKEN = /([^!#\$%&'\*\+\-\.\^_`\|~0-9A-Za-z])/
|
||||
QUOTED = /"((?:\\[\x00-\x7f]|[^\x00-\x08\x0a-\x1f\x7f"])*)"/
|
||||
PARAM = %r{#{TOKEN.source}(?:=(?:#{TOKEN.source}|#{QUOTED.source}))?}
|
||||
EXT = %r{#{TOKEN.source}(?: *; *#{PARAM.source})*}
|
||||
|
||||
@@ -325,11 +325,14 @@ describe WebSocket::Extensions do
|
||||
expect(@extensions.generate_response("deflate, tar")).to eq "deflate; mode=compress"
|
||||
end
|
||||
|
||||
it "returns a response for potentially conflicting extensions if their preceeding extensions don't build a session" do
|
||||
it "raises an error if the header is invalid" do
|
||||
expect { @extensions.generate_response("x-webkit- -frame") }.to raise_error
|
||||
end
|
||||
|
||||
it "returns a response for potentially conflicting extensions if their preceding extensions don't build a session" do
|
||||
allow(@ext).to receive(:create_server_session).and_return(nil)
|
||||
expect(@extensions.generate_response("deflate, tar")).to eq "tar; gzip"
|
||||
end
|
||||
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
@@ -1,17 +1,17 @@
|
||||
Gem::Specification.new do |s|
|
||||
s.name = 'websocket-extensions'
|
||||
s.version = '0.1.2'
|
||||
s.summary = 'Generic extension manager for WebSocket connections'
|
||||
s.author = 'James Coglan'
|
||||
s.email = 'jcoglan@gmail.com'
|
||||
s.homepage = 'http://github.com/faye/websocket-extensions-ruby'
|
||||
s.license = 'MIT'
|
||||
s.name = 'websocket-extensions'
|
||||
s.version = '0.1.3'
|
||||
s.summary = 'Generic extension manager for WebSocket connections'
|
||||
s.author = 'James Coglan'
|
||||
s.email = 'jcoglan@gmail.com'
|
||||
s.homepage = 'https://github.com/faye/websocket-extensions-ruby'
|
||||
s.license = 'MIT'
|
||||
|
||||
s.extra_rdoc_files = %w[README.md]
|
||||
s.rdoc_options = %w[--main README.md --markup markdown]
|
||||
s.require_paths = %w[lib]
|
||||
s.extra_rdoc_files = %w[README.md]
|
||||
s.rdoc_options = %w[--main README.md --markup markdown]
|
||||
s.require_paths = %w[lib]
|
||||
|
||||
s.files = %w[README.md CHANGELOG.md] + Dir.glob('lib/**/*.rb')
|
||||
s.files = %w[CHANGELOG.md LICENSE.md README.md] + Dir.glob('lib/**/*.rb')
|
||||
|
||||
s.add_development_dependency 'rspec'
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user