em-midori 0.4.2.1 → 0.4.3
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/midori/request.rb +11 -5
- data/lib/midori/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 533ced1d48f947ed30bc75dc92a3f5ef39026e70
|
4
|
+
data.tar.gz: 8ea965e0520a2d69a92db84d80a486a2b4461a4a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f5ece810cdc7e67baaa203c0230c4208cf1070cbed89a2b6246e987c3996f600a9fd3a5ca4215096a090e1c3b78fbc0098da973a804ce4cc711a7fd722a42c3b
|
7
|
+
data.tar.gz: 69c33e531a9b83b226f28d5a83f98be640aaeb6f446f8761862ccfbb6aedf577be57258b5cbc839116ebb13e8962a21feb5111d11bcbe078dedd5abb8dadfdee
|
data/lib/midori/request.rb
CHANGED
@@ -5,26 +5,30 @@
|
|
5
5
|
# @attr [String] protocol protocol version of HTTP request
|
6
6
|
# @attr [Symbol] method HTTP method
|
7
7
|
# @attr [String] path request path
|
8
|
-
# @attr [Hash
|
8
|
+
# @attr [Hash] query_param parameter parsed from query string
|
9
9
|
# @attr [String | nil] query_string request query string
|
10
10
|
# @attr [Hash] header request header
|
11
11
|
# @attr [String] body request body
|
12
|
+
# @attr [Hash] cookie cookie hash coming from request
|
12
13
|
# @attr [Boolean] parsed whether the request header parsed
|
13
14
|
# @attr [Boolean] body_parsed whether the request body parsed
|
14
15
|
# @attr [Hash] params params in the url
|
15
16
|
class Midori::Request
|
16
17
|
attr_accessor :ip, :port,
|
17
|
-
:protocol, :method, :path, :
|
18
|
-
:header, :body, :parsed, :body_parsed, :params
|
18
|
+
:protocol, :method, :path, :query_params, :query_string,
|
19
|
+
:header, :body, :parsed, :body_parsed, :params, :cookie
|
19
20
|
|
20
21
|
# Init Request
|
21
22
|
def initialize
|
23
|
+
@header = {}
|
22
24
|
@parsed = false
|
23
25
|
@body_parsed = false
|
24
26
|
@is_websocket = false
|
25
27
|
@is_eventsource = false
|
26
28
|
@parser = Http::Parser.new
|
27
29
|
@params = {}
|
30
|
+
@query_params = Hash.new(Array.new)
|
31
|
+
@cookie = {}
|
28
32
|
@body = ''
|
29
33
|
@parser.on_headers_complete = proc do
|
30
34
|
@protocol = @parser.http_version
|
@@ -35,8 +39,10 @@ class Midori::Request
|
|
35
39
|
@query_string = @path.match(/\?(.*?)$/)
|
36
40
|
unless @query_string.nil?
|
37
41
|
@query_string = @query_string[1]
|
38
|
-
@
|
42
|
+
@query_params = CGI::parse(@query_string)
|
39
43
|
end
|
44
|
+
|
45
|
+
@cookie = CGI::Cookie.parse(@header['Cookie']) unless @header['Cookie'].nil?
|
40
46
|
@path.gsub!(/\?(.*?)$/, '')
|
41
47
|
@method = @method.to_sym
|
42
48
|
@parsed = true
|
@@ -57,7 +63,7 @@ class Midori::Request
|
|
57
63
|
end
|
58
64
|
|
59
65
|
# Set body parsed if body reaches content length
|
60
|
-
if (@header['Content-Length'].to_i || 0) <= @body.bytesize
|
66
|
+
if @parsed && (@header['Content-Length'].to_i || 0) <= @body.bytesize
|
61
67
|
@body_parsed = true
|
62
68
|
pre_proceed
|
63
69
|
end
|
data/lib/midori/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: em-midori
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.4.
|
4
|
+
version: 0.4.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- HeckPsi Lab
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-09-
|
11
|
+
date: 2017-09-04 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: murasaki
|