ds9 1.3.0 → 1.3.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitignore +3 -0
- data/Gemfile +1 -0
- data/README.md +22 -20
- data/Rakefile +6 -25
- data/ds9.gemspec +33 -0
- data/ext/ds9/extconf.rb +34 -7
- data/lib/ds9.rb +1 -2
- data/lib/ds9/version.rb +3 -0
- data/test/test_server.rb +68 -0
- metadata +41 -28
- data/Manifest.txt +0 -13
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 675cfb91dad1dd9337150425144870db64e880c9
|
4
|
+
data.tar.gz: 31fa19e3c643ce1a425cb7c97b2fa6e145fb69d4
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 5023590043ecd16dc8f9f004cb7c38e0b479806459c0716e108ba15160f3eb88d8d15fa0349118817aa7414d7878ece680c8dc97059bc102dfb2e13b2fa3b187
|
7
|
+
data.tar.gz: ed434905dc9b8129f0c812cec3a752b77618a61c157698e46c2d2b3b22221ac1a28145a089d222e31f37258e42221b5cdd9b841589a266e26a12e813e1f12b80
|
data/.gitignore
ADDED
data/Gemfile
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
gemspec
|
data/README.md
CHANGED
@@ -9,19 +9,33 @@ around nghttp2.
|
|
9
9
|
|
10
10
|
## INSTALLING
|
11
11
|
|
12
|
-
|
12
|
+
Add this line to your application's Gemfile:
|
13
13
|
|
14
|
+
```ruby
|
15
|
+
gem ds9
|
16
|
+
```
|
17
|
+
|
18
|
+
And then execute:
|
19
|
+
|
20
|
+
```shell
|
21
|
+
$ bundle install
|
14
22
|
```
|
15
|
-
|
23
|
+
|
24
|
+
Or install it yourself as:
|
25
|
+
|
26
|
+
```shell
|
16
27
|
$ gem install ds9
|
17
28
|
```
|
18
29
|
|
19
|
-
|
20
|
-
libnghttp2.
|
30
|
+
To install this gem without nghttp2:
|
21
31
|
|
22
|
-
|
32
|
+
Use `DS9_USE_SYSTEM_LIBRARIES` ENV var:
|
23
33
|
|
24
|
-
|
34
|
+
```shell
|
35
|
+
$ DS9_USE_SYSTEM_LIBRARIES=1 bundle install
|
36
|
+
```
|
37
|
+
|
38
|
+
or, the `--use-system-libraries` option:
|
25
39
|
|
26
40
|
## SYNOPSIS:
|
27
41
|
|
@@ -142,23 +156,11 @@ end
|
|
142
156
|
|
143
157
|
## HACKING:
|
144
158
|
|
145
|
-
On OS X:
|
146
|
-
|
147
159
|
```
|
148
|
-
$
|
149
|
-
$
|
150
|
-
$ rake compile test
|
160
|
+
$ bundle install
|
161
|
+
$ bundle exec rake compile test
|
151
162
|
```
|
152
163
|
|
153
|
-
## REQUIREMENTS:
|
154
|
-
|
155
|
-
* Needs nghttp2
|
156
|
-
|
157
|
-
## INSTALL:
|
158
|
-
|
159
|
-
* brew install nghttp2
|
160
|
-
* gem install ds9
|
161
|
-
|
162
164
|
## LICENSE:
|
163
165
|
|
164
166
|
(The MIT License)
|
data/Rakefile
CHANGED
@@ -1,31 +1,12 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
require 'rubygems'
|
4
|
-
require 'hoe'
|
5
|
-
|
6
|
-
Hoe.plugins.delete :rubyforge
|
7
|
-
Hoe.plugin :minitest
|
8
|
-
Hoe.plugin :gemspec # `gem install hoe-gemspec`
|
9
|
-
Hoe.plugin :git # `gem install hoe-git`
|
10
|
-
|
11
|
-
gem 'rake-compiler', '>= 0.4.1'
|
1
|
+
require "bundler/gem_tasks"
|
12
2
|
require "rake/extensiontask"
|
13
3
|
|
14
|
-
|
15
|
-
developer('Aaron Patterson', 'tenderlove@ruby-lang.org')
|
16
|
-
self.readme_file = 'README.md'
|
17
|
-
self.history_file = 'CHANGELOG.md'
|
18
|
-
self.extra_rdoc_files = FileList['*.md']
|
19
|
-
extra_dev_deps << ['rake-compiler', '>= 0.4.1']
|
20
|
-
|
21
|
-
self.spec_extras = {
|
22
|
-
:required_ruby_version => '>= 2.2.2'
|
23
|
-
}
|
4
|
+
task default: :compile
|
24
5
|
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
6
|
+
Rake::ExtensionTask.new("ds9") do |t|
|
7
|
+
t.name = "ds9"
|
8
|
+
t.ext_dir = "ext/ds9"
|
9
|
+
t.lib_dir = "lib"
|
29
10
|
end
|
30
11
|
|
31
12
|
# vim: syntax=ruby
|
data/ds9.gemspec
ADDED
@@ -0,0 +1,33 @@
|
|
1
|
+
lib = File.expand_path("../lib", __FILE__)
|
2
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
3
|
+
require "ds9/version"
|
4
|
+
|
5
|
+
Gem::Specification.new do |s|
|
6
|
+
s.name = "ds9"
|
7
|
+
s.version = DS9::VERSION
|
8
|
+
s.authors = ["Aaron Patterson", "Yuta Iwama"]
|
9
|
+
s.email = ["tenderlove@ruby-lang.org", "ganmacs@gmail.com"]
|
10
|
+
|
11
|
+
s.summary = "This library allows you to write HTTP/2 clients and servers"
|
12
|
+
s.description = "This library allows you to write HTTP/2 clients and servers. It is a wrapper\naround nghttp2."
|
13
|
+
s.homepage = "https://github.com/tenderlove/ds9"
|
14
|
+
s.licenses = ["MIT"]
|
15
|
+
|
16
|
+
s.files = `git ls-files -z`.split("\x0")
|
17
|
+
s.require_paths = ["lib"]
|
18
|
+
s.extensions = ["ext/ds9/extconf.rb"]
|
19
|
+
|
20
|
+
s.required_ruby_version = Gem::Requirement.new(">= 2.3.0")
|
21
|
+
s.rubygems_version = "2.4.8"
|
22
|
+
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
23
|
+
s.extra_rdoc_files = ["CHANGELOG.md", "README.md"]
|
24
|
+
s.rdoc_options = ["--main", "README.md"]
|
25
|
+
s.date = "2015-07-06"
|
26
|
+
|
27
|
+
s.add_runtime_dependency "mini_portile2", ">= 2.2.0"
|
28
|
+
|
29
|
+
s.add_development_dependency "bundler"
|
30
|
+
s.add_development_dependency "minitest", "~> 5.7"
|
31
|
+
s.add_development_dependency "rdoc", "~> 4.0"
|
32
|
+
s.add_development_dependency "rake-compiler", ">= 1.0.5"
|
33
|
+
end
|
data/ext/ds9/extconf.rb
CHANGED
@@ -1,16 +1,43 @@
|
|
1
1
|
require 'mkmf'
|
2
2
|
|
3
|
-
|
4
|
-
|
3
|
+
def using_system_libraries?
|
4
|
+
arg_config('--use-system-libraries', !!ENV['DS9_USE_SYSTEM_LIBRARIES'])
|
5
|
+
end
|
6
|
+
|
7
|
+
if using_system_libraries?
|
8
|
+
if with_config("static")
|
9
|
+
ldflags = pkg_config 'libnghttp2', 'libs-only-L'
|
5
10
|
|
6
|
-
|
7
|
-
|
8
|
-
|
11
|
+
archive = File.join ldflags.sub(/^-L/, ''), 'libnghttp2.a'
|
12
|
+
if File.exist? archive
|
13
|
+
$LDFLAGS << " #{archive}"
|
14
|
+
else
|
15
|
+
raise "couldn't find archive"
|
16
|
+
end
|
9
17
|
else
|
10
|
-
|
18
|
+
pkg_config 'libnghttp2'
|
11
19
|
end
|
12
20
|
else
|
13
|
-
|
21
|
+
message "Building nghttp2\n"
|
22
|
+
require 'rubygems'
|
23
|
+
require 'mini_portile2'
|
24
|
+
recipe = MiniPortile.new('nghttp2', 'v1.34.0')
|
25
|
+
# We need to compile nghttp2 with `-fPIC` option, so delete `--disable-shared` from MiniPortile#configure_defaults
|
26
|
+
recipe.configure_options = ['--enable-lib-only', '--enable-static', "--host=#{recipe.host}"]
|
27
|
+
|
28
|
+
recipe.files << {
|
29
|
+
url: 'https://github.com/nghttp2/nghttp2/releases/download/v1.34.0/nghttp2-1.34.0.tar.gz',
|
30
|
+
sha1: '2d0ad93a254a7a6e6c737f2fd2e10e4810a41f74',
|
31
|
+
}
|
32
|
+
recipe.cook
|
33
|
+
|
34
|
+
# `recipe.activate` uses invalid path for this package.
|
35
|
+
$LIBPATH = ["#{recipe.path}/lib"] + $LIBPATH
|
36
|
+
$CPPFLAGS << " -I#{recipe.path}/include"
|
37
|
+
$LIBS << " -lnghttp2 -lstdc++"
|
14
38
|
end
|
15
39
|
|
40
|
+
abort 'nghttp2/nghttp2.h not found' unless have_header('nghttp2/nghttp2.h')
|
41
|
+
abort 'libnghttp2 not found' unless have_library('nghttp2')
|
42
|
+
|
16
43
|
create_makefile 'ds9'
|
data/lib/ds9.rb
CHANGED
data/lib/ds9/version.rb
ADDED
data/test/test_server.rb
ADDED
@@ -0,0 +1,68 @@
|
|
1
|
+
require 'helper'
|
2
|
+
|
3
|
+
class TestServer < DS9::TestCase
|
4
|
+
def test_submit_response
|
5
|
+
server, client = pipe do |req, res|
|
6
|
+
refute req.stream.stream_remote_closed?(req.stream_id)
|
7
|
+
refute req.stream.stream_local_closed?(req.stream_id)
|
8
|
+
res.submit_response([[':status', '200'],
|
9
|
+
['server', 'test server'],
|
10
|
+
['date', 'Sat, 27 Jun 2015 17:29:21 GMT']])
|
11
|
+
res.finish('omglol')
|
12
|
+
end
|
13
|
+
|
14
|
+
s = Thread.new { server.run }
|
15
|
+
c = Thread.new { client.run }
|
16
|
+
|
17
|
+
client.submit_request([[':method', 'GET'],
|
18
|
+
[':path', '/'],
|
19
|
+
[':scheme', 'https'],
|
20
|
+
[':authority', ['localhost', '8080'].join(':')],
|
21
|
+
['accept', '*/*'],
|
22
|
+
['user-agent', 'test']])
|
23
|
+
|
24
|
+
responses = []
|
25
|
+
while (response = client.responses.pop)
|
26
|
+
responses << response
|
27
|
+
if responses.length == 1
|
28
|
+
client.terminate_session DS9::NO_ERROR
|
29
|
+
end
|
30
|
+
end
|
31
|
+
|
32
|
+
s.join
|
33
|
+
c.join
|
34
|
+
assert_equal ['omglol'], responses.map(&:body).map(&:string)
|
35
|
+
end
|
36
|
+
|
37
|
+
def test_submit_headers
|
38
|
+
server, client = pipe do |req, res|
|
39
|
+
refute req.stream.stream_remote_closed?(req.stream_id)
|
40
|
+
refute req.stream.stream_local_closed?(req.stream_id)
|
41
|
+
res.submit_headers([[':status', '200'],
|
42
|
+
['server', 'test server'],
|
43
|
+
['date', 'Sat, 27 Jun 2015 17:29:21 GMT']])
|
44
|
+
end
|
45
|
+
|
46
|
+
s = Thread.new { server.run }
|
47
|
+
c = Thread.new { client.run }
|
48
|
+
|
49
|
+
client.submit_request([[':method', 'GET'],
|
50
|
+
[':path', '/'],
|
51
|
+
[':scheme', 'https'],
|
52
|
+
[':authority', ['localhost', '8080'].join(':')],
|
53
|
+
['accept', '*/*'],
|
54
|
+
['user-agent', 'test']])
|
55
|
+
|
56
|
+
responses = []
|
57
|
+
while (response = client.responses.pop)
|
58
|
+
responses << response
|
59
|
+
if responses.length == 1
|
60
|
+
client.terminate_session DS9::NO_ERROR
|
61
|
+
end
|
62
|
+
end
|
63
|
+
|
64
|
+
s.join
|
65
|
+
c.join
|
66
|
+
assert_equal [''], responses.map(&:body).map(&:string)
|
67
|
+
end
|
68
|
+
end
|
metadata
CHANGED
@@ -1,103 +1,116 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: ds9
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.3.
|
4
|
+
version: 1.3.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Aaron Patterson
|
8
|
+
- Yuta Iwama
|
8
9
|
autorequire:
|
9
10
|
bindir: bin
|
10
11
|
cert_chain: []
|
11
|
-
date:
|
12
|
+
date: 2015-07-06 00:00:00.000000000 Z
|
12
13
|
dependencies:
|
13
14
|
- !ruby/object:Gem::Dependency
|
14
|
-
name:
|
15
|
+
name: mini_portile2
|
15
16
|
requirement: !ruby/object:Gem::Requirement
|
16
17
|
requirements:
|
17
|
-
- - "
|
18
|
+
- - ">="
|
18
19
|
- !ruby/object:Gem::Version
|
19
|
-
version:
|
20
|
-
type: :
|
20
|
+
version: 2.2.0
|
21
|
+
type: :runtime
|
21
22
|
prerelease: false
|
22
23
|
version_requirements: !ruby/object:Gem::Requirement
|
23
24
|
requirements:
|
24
|
-
- - "
|
25
|
+
- - ">="
|
25
26
|
- !ruby/object:Gem::Version
|
26
|
-
version:
|
27
|
+
version: 2.2.0
|
27
28
|
- !ruby/object:Gem::Dependency
|
28
|
-
name:
|
29
|
+
name: bundler
|
29
30
|
requirement: !ruby/object:Gem::Requirement
|
30
31
|
requirements:
|
31
32
|
- - ">="
|
32
33
|
- !ruby/object:Gem::Version
|
33
|
-
version: 0
|
34
|
+
version: '0'
|
34
35
|
type: :development
|
35
36
|
prerelease: false
|
36
37
|
version_requirements: !ruby/object:Gem::Requirement
|
37
38
|
requirements:
|
38
39
|
- - ">="
|
39
40
|
- !ruby/object:Gem::Version
|
40
|
-
version: 0
|
41
|
+
version: '0'
|
42
|
+
- !ruby/object:Gem::Dependency
|
43
|
+
name: minitest
|
44
|
+
requirement: !ruby/object:Gem::Requirement
|
45
|
+
requirements:
|
46
|
+
- - "~>"
|
47
|
+
- !ruby/object:Gem::Version
|
48
|
+
version: '5.7'
|
49
|
+
type: :development
|
50
|
+
prerelease: false
|
51
|
+
version_requirements: !ruby/object:Gem::Requirement
|
52
|
+
requirements:
|
53
|
+
- - "~>"
|
54
|
+
- !ruby/object:Gem::Version
|
55
|
+
version: '5.7'
|
41
56
|
- !ruby/object:Gem::Dependency
|
42
57
|
name: rdoc
|
43
58
|
requirement: !ruby/object:Gem::Requirement
|
44
59
|
requirements:
|
45
|
-
- - "
|
60
|
+
- - "~>"
|
46
61
|
- !ruby/object:Gem::Version
|
47
62
|
version: '4.0'
|
48
|
-
- - "<"
|
49
|
-
- !ruby/object:Gem::Version
|
50
|
-
version: '7'
|
51
63
|
type: :development
|
52
64
|
prerelease: false
|
53
65
|
version_requirements: !ruby/object:Gem::Requirement
|
54
66
|
requirements:
|
55
|
-
- - "
|
67
|
+
- - "~>"
|
56
68
|
- !ruby/object:Gem::Version
|
57
69
|
version: '4.0'
|
58
|
-
- - "<"
|
59
|
-
- !ruby/object:Gem::Version
|
60
|
-
version: '7'
|
61
70
|
- !ruby/object:Gem::Dependency
|
62
|
-
name:
|
71
|
+
name: rake-compiler
|
63
72
|
requirement: !ruby/object:Gem::Requirement
|
64
73
|
requirements:
|
65
|
-
- - "
|
74
|
+
- - ">="
|
66
75
|
- !ruby/object:Gem::Version
|
67
|
-
version:
|
76
|
+
version: 1.0.5
|
68
77
|
type: :development
|
69
78
|
prerelease: false
|
70
79
|
version_requirements: !ruby/object:Gem::Requirement
|
71
80
|
requirements:
|
72
|
-
- - "
|
81
|
+
- - ">="
|
73
82
|
- !ruby/object:Gem::Version
|
74
|
-
version:
|
83
|
+
version: 1.0.5
|
75
84
|
description: |-
|
76
|
-
This library allows you to write HTTP/2 clients and servers.
|
85
|
+
This library allows you to write HTTP/2 clients and servers. It is a wrapper
|
77
86
|
around nghttp2.
|
78
87
|
email:
|
79
88
|
- tenderlove@ruby-lang.org
|
89
|
+
- ganmacs@gmail.com
|
80
90
|
executables: []
|
81
91
|
extensions:
|
82
92
|
- ext/ds9/extconf.rb
|
83
93
|
extra_rdoc_files:
|
84
94
|
- CHANGELOG.md
|
85
|
-
- Manifest.txt
|
86
95
|
- README.md
|
87
96
|
files:
|
88
97
|
- ".autotest"
|
98
|
+
- ".gitignore"
|
89
99
|
- CHANGELOG.md
|
90
|
-
-
|
100
|
+
- Gemfile
|
91
101
|
- README.md
|
92
102
|
- Rakefile
|
103
|
+
- ds9.gemspec
|
93
104
|
- ext/ds9/ds9.c
|
94
105
|
- ext/ds9/ds9.h
|
95
106
|
- ext/ds9/ds9_frames.c
|
96
107
|
- ext/ds9/extconf.rb
|
97
108
|
- lib/ds9.rb
|
109
|
+
- lib/ds9/version.rb
|
98
110
|
- test/helper.rb
|
99
111
|
- test/test_client.rb
|
100
112
|
- test/test_ds9.rb
|
113
|
+
- test/test_server.rb
|
101
114
|
homepage: https://github.com/tenderlove/ds9
|
102
115
|
licenses:
|
103
116
|
- MIT
|
@@ -112,7 +125,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
112
125
|
requirements:
|
113
126
|
- - ">="
|
114
127
|
- !ruby/object:Gem::Version
|
115
|
-
version: 2.
|
128
|
+
version: 2.3.0
|
116
129
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
117
130
|
requirements:
|
118
131
|
- - ">="
|