utopia 0.9.53 → 0.9.54

Sign up to get free protection for your applications and to get access to all the features.
@@ -45,29 +45,35 @@ module Utopia
45
45
 
46
46
  private
47
47
 
48
- class FileReader
49
- def initialize(path)
48
+ class LocalFile
49
+ def initialize(root, path)
50
+ @root = root
50
51
  @path = path
51
- @etag = Digest::SHA1.hexdigest("#{File.size(@path)}#{mtime_date}")
52
+ @etag = Digest::SHA1.hexdigest("#{File.size(full_path)}#{mtime_date}")
52
53
  end
53
54
 
55
+ attr :root
54
56
  attr :path
55
57
  attr :etag
56
58
 
57
59
  def to_path
58
- @path
60
+ full_path
61
+ end
62
+
63
+ def full_path
64
+ File.join(@root, @path.components)
59
65
  end
60
66
 
61
67
  def mtime_date
62
- File.mtime(@path).httpdate
68
+ File.mtime(full_path).httpdate
63
69
  end
64
70
 
65
71
  def size
66
- File.size(@path)
72
+ File.size(full_path)
67
73
  end
68
74
 
69
75
  def each
70
- File.open(@path, "rb") do |fp|
76
+ File.open(full_path, "rb") do |fp|
71
77
  while part = fp.read(8192)
72
78
  yield part
73
79
  end
@@ -76,7 +82,7 @@ module Utopia
76
82
 
77
83
  def modified?(env)
78
84
  if modified_since = env['HTTP_IF_MODIFIED_SINCE']
79
- return false if File.mtime(@path) <= Time.parse(modified_since)
85
+ return false if File.mtime(full_path) <= Time.parse(modified_since)
80
86
  end
81
87
 
82
88
  if etags = env['HTTP_IF_NONE_MATCH']
@@ -134,8 +140,11 @@ module Utopia
134
140
  def sendfile(request, response)
135
141
  if @sendfile.respond_to?(:call)
136
142
  response = @sendfile.call(request.env, response)
137
- elsif @sendfile && request.env['HTTP_X_SENDFILE_MODE'] == "X-Sendfile"
138
- response[1]["X-Sendfile"] = response[2].to_path
143
+ elsif @sendfile && request.env['UTOPIA_SENDFILE'] == "X-Sendfile"
144
+ response[1]["X-Sendfile"] = response[2].full_path
145
+ response[2] = []
146
+ elsif @sendfile && request.env['UTOPIA_SENDFILE'] == "X-Accel-Redirect"
147
+ response[1]["X-Accel-Redirect"] = response[2].path.to_s
139
148
  response[2] = []
140
149
  end
141
150
 
@@ -170,7 +179,7 @@ module Utopia
170
179
  file_path = File.join(@root, path.components)
171
180
 
172
181
  if File.exist?(file_path)
173
- return FileReader.new(file_path)
182
+ return LocalFile.new(@root, path)
174
183
  else
175
184
  return nil
176
185
  end
@@ -0,0 +1 @@
1
+ The access log keeps track of all requests and is rotated automatically on a weekly basis.
@@ -14,7 +14,7 @@
14
14
  <link rel="stylesheet" href="/_static/site.css" type="text/css" media="screen" charset="utf-8" />
15
15
  </head>
16
16
 
17
- <body class="ledlighting">
17
+ <body>
18
18
  <div id="header">
19
19
  </div>
20
20
 
@@ -2,7 +2,6 @@
2
2
 
3
3
  body, p, ol, ul, blockquote {
4
4
  font-family: "Skia", verdana, arial, helvetica, sans-serif;
5
- line-height: 18px;
6
5
 
7
6
  color: #339;
8
7
  }
@@ -33,7 +32,6 @@ a:hover {
33
32
  }
34
33
 
35
34
  p, dl, h3 {
36
- line-height: 1.4em;
37
35
  margin: 1em;
38
36
  }
39
37
 
@@ -42,7 +40,6 @@ h3 {
42
40
  }
43
41
 
44
42
  ul {
45
- line-height: 1.4em;
46
43
  margin-bottom: 1em;
47
44
  }
48
45
 
@@ -6,7 +6,7 @@ module Utopia
6
6
  module VERSION
7
7
  MAJOR = 0
8
8
  MINOR = 9
9
- TINY = 53
9
+ TINY = 54
10
10
 
11
11
  STRING = [MAJOR, MINOR, TINY].join('.')
12
12
  end
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: utopia
3
3
  version: !ruby/object:Gem::Version
4
- hash: 81
4
+ hash: 87
5
5
  prerelease:
6
6
  segments:
7
7
  - 0
8
8
  - 9
9
- - 53
10
- version: 0.9.53
9
+ - 54
10
+ version: 0.9.54
11
11
  platform: ruby
12
12
  authors:
13
13
  - Samuel Williams
@@ -15,7 +15,7 @@ autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
17
 
18
- date: 2011-05-25 00:00:00 +12:00
18
+ date: 2011-05-26 00:00:00 +12:00
19
19
  default_executable: utopia
20
20
  dependencies:
21
21
  - !ruby/object:Gem::Dependency
@@ -123,6 +123,7 @@ files:
123
123
  - lib/utopia/middleware.rb
124
124
  - lib/utopia/path.rb
125
125
  - lib/utopia/session/encrypted_cookie.rb
126
+ - lib/utopia/setup/access_log/readme.txt
126
127
  - lib/utopia/setup/config.ru
127
128
  - lib/utopia/setup/lib/readme.txt
128
129
  - lib/utopia/setup/pages/_heading.xnode