httpme 0.1.1 → 0.1.2

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: c94093368973d549362e255fadfa0f652dae29a25471359fbb6b94e3821032e9
4
- data.tar.gz: a748cfadba0cd3f2ce156fbdcbff8c13a226ce97bc9600dbea9e2e5d38fd5273
3
+ metadata.gz: 9ec814ce36da3afdb834b09acfd79afbb968c317d922f467e93e7ac3d155cc4a
4
+ data.tar.gz: 2314dc166301224032ebe041fed92e45ca4ea57bfb8d9b25422e82ccc71b46e6
5
5
  SHA512:
6
- metadata.gz: eb588a5338bc93d6178f72b90ab4b5a75ed04abd10d0551d1d4fe6d07ca09ce77273bbaf69dee217928f9da3b8bdb5a6e95b2e410adb5c666926b9ebf428445a
7
- data.tar.gz: c6e07f6abfbd20f504047ba5039b04e12d188eb1e4fbe3d089a6f6a4dfd1f8ee02a7650f14a34d0b9643b3717298d8e9f44245d16f5396ee44a1591139306b27
6
+ metadata.gz: 025c90aaff13a9598d517b5b98344a4153b0fccc5de5c10330bc3ea71c14b82a99b8191d300a799512c65af9a1025683a3063315f96917c2dce9b73d01dcd8df
7
+ data.tar.gz: 7bf45cae8f7f2a5de589bbb498d7cd5e3b70cecd74ddf928c54ae2abdb38c6177d32abe82d498aeb1813520a73c4e0608dd354d790b7d33aed3a4efe8cddb77a
data/README.md CHANGED
@@ -1,7 +1,7 @@
1
1
  # httpme - static web server with basic authentication
2
2
 
3
3
  [![Gem Version](https://badge.fury.io/rb/httpme.svg)](https://badge.fury.io/rb/httpme)
4
- [![Build Status](https://github.com/DannyBen/httpme/workflows/Test/badge.svg)](https://github.com/DannyBen/victor/actions?query=workflow%3ATest)
4
+ [![Build Status](https://github.com/DannyBen/httpme/workflows/Test/badge.svg)](https://github.com/DannyBen/httpme/actions?query=workflow%3ATest)
5
5
  [![Maintainability](https://api.codeclimate.com/v1/badges/6626f32d6a99288dcc98/maintainability)](https://codeclimate.com/github/DannyBen/httpme/maintainability)
6
6
 
7
7
  ---
@@ -46,6 +46,9 @@ services:
46
46
  HTTPME_AUTH:
47
47
  ```
48
48
 
49
+ See image on [DockerHub](https://hub.docker.com/r/dannyben/httpme) for
50
+ additional details.
51
+
49
52
  ## Usage
50
53
 
51
54
 
@@ -96,8 +99,7 @@ Examples:
96
99
  HTTPME_AUTH=admin:s3cr3t httpme docs # same result as above
97
100
  ```
98
101
 
99
- Contributing / Support
100
- --------------------------------------------------
102
+ ## Contributing / Support
101
103
 
102
104
  If you experience any issue, have a question or a suggestion, or if you wish
103
105
  to contribute, feel free to [open an issue][issues].
@@ -0,0 +1,19 @@
1
+ module HTTPMe
2
+ class IndexRedirector
3
+ def initialize(app, root: '.')
4
+ @app = app
5
+ @root = root
6
+ end
7
+
8
+ def call(env)
9
+ path_info = Rack::Utils.unescape env['PATH_INFO']
10
+ path = File.join @root, path_info
11
+
12
+ if File.directory?(path) and !path_info.end_with? '/'
13
+ return [302, { 'Location' => "#{env['PATH_INFO']}/" }, []]
14
+ end
15
+
16
+ @app.call env
17
+ end
18
+ end
19
+ end
@@ -1,5 +1,6 @@
1
1
  require 'rack'
2
2
  require 'rack/handler/puma'
3
+ require 'httpme/index_redirector'
3
4
 
4
5
  module HTTPMe
5
6
  class Server
@@ -32,6 +33,7 @@ module HTTPMe
32
33
  end
33
34
 
34
35
  use Rack::Static, urls: ["/"], root: path, cascade: true, index: 'index.html'
36
+ use IndexRedirector, root: path
35
37
  run Rack::Directory.new(path)
36
38
  end
37
39
  end
@@ -1,3 +1,3 @@
1
1
  module HTTPMe
2
- VERSION = "0.1.1"
2
+ VERSION = "0.1.2"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: httpme
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.1
4
+ version: 0.1.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Danny Ben Shitrit
@@ -79,6 +79,7 @@ files:
79
79
  - lib/httpme.rb
80
80
  - lib/httpme/cli.rb
81
81
  - lib/httpme/command.rb
82
+ - lib/httpme/index_redirector.rb
82
83
  - lib/httpme/server.rb
83
84
  - lib/httpme/version.rb
84
85
  homepage: https://github.com/dannyben/httpme