em-midori 0.4.2.1 → 0.4.3

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 3403b4e12324aab9a3ac5fef9935b2e3a175a1ef
4
- data.tar.gz: 7fd93228398bfe363e2a46471d79e732298e2b57
3
+ metadata.gz: 533ced1d48f947ed30bc75dc92a3f5ef39026e70
4
+ data.tar.gz: 8ea965e0520a2d69a92db84d80a486a2b4461a4a
5
5
  SHA512:
6
- metadata.gz: 043435eae39f366e63ace82d4c74982b145dbc9bc0a061a92d380805b21bf9e729136c4c8316348f94d32d125b36fea5e8aa00099aac0813a0c7a69d664a9537
7
- data.tar.gz: c728f4b6d3e13840c250419ac6085369faab0e880750ca5ab39afcffc69b090ed3d87c03f2ec58a9d786ca48a98e564e5c04f1a3c3b54e667e1a4019883ca9dc
6
+ metadata.gz: f5ece810cdc7e67baaa203c0230c4208cf1070cbed89a2b6246e987c3996f600a9fd3a5ca4215096a090e1c3b78fbc0098da973a804ce4cc711a7fd722a42c3b
7
+ data.tar.gz: 69c33e531a9b83b226f28d5a83f98be640aaeb6f446f8761862ccfbb6aedf577be57258b5cbc839116ebb13e8962a21feb5111d11bcbe078dedd5abb8dadfdee
@@ -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 | nil] query_param parameter parsed from query string
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, :query_param, :query_string,
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
- @query_param = CGI::parse(@query_string)
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
@@ -1,5 +1,5 @@
1
1
  # Midori Module
2
2
  module Midori
3
3
  # Current Version Code
4
- VERSION = '0.4.2.1'.freeze
4
+ VERSION = '0.4.3'.freeze
5
5
  end
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.2.1
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-02 00:00:00.000000000 Z
11
+ date: 2017-09-04 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: murasaki