qeweney 0.11 → 0.13
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +10 -0
- data/Gemfile.lock +1 -1
- data/README.md +5 -1
- data/lib/qeweney/rack.rb +21 -0
- data/lib/qeweney/request.rb +10 -26
- data/lib/qeweney/version.rb +1 -1
- data/test/test_response.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 742be1b1238ea117928a544134e57702776b707caf0cccdf68b74225ff3990d7
|
4
|
+
data.tar.gz: 357beb13e5f99b3f776de0a9e30447a034a647af208c1d69adedc118cabe8be1
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 2b0249f07ce24a2acb3d9d20a9a43927de50217b9b27d23b911819c50ad6ca6312c395c966ebd57fda8db69908de392667ed3294ced76d4143b1ecbc37820cef
|
7
|
+
data.tar.gz: c80e535de1921e6b655a019c74a1a35fc808a9a7088ef368b84a485b42582d37d03ac9eb53250fd73277fe077cdd6c28ae6a4f60b814931fd6150f22ab929a42
|
data/CHANGELOG.md
CHANGED
@@ -1,3 +1,13 @@
|
|
1
|
+
## 0.13 2021-08-02
|
2
|
+
|
3
|
+
- Restore `Request#complete?` method
|
4
|
+
- Add buffered_only argument to `Request#next_chunk`
|
5
|
+
|
6
|
+
## 0.12 2021-07-30
|
7
|
+
|
8
|
+
- Remove `Request#consume` method
|
9
|
+
- Remove `Request#complete?` and associated methods
|
10
|
+
|
1
11
|
## 0.11 2021-07-26
|
2
12
|
|
3
13
|
- Fix rack env (digital-fabric/tipi#11)
|
data/Gemfile.lock
CHANGED
data/README.md
CHANGED
@@ -1,4 +1,8 @@
|
|
1
|
-
# Qeweney
|
1
|
+
# Qeweney - add water, makes its own sauce!
|
2
|
+
|
3
|
+
[![Gem Version](https://badge.fury.io/rb/qeweney.svg)](http://rubygems.org/gems/qeweney)
|
4
|
+
[![Modulation Test](https://github.com/digital-fabric/qeweney/workflows/Tests/badge.svg)](https://github.com/digital-fabric/qeweney/actions?query=workflow%3ATests)
|
5
|
+
[![MIT licensed](https://img.shields.io/badge/license-MIT-blue.svg)](https://github.com/digital-fabric/qeweney/blob/master/LICENSE)
|
2
6
|
|
3
7
|
## Cross-library HTTP request / response API for servers
|
4
8
|
|
data/lib/qeweney/rack.rb
CHANGED
@@ -67,12 +67,33 @@ module Qeweney
|
|
67
67
|
end
|
68
68
|
end
|
69
69
|
|
70
|
+
# TODO: integrate in env
|
71
|
+
# Implements a rack input stream:
|
72
|
+
# https://www.rubydoc.info/github/rack/rack/master/file/SPEC#label-The+Input+Stream
|
73
|
+
class InputStream
|
74
|
+
def initialize(request)
|
75
|
+
@request = request
|
76
|
+
end
|
77
|
+
|
78
|
+
def gets; end
|
79
|
+
|
80
|
+
def read(length = nil, outbuf = nil); end
|
81
|
+
|
82
|
+
def each(&block)
|
83
|
+
@request.each_chunk(&block)
|
84
|
+
end
|
85
|
+
|
86
|
+
def rewind; end
|
87
|
+
end
|
88
|
+
|
70
89
|
def self.rack_env_from_request(request)
|
71
90
|
Hash.new do |h, k|
|
72
91
|
h[k] = rack_env_value_from_request(request, k)
|
73
92
|
end
|
74
93
|
end
|
75
94
|
|
95
|
+
# TODO: improve conformance to rack spec
|
96
|
+
# TODO: set values like port, scheme etc from actual connection
|
76
97
|
RACK_ENV = {
|
77
98
|
'SCRIPT_NAME' => '',
|
78
99
|
'rack.version' => [1, 3],
|
data/lib/qeweney/request.rb
CHANGED
@@ -27,14 +27,16 @@ module Qeweney
|
|
27
27
|
@buffered_body_chunks << chunk
|
28
28
|
end
|
29
29
|
|
30
|
-
def next_chunk
|
30
|
+
def next_chunk(buffered_only = false)
|
31
31
|
if @buffered_body_chunks
|
32
32
|
chunk = @buffered_body_chunks.shift
|
33
33
|
@buffered_body_chunks = nil if @buffered_body_chunks.empty?
|
34
34
|
return chunk
|
35
|
+
elsif buffered_only
|
36
|
+
return nil
|
35
37
|
end
|
36
38
|
|
37
|
-
@
|
39
|
+
@adapter.get_body_chunk(self, buffered_only)
|
38
40
|
end
|
39
41
|
|
40
42
|
def each_chunk
|
@@ -44,37 +46,19 @@ module Qeweney
|
|
44
46
|
end
|
45
47
|
@buffered_body_chunks = nil
|
46
48
|
end
|
47
|
-
while
|
49
|
+
while (chunk = @adapter.get_body_chunk(self))
|
48
50
|
yield chunk
|
49
51
|
end
|
50
52
|
end
|
51
53
|
|
52
|
-
def complete!(keep_alive = nil)
|
53
|
-
@message_complete = true
|
54
|
-
@keep_alive = keep_alive
|
55
|
-
end
|
56
|
-
|
57
|
-
def complete?
|
58
|
-
@message_complete
|
59
|
-
end
|
60
|
-
|
61
|
-
def consume
|
62
|
-
@adapter.consume_request(self)
|
63
|
-
end
|
64
|
-
|
65
|
-
def keep_alive?
|
66
|
-
@keep_alive
|
67
|
-
end
|
68
|
-
|
69
54
|
def read
|
70
|
-
|
71
|
-
while (chunk = @adapter.get_body_chunk(self))
|
72
|
-
(buf ||= +'') << chunk
|
73
|
-
end
|
74
|
-
@buffered_body_chunks = nil
|
75
|
-
buf
|
55
|
+
@adapter.get_body(self)
|
76
56
|
end
|
77
57
|
alias_method :body, :read
|
58
|
+
|
59
|
+
def complete?
|
60
|
+
@adapter.complete?(self)
|
61
|
+
end
|
78
62
|
|
79
63
|
def respond(body, headers = {})
|
80
64
|
@adapter.respond(self, body, headers)
|
data/lib/qeweney/version.rb
CHANGED
data/test/test_response.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: qeweney
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: '0.
|
4
|
+
version: '0.13'
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Sharon Rosner
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2021-
|
11
|
+
date: 2021-08-02 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: escape_utils
|