protocol-http1 0.13.0 → 0.13.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/lib/protocol/http1/version.rb +1 -1
- metadata +11 -38
- data/.editorconfig +0 -6
- data/.gitignore +0 -13
- data/.rspec +0 -3
- data/.travis.yml +0 -21
- data/Gemfile +0 -6
- data/README.md +0 -92
- data/examples/http1/request.rb +0 -39
- data/fuzz/request/bake.rb +0 -5
- data/fuzz/request/input/body.txt +0 -6
- data/fuzz/request/input/simple.txt +0 -2
- data/fuzz/request/script.rb +0 -32
- data/protocol-http1.gemspec +0 -31
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 4e7551e3bc57f35d161475c5c35c8a9a897fa032f3bbc523a6187a033e9e4539
|
|
4
|
+
data.tar.gz: dc11c6473a5e88d61f709ece47c6c36b1c87edc8d3f316d649288039cd0491a0
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 6c077a0cd4de36989268ec7c4258d702f23469346a6cc66492b8fbd19a79796d9924f479cbc9fbe5c34efc1c642dc14b8b826e38589aa39d775244251a1acad8
|
|
7
|
+
data.tar.gz: 873cb095fe327997ffaa175b54379b91f88802ee5a4de8beedb7238c55794dda1627b0a605149968d53aca7f8023aad164574f371c33665672d9afa0f4157dc9
|
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: protocol-http1
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.13.
|
|
4
|
+
version: 0.13.1
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Samuel Williams
|
|
8
|
-
autorequire:
|
|
8
|
+
autorequire:
|
|
9
9
|
bindir: bin
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date: 2020-
|
|
11
|
+
date: 2020-09-19 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: protocol-http
|
|
@@ -24,20 +24,6 @@ dependencies:
|
|
|
24
24
|
- - "~>"
|
|
25
25
|
- !ruby/object:Gem::Version
|
|
26
26
|
version: '0.19'
|
|
27
|
-
- !ruby/object:Gem::Dependency
|
|
28
|
-
name: covered
|
|
29
|
-
requirement: !ruby/object:Gem::Requirement
|
|
30
|
-
requirements:
|
|
31
|
-
- - ">="
|
|
32
|
-
- !ruby/object:Gem::Version
|
|
33
|
-
version: '0'
|
|
34
|
-
type: :development
|
|
35
|
-
prerelease: false
|
|
36
|
-
version_requirements: !ruby/object:Gem::Requirement
|
|
37
|
-
requirements:
|
|
38
|
-
- - ">="
|
|
39
|
-
- !ruby/object:Gem::Version
|
|
40
|
-
version: '0'
|
|
41
27
|
- !ruby/object:Gem::Dependency
|
|
42
28
|
name: bundler
|
|
43
29
|
requirement: !ruby/object:Gem::Requirement
|
|
@@ -53,7 +39,7 @@ dependencies:
|
|
|
53
39
|
- !ruby/object:Gem::Version
|
|
54
40
|
version: '0'
|
|
55
41
|
- !ruby/object:Gem::Dependency
|
|
56
|
-
name:
|
|
42
|
+
name: covered
|
|
57
43
|
requirement: !ruby/object:Gem::Requirement
|
|
58
44
|
requirements:
|
|
59
45
|
- - ">="
|
|
@@ -81,7 +67,7 @@ dependencies:
|
|
|
81
67
|
- !ruby/object:Gem::Version
|
|
82
68
|
version: '3.0'
|
|
83
69
|
- !ruby/object:Gem::Dependency
|
|
84
|
-
name: rspec-
|
|
70
|
+
name: rspec-files
|
|
85
71
|
requirement: !ruby/object:Gem::Requirement
|
|
86
72
|
requirements:
|
|
87
73
|
- - "~>"
|
|
@@ -95,7 +81,7 @@ dependencies:
|
|
|
95
81
|
- !ruby/object:Gem::Version
|
|
96
82
|
version: '1.0'
|
|
97
83
|
- !ruby/object:Gem::Dependency
|
|
98
|
-
name: rspec-
|
|
84
|
+
name: rspec-memory
|
|
99
85
|
requirement: !ruby/object:Gem::Requirement
|
|
100
86
|
requirements:
|
|
101
87
|
- - "~>"
|
|
@@ -108,24 +94,12 @@ dependencies:
|
|
|
108
94
|
- - "~>"
|
|
109
95
|
- !ruby/object:Gem::Version
|
|
110
96
|
version: '1.0'
|
|
111
|
-
description:
|
|
97
|
+
description:
|
|
112
98
|
email:
|
|
113
|
-
- samuel.williams@oriontransfer.co.nz
|
|
114
99
|
executables: []
|
|
115
100
|
extensions: []
|
|
116
101
|
extra_rdoc_files: []
|
|
117
102
|
files:
|
|
118
|
-
- ".editorconfig"
|
|
119
|
-
- ".gitignore"
|
|
120
|
-
- ".rspec"
|
|
121
|
-
- ".travis.yml"
|
|
122
|
-
- Gemfile
|
|
123
|
-
- README.md
|
|
124
|
-
- examples/http1/request.rb
|
|
125
|
-
- fuzz/request/bake.rb
|
|
126
|
-
- fuzz/request/input/body.txt
|
|
127
|
-
- fuzz/request/input/simple.txt
|
|
128
|
-
- fuzz/request/script.rb
|
|
129
103
|
- lib/protocol/http1.rb
|
|
130
104
|
- lib/protocol/http1/body/chunked.rb
|
|
131
105
|
- lib/protocol/http1/body/fixed.rb
|
|
@@ -134,18 +108,17 @@ files:
|
|
|
134
108
|
- lib/protocol/http1/error.rb
|
|
135
109
|
- lib/protocol/http1/reason.rb
|
|
136
110
|
- lib/protocol/http1/version.rb
|
|
137
|
-
- protocol-http1.gemspec
|
|
138
111
|
homepage: https://github.com/socketry/protocol-http1
|
|
139
112
|
licenses:
|
|
140
113
|
- MIT
|
|
141
114
|
metadata: {}
|
|
142
|
-
post_install_message:
|
|
115
|
+
post_install_message:
|
|
143
116
|
rdoc_options: []
|
|
144
117
|
require_paths:
|
|
145
118
|
- lib
|
|
146
119
|
required_ruby_version: !ruby/object:Gem::Requirement
|
|
147
120
|
requirements:
|
|
148
|
-
- - "
|
|
121
|
+
- - ">="
|
|
149
122
|
- !ruby/object:Gem::Version
|
|
150
123
|
version: '2.4'
|
|
151
124
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
|
@@ -154,8 +127,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
154
127
|
- !ruby/object:Gem::Version
|
|
155
128
|
version: '0'
|
|
156
129
|
requirements: []
|
|
157
|
-
rubygems_version: 3.
|
|
158
|
-
signing_key:
|
|
130
|
+
rubygems_version: 3.0.3
|
|
131
|
+
signing_key:
|
|
159
132
|
specification_version: 4
|
|
160
133
|
summary: A low level implementation of the HTTP/1 protocol.
|
|
161
134
|
test_files: []
|
data/.editorconfig
DELETED
data/.gitignore
DELETED
data/.rspec
DELETED
data/.travis.yml
DELETED
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
language: ruby
|
|
2
|
-
dist: xenial
|
|
3
|
-
cache: bundler
|
|
4
|
-
|
|
5
|
-
script: bundle exec rspec
|
|
6
|
-
|
|
7
|
-
matrix:
|
|
8
|
-
include:
|
|
9
|
-
- rvm: 2.5
|
|
10
|
-
- rvm: 2.6
|
|
11
|
-
- rvm: 2.7
|
|
12
|
-
- rvm: 2.6
|
|
13
|
-
env: COVERAGE=PartialSummary,Coveralls
|
|
14
|
-
- rvm: truffleruby
|
|
15
|
-
- rvm: jruby-head
|
|
16
|
-
env: JRUBY_OPTS="--debug -X+O"
|
|
17
|
-
- rvm: ruby-head
|
|
18
|
-
allow_failures:
|
|
19
|
-
- rvm: truffleruby
|
|
20
|
-
- rvm: ruby-head
|
|
21
|
-
- rvm: jruby-head
|
data/Gemfile
DELETED
data/README.md
DELETED
|
@@ -1,92 +0,0 @@
|
|
|
1
|
-
# Protocol::HTTP1
|
|
2
|
-
|
|
3
|
-
Provides a low-level implementation of the HTTP/1 protocol.
|
|
4
|
-
|
|
5
|
-
[](https://travis-ci.com/socketry/protocol-http1)
|
|
6
|
-
|
|
7
|
-
## Installation
|
|
8
|
-
|
|
9
|
-
Add this line to your application's Gemfile:
|
|
10
|
-
|
|
11
|
-
```ruby
|
|
12
|
-
gem 'protocol-http1'
|
|
13
|
-
```
|
|
14
|
-
|
|
15
|
-
And then execute:
|
|
16
|
-
|
|
17
|
-
$ bundle
|
|
18
|
-
|
|
19
|
-
Or install it yourself as:
|
|
20
|
-
|
|
21
|
-
$ gem install protocol-http1
|
|
22
|
-
|
|
23
|
-
## Usage
|
|
24
|
-
|
|
25
|
-
Here is a basic HTTP/1.1 client:
|
|
26
|
-
|
|
27
|
-
```ruby
|
|
28
|
-
require 'async'
|
|
29
|
-
require 'async/io/stream'
|
|
30
|
-
require 'async/http/endpoint'
|
|
31
|
-
require 'protocol/http1/connection'
|
|
32
|
-
|
|
33
|
-
Async do
|
|
34
|
-
endpoint = Async::HTTP::Endpoint.parse("https://www.google.com/search?q=kittens", alpn_protocols: ["http/1.1"])
|
|
35
|
-
|
|
36
|
-
peer = endpoint.connect
|
|
37
|
-
|
|
38
|
-
puts "Connected to #{peer} #{peer.remote_address.inspect}"
|
|
39
|
-
|
|
40
|
-
# IO Buffering...
|
|
41
|
-
stream = Async::IO::Stream.new(peer)
|
|
42
|
-
client = Protocol::HTTP1::Connection.new(stream)
|
|
43
|
-
|
|
44
|
-
def client.read_line
|
|
45
|
-
@stream.read_until(Protocol::HTTP1::Connection::CRLF) or raise EOFError
|
|
46
|
-
end
|
|
47
|
-
|
|
48
|
-
puts "Writing request..."
|
|
49
|
-
client.write_request("www.google.com", "GET", "/search?q=kittens", "HTTP/1.1", [["Accept", "*/*"]])
|
|
50
|
-
client.write_body(nil)
|
|
51
|
-
|
|
52
|
-
puts "Reading response..."
|
|
53
|
-
response = client.read_response("GET")
|
|
54
|
-
|
|
55
|
-
puts "Got response: #{response.inspect}"
|
|
56
|
-
|
|
57
|
-
puts "Closing client..."
|
|
58
|
-
client.close
|
|
59
|
-
end
|
|
60
|
-
```
|
|
61
|
-
|
|
62
|
-
## Contributing
|
|
63
|
-
|
|
64
|
-
1. Fork it
|
|
65
|
-
2. Create your feature branch (`git checkout -b my-new-feature`)
|
|
66
|
-
3. Commit your changes (`git commit -am 'Add some feature'`)
|
|
67
|
-
4. Push to the branch (`git push origin my-new-feature`)
|
|
68
|
-
5. Create new Pull Request
|
|
69
|
-
|
|
70
|
-
## License
|
|
71
|
-
|
|
72
|
-
Released under the MIT license.
|
|
73
|
-
|
|
74
|
-
Copyright, 2019, by [Samuel G. D. Williams](http://www.codeotaku.com/samuel-williams).
|
|
75
|
-
|
|
76
|
-
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
77
|
-
of this software and associated documentation files (the "Software"), to deal
|
|
78
|
-
in the Software without restriction, including without limitation the rights
|
|
79
|
-
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
80
|
-
copies of the Software, and to permit persons to whom the Software is
|
|
81
|
-
furnished to do so, subject to the following conditions:
|
|
82
|
-
|
|
83
|
-
The above copyright notice and this permission notice shall be included in
|
|
84
|
-
all copies or substantial portions of the Software.
|
|
85
|
-
|
|
86
|
-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
87
|
-
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
88
|
-
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
89
|
-
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
90
|
-
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
91
|
-
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
|
92
|
-
THE SOFTWARE.
|
data/examples/http1/request.rb
DELETED
|
@@ -1,39 +0,0 @@
|
|
|
1
|
-
# frozen_string_literal: true
|
|
2
|
-
|
|
3
|
-
$LOAD_PATH.unshift File.expand_path("../../lib", __dir__)
|
|
4
|
-
|
|
5
|
-
require 'async'
|
|
6
|
-
require 'async/io/stream'
|
|
7
|
-
require 'async/http/endpoint'
|
|
8
|
-
require 'protocol/http1/connection'
|
|
9
|
-
require 'pry'
|
|
10
|
-
|
|
11
|
-
Async do
|
|
12
|
-
endpoint = Async::HTTP::Endpoint.parse("https://www.google.com/search?q=kittens", alpn_protocols: ["http/1.1"])
|
|
13
|
-
|
|
14
|
-
peer = endpoint.connect
|
|
15
|
-
|
|
16
|
-
puts "Connected to #{peer} #{peer.remote_address.inspect}"
|
|
17
|
-
|
|
18
|
-
# IO Buffering...
|
|
19
|
-
stream = Async::IO::Stream.new(peer)
|
|
20
|
-
client = Protocol::HTTP1::Connection.new(stream)
|
|
21
|
-
|
|
22
|
-
def client.read_line
|
|
23
|
-
@stream.read_until(Protocol::HTTP1::Connection::CRLF) or raise EOFError
|
|
24
|
-
end
|
|
25
|
-
|
|
26
|
-
puts "Writing request..."
|
|
27
|
-
client.write_request("www.google.com", "GET", "/search?q=kittens", "HTTP/1.1", [["Accept", "*/*"]])
|
|
28
|
-
client.write_body(nil)
|
|
29
|
-
|
|
30
|
-
puts "Reading response..."
|
|
31
|
-
response = client.read_response("GET")
|
|
32
|
-
|
|
33
|
-
puts "Got response: #{response.inspect}"
|
|
34
|
-
|
|
35
|
-
puts "Closing client..."
|
|
36
|
-
client.close
|
|
37
|
-
end
|
|
38
|
-
|
|
39
|
-
puts "Exiting."
|
data/fuzz/request/bake.rb
DELETED
data/fuzz/request/input/body.txt
DELETED
data/fuzz/request/script.rb
DELETED
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env ruby
|
|
2
|
-
|
|
3
|
-
require 'socket'
|
|
4
|
-
require_relative '../../lib/protocol/http1'
|
|
5
|
-
|
|
6
|
-
def test
|
|
7
|
-
# input, output = Socket.pair(Socket::PF_UNIX, Socket::SOCK_STREAM)
|
|
8
|
-
|
|
9
|
-
server = Protocol::HTTP1::Connection.new($stdin)
|
|
10
|
-
|
|
11
|
-
# input.write($stdin.read)
|
|
12
|
-
# input.close
|
|
13
|
-
|
|
14
|
-
begin
|
|
15
|
-
host, method, path, version, headers, body = server.read_request
|
|
16
|
-
|
|
17
|
-
body = server.read_request_body(method, headers)
|
|
18
|
-
rescue Protocol::HTTP1::InvalidRequest
|
|
19
|
-
# Ignore.
|
|
20
|
-
end
|
|
21
|
-
end
|
|
22
|
-
|
|
23
|
-
if ENV["_"] =~ /afl/
|
|
24
|
-
require 'kisaten'
|
|
25
|
-
Kisaten.crash_at [], [], Signal.list['USR1']
|
|
26
|
-
|
|
27
|
-
while Kisaten.loop 10000
|
|
28
|
-
test
|
|
29
|
-
end
|
|
30
|
-
else
|
|
31
|
-
test
|
|
32
|
-
end
|
data/protocol-http1.gemspec
DELETED
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
|
|
2
|
-
require_relative 'lib/protocol/http1/version'
|
|
3
|
-
|
|
4
|
-
Gem::Specification.new do |spec|
|
|
5
|
-
spec.name = "protocol-http1"
|
|
6
|
-
spec.version = Protocol::HTTP1::VERSION
|
|
7
|
-
spec.authors = ["Samuel Williams"]
|
|
8
|
-
spec.email = ["samuel.williams@oriontransfer.co.nz"]
|
|
9
|
-
|
|
10
|
-
spec.summary = "A low level implementation of the HTTP/1 protocol."
|
|
11
|
-
spec.homepage = "https://github.com/socketry/protocol-http1"
|
|
12
|
-
spec.license = "MIT"
|
|
13
|
-
|
|
14
|
-
spec.files = Dir.chdir(File.expand_path('..', __FILE__)) do
|
|
15
|
-
`git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
|
|
16
|
-
end
|
|
17
|
-
|
|
18
|
-
spec.required_ruby_version = "~> 2.4"
|
|
19
|
-
|
|
20
|
-
spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
|
|
21
|
-
spec.require_paths = ["lib"]
|
|
22
|
-
|
|
23
|
-
spec.add_dependency "protocol-http", "~> 0.19"
|
|
24
|
-
|
|
25
|
-
spec.add_development_dependency "covered"
|
|
26
|
-
spec.add_development_dependency "bundler"
|
|
27
|
-
spec.add_development_dependency "bake-bundler"
|
|
28
|
-
spec.add_development_dependency "rspec", "~> 3.0"
|
|
29
|
-
spec.add_development_dependency "rspec-memory", "~> 1.0"
|
|
30
|
-
spec.add_development_dependency "rspec-files", "~> 1.0"
|
|
31
|
-
end
|