hayabusa 0.0.25 → 0.0.28

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: 5ec32bf3a53fd6d789fa92f73e9aecd4604ab514
4
- data.tar.gz: 7428cea3aca44c9d15a91957ad8368ed5ded606a
3
+ metadata.gz: bd7ec4c88a34a72469fb9c68fa761f3c19d29167
4
+ data.tar.gz: 6a995b84d0c480348b0075fc175484d94f4ebbac
5
5
  SHA512:
6
- metadata.gz: 41a060c14eddd7e1b1b1ab721ae01bf178560b367a9920795128512e72f83cc535a3783adc33ff03281959f85b218be7325bdbec8503ead7d39c253fcb45bc0c
7
- data.tar.gz: 0a45f0ffa81f9a4d5aeaf08db73677454716f4d428f2df6cc117d0d4fb044dcee43c37bcffc6da1251a857ea6e4d080ef06fb313913d93b07ae1dfe71c26a2af
6
+ metadata.gz: 6691e6935969b440bfa9dbe66b65e0c0bb908b45d69d1907ec3621ec834fd2b9d9631afb956539bcd1a8991f0a7e5c1cb258b5cc406b2c067801e842b34fca47
7
+ data.tar.gz: 00a35f4552f381effb0329dcd857f49cfd19bc1a80662a5c3117fcc053bd5c3b170f6f23f916b3fe8d84049a77180d0b0e256c2eec7d048a86ed0dad2db33780
data/Gemfile CHANGED
@@ -3,7 +3,8 @@ source "http://rubygems.org"
3
3
  # Example:
4
4
  # gem "activesupport", ">= 2.3.5"
5
5
 
6
- gem "knjrbfw"
6
+ gem "knjrbfw", "0.0.110"
7
+ gem "wref", "0.0.6"
7
8
  gem "erubis"
8
9
  gem "mail"
9
10
  gem "datet"
@@ -30,7 +30,7 @@ GEM
30
30
  rdoc
31
31
  json (1.8.0)
32
32
  jwt (1.2.0)
33
- knjrbfw (0.0.107)
33
+ knjrbfw (0.0.110)
34
34
  datet
35
35
  http2
36
36
  php4r
@@ -91,7 +91,7 @@ DEPENDENCIES
91
91
  http2
92
92
  jeweler (~> 1.8.8)
93
93
  json
94
- knjrbfw
94
+ knjrbfw (= 0.0.110)
95
95
  mail
96
96
  php4r
97
97
  rmagick
@@ -99,3 +99,7 @@ DEPENDENCIES
99
99
  ruby_process
100
100
  sqlite3
101
101
  tpool
102
+ wref (= 0.0.6)
103
+
104
+ BUNDLED WITH
105
+ 1.11.2
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.0.25
1
+ 0.0.28
@@ -2,16 +2,16 @@
2
2
  # DO NOT EDIT THIS FILE DIRECTLY
3
3
  # Instead, edit Jeweler::Tasks in Rakefile, and run 'rake gemspec'
4
4
  # -*- encoding: utf-8 -*-
5
- # stub: hayabusa 0.0.25 ruby lib
5
+ # stub: hayabusa 0.0.28 ruby lib
6
6
 
7
7
  Gem::Specification.new do |s|
8
8
  s.name = "hayabusa"
9
- s.version = "0.0.25"
9
+ s.version = "0.0.28"
10
10
 
11
11
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
12
12
  s.require_paths = ["lib"]
13
13
  s.authors = ["Kasper Johansen"]
14
- s.date = "2014-12-06"
14
+ s.date = "2016-05-03"
15
15
  s.description = "A threadded web/app-server that focuses on threadding, shared ressources, speed and more."
16
16
  s.email = "k@spernj.org"
17
17
  s.executables = ["check_running.rb", "hayabusa_benchmark.rb", "hayabusa_cgi.rb", "hayabusa_fcgi.fcgi", "hayabusa_fcgi.rb", "hayabusa_fcgi_server.rb", "hayabusa_spec_restart.rb", "knjappserver_start.rb"]
@@ -111,14 +111,15 @@ Gem::Specification.new do |s|
111
111
  ]
112
112
  s.homepage = "http://github.com/kaspernj/hayabusa"
113
113
  s.licenses = ["MIT"]
114
- s.rubygems_version = "2.4.0"
114
+ s.rubygems_version = "2.2.2"
115
115
  s.summary = "A threadded web/app-server that supports stand-alone, CGI and FCGI-modes."
116
116
 
117
117
  if s.respond_to? :specification_version then
118
118
  s.specification_version = 4
119
119
 
120
120
  if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
121
- s.add_runtime_dependency(%q<knjrbfw>, [">= 0"])
121
+ s.add_runtime_dependency(%q<knjrbfw>, ["= 0.0.110"])
122
+ s.add_runtime_dependency(%q<wref>, ["= 0.0.6"])
122
123
  s.add_runtime_dependency(%q<erubis>, [">= 0"])
123
124
  s.add_runtime_dependency(%q<mail>, [">= 0"])
124
125
  s.add_runtime_dependency(%q<datet>, [">= 0"])
@@ -133,7 +134,8 @@ Gem::Specification.new do |s|
133
134
  s.add_development_dependency(%q<sqlite3>, [">= 0"])
134
135
  s.add_development_dependency(%q<php4r>, [">= 0"])
135
136
  else
136
- s.add_dependency(%q<knjrbfw>, [">= 0"])
137
+ s.add_dependency(%q<knjrbfw>, ["= 0.0.110"])
138
+ s.add_dependency(%q<wref>, ["= 0.0.6"])
137
139
  s.add_dependency(%q<erubis>, [">= 0"])
138
140
  s.add_dependency(%q<mail>, [">= 0"])
139
141
  s.add_dependency(%q<datet>, [">= 0"])
@@ -149,7 +151,8 @@ Gem::Specification.new do |s|
149
151
  s.add_dependency(%q<php4r>, [">= 0"])
150
152
  end
151
153
  else
152
- s.add_dependency(%q<knjrbfw>, [">= 0"])
154
+ s.add_dependency(%q<knjrbfw>, ["= 0.0.110"])
155
+ s.add_dependency(%q<wref>, ["= 0.0.6"])
153
156
  s.add_dependency(%q<erubis>, [">= 0"])
154
157
  s.add_dependency(%q<mail>, [">= 0"])
155
158
  s.add_dependency(%q<datet>, [">= 0"])
@@ -3,7 +3,7 @@ require "time"
3
3
  #This object writes headers, trailing headers, status headers and more for HTTP-sessions.
4
4
  class Hayabusa::Http_session::Response
5
5
  attr_accessor :chunked, :cgroup, :nl, :status, :http_version, :headers, :headers_trailing, :headers_sent, :socket
6
-
6
+
7
7
  STATUS_CODES = {
8
8
  100 => "Continue",
9
9
  200 => "OK",
@@ -22,16 +22,17 @@ class Hayabusa::Http_session::Response
22
22
  403 => "Forbidden",
23
23
  404 => "Not Found",
24
24
  408 => "Request Timeout",
25
+ 415 => "Unsupported media type",
25
26
  500 => "Internal Server Error"
26
27
  }
27
28
  NL = "\r\n"
28
-
29
+
29
30
  def initialize(args)
30
31
  @chunked = false
31
32
  @socket = args[:socket]
32
33
  @hb = args[:hb]
33
34
  end
34
-
35
+
35
36
  def reset(args)
36
37
  @status = 200
37
38
  @http_version = args[:http_version]
@@ -45,20 +46,20 @@ class Hayabusa::Http_session::Response
45
46
  @headers_trailing = {}
46
47
  @mode = args[:mode]
47
48
  @cookies = []
48
-
49
+
49
50
  @headers = {
50
51
  "date" => ["Date", Time.now.httpdate]
51
52
  }
52
-
53
+
53
54
  if args[:mode] != :cgi and (!args.key?(:chunked) or args[:chunked])
54
55
  @chunked = true
55
56
  end
56
57
  end
57
-
58
+
58
59
  def header(key, val)
59
60
  lines = val.to_s.count("\n") + 1
60
61
  raise "Value contains more lines than 1 (#{lines})." if lines > 1
61
-
62
+
62
63
  if !@headers_sent
63
64
  @headers[key.to_s.downcase.strip] = [key, val]
64
65
  else
@@ -66,32 +67,32 @@ class Hayabusa::Http_session::Response
66
67
  @headers_trailing[key.to_s.downcase.strip] = [key, val]
67
68
  end
68
69
  end
69
-
70
+
70
71
  # Returns the value of a header.
71
72
  def get_header_value(header)
72
73
  header_p = header.to_s.downcase.strip
73
-
74
+
74
75
  gothrough = [@headers, @headers_trailing]
75
76
  gothrough.each do |headers|
76
77
  headers.each do |key, val|
77
78
  return val[1] if header_p == key
78
79
  end
79
80
  end
80
-
81
+
81
82
  return nil
82
83
  end
83
-
84
+
84
85
  # Returns true if the given header-name is sat.
85
86
  def has_header?(header)
86
87
  header_p = header.to_s.downcase.strip
87
88
  return @headers.key?(header_p) || @headers_trailing.key?(header_p)
88
89
  end
89
-
90
+
90
91
  def cookie(cookie)
91
92
  @cookies << cookie
92
93
  @session_cookie[cookie["name"]] = cookie["value"]
93
94
  end
94
-
95
+
95
96
  def header_str
96
97
  if @http_version == "1.1" && @chunked
97
98
  self.header("Connection", "Keep-Alive")
@@ -99,9 +100,9 @@ class Hayabusa::Http_session::Response
99
100
  elsif @http_version == "1.1" && get_header_value("content-length").to_i > 0
100
101
  self.header("Connection", "Keep-Alive")
101
102
  end
102
-
103
+
103
104
  self.header("Keep-Alive", "timeout=15, max=30") if self.get_header_value("connection") == "Keep-Alive"
104
-
105
+
105
106
  if @skip_statuscode
106
107
  res = ""
107
108
  else
@@ -110,67 +111,67 @@ class Hayabusa::Http_session::Response
110
111
  else
111
112
  res = "HTTP/1.1 #{@status}"
112
113
  end
113
-
114
+
114
115
  code = STATUS_CODES[@status]
115
116
  res << " #{code}" if code
116
117
  res << NL
117
118
  end
118
-
119
+
119
120
  # The status header is used to make CGI or FCGI use the correct status-code.
120
121
  self.header("Status", "#{@status} #{STATUS_CODES[@status]}")
121
-
122
+
122
123
  @headers.each do |key, val|
123
124
  res << "#{val[0]}: #{val[1]}#{NL}"
124
125
  end
125
-
126
+
126
127
  if @http_version == "1.1"
127
128
  @trailers.each do |trailer|
128
129
  res << "Trailer: #{trailer}#{NL}"
129
130
  end
130
131
  end
131
-
132
+
132
133
  @cookies.each do |cookie|
133
134
  res << "Set-Cookie: #{Knj::Web.cookie_str(cookie)}#{NL}"
134
135
  end
135
-
136
+
136
137
  res << NL
137
-
138
+
138
139
  return res
139
140
  end
140
-
141
+
141
142
  def write
142
143
  # Write headers to socket.
143
144
  @socket.write(self.header_str)
144
145
  @headers_sent = true
145
146
  @cgroup.chunked = @chunked
146
-
147
+
147
148
  # Set the content-length on the content-group to enable write-lenght-validation.
148
149
  if self.has_header?("content-length")
149
150
  @cgroup.content_length = self.get_header_value("content-length").to_i
150
151
  else
151
152
  @cgroup.content_length = nil
152
153
  end
153
-
154
+
154
155
  if @chunked
155
156
  @cgroup.write_to_socket
156
157
  @socket.write("0#{NL}")
157
-
158
+
158
159
  @headers_trailing.each do |header_id_str, header|
159
160
  @socket.write("#{header[0]}: #{header[1]}#{NL}")
160
161
  end
161
-
162
+
162
163
  @socket.write(NL)
163
164
  else
164
165
  @cgroup.write_to_socket
165
166
  end
166
-
167
+
167
168
  # Validate that no more has been written than given in content-length, since that will corrupt the client.
168
169
  if self.has_header?("content-length")
169
170
  length = cgroup.length_written
170
171
  content_length = self.get_header_value("content-length").to_i
171
172
  raise "More written than given in content-length: #{length}, #{content_length}" if length != content_length
172
173
  end
173
-
174
+
174
175
  # Close socket if that should be done.
175
176
  if @close and @mode != :cgi
176
177
  @hb.log_puts("Hauabusa: Closing socket.")
metadata CHANGED
@@ -1,29 +1,43 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: hayabusa
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.25
4
+ version: 0.0.28
5
5
  platform: ruby
6
6
  authors:
7
7
  - Kasper Johansen
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-12-06 00:00:00.000000000 Z
11
+ date: 2016-05-03 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: knjrbfw
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
- - - ">="
17
+ - - '='
18
18
  - !ruby/object:Gem::Version
19
- version: '0'
19
+ version: 0.0.110
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.0.110
27
+ - !ruby/object:Gem::Dependency
28
+ name: wref
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - '='
32
+ - !ruby/object:Gem::Version
33
+ version: 0.0.6
34
+ type: :runtime
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - '='
39
+ - !ruby/object:Gem::Version
40
+ version: 0.0.6
27
41
  - !ruby/object:Gem::Dependency
28
42
  name: erubis
29
43
  requirement: !ruby/object:Gem::Requirement
@@ -331,7 +345,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
331
345
  version: '0'
332
346
  requirements: []
333
347
  rubyforge_project:
334
- rubygems_version: 2.4.0
348
+ rubygems_version: 2.2.2
335
349
  signing_key:
336
350
  specification_version: 4
337
351
  summary: A threadded web/app-server that supports stand-alone, CGI and FCGI-modes.