30 Commits

Author SHA1 Message Date
James Coglan 242f007cb9 Bump version to 0.1.4 2019-06-10 12:34:21 +01:00
James Coglan 249bcc106f Change markdown formatting of docs. 2019-05-29 15:33:26 +01:00
wilkie 738a0af1dd Fix deprecation warning about =~ being called on TrueClass.
With the code as it was, it will generate a warning like such:

.../websocket-extensions-0.1.3/lib/websocket/extensions/parser.rb:41:
warning: deprecated Object#=~ is called on TrueClass; it always returns
nil

So we will avoid if the variable is TrueClass.
2019-05-24 14:42:31 +01:00
James Coglan 68c1b21129 Fix RSpec warnings about raise_error with no arguments. 2019-05-24 14:42:31 +01:00
James Coglan 8ee09b2924 Update Travis target versions. 2019-05-24 14:42:31 +01:00
James Coglan 7e64cfb6ca Switch license to Apache 2.0. 2019-05-24 14:00:37 +01:00
James Coglan 1a441fac80 Test on Ruby 2.5.0. 2018-02-19 21:03:05 +00:00
James Coglan 60318127e2 Bump version to 0.1.3. 2017-11-11 01:26:32 +00:00
James Coglan 392c672dd8 Bump Ruby versions on Travis. 2017-11-11 01:14:45 +00:00
James Coglan 7ef1451923 Header parser should accept uppercase letters. 2017-11-11 01:04:05 +00:00
James Coglan 76dbd000d4 Fix the version of Rubygems that Travis is using on Ruby 1.9. 2017-09-11 22:23:05 +01:00
James Coglan 4e7ae0b1f2 Use an https: link to github in the gemspec. 2017-09-11 22:02:09 +01:00
James Coglan ff9af49c92 Merge pull request #4 from EdwardBetts/spelling
correct spelling mistake
2017-09-02 12:16:53 +01:00
Edward Betts c44d436241 correct spelling mistake 2017-09-02 07:47:34 +01:00
James Coglan 7b2ecb164c Update Ruby versions in Travis config. 2017-08-01 20:34:57 +01:00
James Coglan 8592fb0288 Merge pull request #3 from junaruga/feature/travis-ruby-head
Add ruby24 and ruby head to Travis CI
2017-04-14 10:32:22 +01:00
Jun Aruga 7fe88150b2 Add Ruby 2.4.1 to .travis.yml 2017-04-03 19:03:27 +02:00
James Coglan 14967f5e89 Bump Ruby versions 2.2 and 2.3 on Travis. 2016-11-21 23:22:26 +00:00
James Coglan afe3c6c6aa Remove Rubinius from the build as it hasn't worked on Travis for weeks. 2016-10-26 09:14:20 +01:00
James Coglan 125807a973 Update Ruby versions for Travis. 2016-04-30 13:10:54 +01:00
James Coglan 92cead666f Update the Ruby versions used on Travis. 2016-03-23 09:13:20 +00:00
Jun Aruga 5b54b66cc1 Separate the license text 2016-03-23 09:08:18 +00:00
James Coglan 3d143d2c3e Create CODE_OF_CONDUCT.md. 2015-11-08 12:16:52 +00:00
James Coglan bb1179bc8c Update Rubies for Travis: 2.1.7, 2.2.3, jruby-9, rbx-2.5. 2015-10-17 13:19:33 +01:00
James Coglan 033020e78a Test on Ruby 2.2.1. 2015-03-26 09:46:03 +00:00
James Coglan cc1d6196fe Reversing the previous commit; generateResponse() should throw on invalid heders (as should activate()), because the server should fail the connection in this event. 2015-03-26 09:32:54 +00:00
James Coglan b9da251798 If the header from the client is invalid, just ignore it and build a pipeline with no sessions. 2015-03-14 12:56:48 +00:00
James Coglan dd6cff6c09 Test on Ruby 2.1.5 and 2.2.0. 2015-02-19 21:06:45 +00:00
James Coglan c73f432841 Bump version to 0.1.2. 2015-02-19 20:58:30 +00:00
James Coglan 88abae45d2 Make Extensions#close safe to call if @sessions is not yet initialised, in case the socket is closed before handshaking. 2015-02-16 09:54:08 +00:00
9 changed files with 68 additions and 48 deletions
+14 -3
View File
@@ -1,10 +1,21 @@
sudo: false
dist: trusty
language: ruby
rvm:
- 1.9.3
- 2.0.0
- 2.1.3
- 2.1.10
- 2.2.10
- 2.3.8
- 2.4.6
- 2.5.5
- 2.6.3
- 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
+14 -2
View File
@@ -1,7 +1,19 @@
### 0.1.4 / 2019-06-10
- Fix a deprecation warning for using the `=~` operator on `true`
### 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.1.1 / 2014-12-14
* Explicitly require `strscan` which is not loaded in a vanilla Ruby environment
- Explicitly require `strscan` which is not loaded in a vanilla Ruby environment
### 0.1.0 / 2014-12-13
* Initial release
- Initial release
+4
View File
@@ -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).
+12
View File
@@ -0,0 +1,12 @@
Copyright 2014-2019 James Coglan
Licensed under the Apache License, Version 2.0 (the "License"); you may not use
this file except in compliance with the License. You may obtain a copy of the
License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed
under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
CONDITIONS OF ANY KIND, either express or implied. See the License for the
specific language governing permissions and limitations under the License.
+2 -26
View File
@@ -309,29 +309,5 @@ the session to release any resources it's using.
## Examples
* 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 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.
- Consumer: [websocket-driver](https://github.com/faye/websocket-driver-ruby)
- Provider: [permessage-deflate](https://github.com/faye/permessage-deflate-ruby)
+3 -1
View File
@@ -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)
@@ -155,6 +155,8 @@ module WebSocket
end
def close
return unless @sessions
@sessions.each do |ext, session|
session.close rescue nil
end
+3 -3
View File
@@ -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})*}
@@ -38,7 +38,7 @@ module WebSocket
else
data = true
end
if data =~ NUMBER
if data != true and data =~ NUMBER
data = data =~ /\./ ? data.to_f : data.to_i(10)
end
+5 -2
View File
@@ -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(WebSocket::Extensions::Parser::ParseError)
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
+11 -11
View File
@@ -1,17 +1,17 @@
Gem::Specification.new do |s|
s.name = 'websocket-extensions'
s.version = '0.1.1'
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.4'
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 = 'Apache-2.0'
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