protocol-http1 0.12.0 → 0.13.0
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.
Potentially problematic release.
This version of protocol-http1 might be problematic. Click here for more details.
- checksums.yaml +4 -4
- data/fuzz/request/bake.rb +5 -0
- data/fuzz/request/input/body.txt +6 -0
- data/fuzz/request/input/simple.txt +2 -0
- data/fuzz/request/script.rb +32 -0
- data/lib/protocol/http1/connection.rb +13 -5
- data/lib/protocol/http1/version.rb +1 -1
- data/protocol-http1.gemspec +1 -1
- metadata +8 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 28184b21d65b6cde9ee2985a6680ecbd01ce6e63a6d812cc440a13a6785de072
|
4
|
+
data.tar.gz: de2c9f93370098fe72637140523e428ce5dc170b06af494b4d0cd424c4ecd3d9
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d42abab0bbb5c5b95efdbba9caf23b64ab4cad2d63b7ecf37abb5269ba726d42592f9a2eac673a987e5a72c116cee8a07c7ce8a929bd1fc7bc6ab7bab25b5be8
|
7
|
+
data.tar.gz: fdadc58aa32cbcd37672eda928fdc207f0180483266ae6813e726692b2c32858566439d1a4a7d1e48a7eebf7779539d39f973e1ff92cda0a87ba07fa884c2c26
|
@@ -0,0 +1,32 @@
|
|
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
|
@@ -281,14 +281,17 @@ module Protocol
|
|
281
281
|
|
282
282
|
def write_fixed_length_body(body, length, head)
|
283
283
|
@stream.write("content-length: #{length}\r\n\r\n")
|
284
|
-
@stream.flush
|
285
284
|
|
286
285
|
if head
|
286
|
+
@stream.flush
|
287
|
+
|
287
288
|
body.close
|
288
289
|
|
289
290
|
return
|
290
291
|
end
|
291
292
|
|
293
|
+
@stream.flush unless body.ready?
|
294
|
+
|
292
295
|
chunk_length = 0
|
293
296
|
body.each do |chunk|
|
294
297
|
chunk_length += chunk.bytesize
|
@@ -309,21 +312,25 @@ module Protocol
|
|
309
312
|
|
310
313
|
def write_chunked_body(body, head, trailers = nil)
|
311
314
|
@stream.write("transfer-encoding: chunked\r\n\r\n")
|
312
|
-
@stream.flush
|
313
315
|
|
314
316
|
if head
|
317
|
+
@stream.flush
|
318
|
+
|
315
319
|
body.close
|
316
320
|
|
317
321
|
return
|
318
322
|
end
|
319
323
|
|
324
|
+
@stream.flush unless body.ready?
|
325
|
+
|
320
326
|
body.each do |chunk|
|
321
327
|
next if chunk.size == 0
|
322
328
|
|
323
329
|
@stream.write("#{chunk.bytesize.to_s(16).upcase}\r\n")
|
324
330
|
@stream.write(chunk)
|
325
331
|
@stream.write(CRLF)
|
326
|
-
|
332
|
+
|
333
|
+
@stream.flush unless body.ready?
|
327
334
|
end
|
328
335
|
|
329
336
|
if trailers
|
@@ -342,14 +349,15 @@ module Protocol
|
|
342
349
|
@persistent = false
|
343
350
|
|
344
351
|
@stream.write("\r\n")
|
345
|
-
@stream.flush
|
352
|
+
@stream.flush unless body.ready?
|
346
353
|
|
347
354
|
if head
|
348
355
|
body.close
|
349
356
|
else
|
350
357
|
body.each do |chunk|
|
351
358
|
@stream.write(chunk)
|
352
|
-
|
359
|
+
|
360
|
+
@stream.flush unless body.ready?
|
353
361
|
end
|
354
362
|
end
|
355
363
|
|
data/protocol-http1.gemspec
CHANGED
@@ -20,7 +20,7 @@ Gem::Specification.new do |spec|
|
|
20
20
|
spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
|
21
21
|
spec.require_paths = ["lib"]
|
22
22
|
|
23
|
-
spec.add_dependency "protocol-http", "~> 0.
|
23
|
+
spec.add_dependency "protocol-http", "~> 0.19"
|
24
24
|
|
25
25
|
spec.add_development_dependency "covered"
|
26
26
|
spec.add_development_dependency "bundler"
|
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.
|
4
|
+
version: 0.13.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Samuel Williams
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2020-
|
11
|
+
date: 2020-05-05 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: protocol-http
|
@@ -16,14 +16,14 @@ dependencies:
|
|
16
16
|
requirements:
|
17
17
|
- - "~>"
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version: '0.
|
19
|
+
version: '0.19'
|
20
20
|
type: :runtime
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
24
|
- - "~>"
|
25
25
|
- !ruby/object:Gem::Version
|
26
|
-
version: '0.
|
26
|
+
version: '0.19'
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: covered
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
@@ -122,6 +122,10 @@ files:
|
|
122
122
|
- Gemfile
|
123
123
|
- README.md
|
124
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
|
125
129
|
- lib/protocol/http1.rb
|
126
130
|
- lib/protocol/http1/body/chunked.rb
|
127
131
|
- lib/protocol/http1/body/fixed.rb
|