webify 0.3.0 → 0.3.1

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.
@@ -1,3 +1,5 @@
1
+ require 'socket'
2
+
1
3
  require 'webify/version'
2
4
  require 'webify/runner'
3
5
 
@@ -3,6 +3,21 @@ require 'webrick'
3
3
  module Webify
4
4
  module Backend
5
5
 
6
+ class WebrickNoCacheFileHandler < WEBrick::HTTPServlet::FileHandler
7
+ def prevent_caching(res)
8
+ res['ETag'] = nil
9
+ res['Last-Modified'] = Time.now + 100**4
10
+ res['Cache-Control'] = 'no-store, no-cache, must-revalidate, post-check=0, pre-check=0'
11
+ res['Pragma'] = 'no-cache'
12
+ res['Expires'] = Time.now - 100**4
13
+ end
14
+
15
+ def do_GET(req, res)
16
+ super
17
+ prevent_caching(res)
18
+ end
19
+ end
20
+
6
21
  class Webrick
7
22
  include ::WEBrick
8
23
 
@@ -15,6 +30,8 @@ module Webify
15
30
  :DocumentRoot => dir
16
31
  )
17
32
 
33
+ server.mount "/", WebrickNoCacheFileHandler, "./"
34
+
18
35
  trap('INT') { server.shutdown }
19
36
  server.start
20
37
  end
@@ -1,3 +1,3 @@
1
1
  module Webify
2
- VERSION = '0.3.0'
2
+ VERSION = '0.3.1'
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: webify
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.0
4
+ version: 0.3.1
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -10,7 +10,7 @@ authors:
10
10
  autorequire:
11
11
  bindir: bin
12
12
  cert_chain: []
13
- date: 2011-12-29 00:00:00.000000000 Z
13
+ date: 2012-08-07 00:00:00.000000000 Z
14
14
  dependencies: []
15
15
  description: Serve any directory to your browser
16
16
  email:
@@ -49,8 +49,9 @@ required_rubygems_version: !ruby/object:Gem::Requirement
49
49
  version: 1.3.6
50
50
  requirements: []
51
51
  rubyforge_project:
52
- rubygems_version: 1.8.13
52
+ rubygems_version: 1.8.23
53
53
  signing_key:
54
54
  specification_version: 3
55
55
  summary: Serve any directory to your browser
56
56
  test_files: []
57
+ has_rdoc: