Class: Rack::Acme::Endpoint
- Inherits:
-
Object
- Object
- Rack::Acme::Endpoint
- Defined in:
- lib/rack/acme/endpoint.rb
Instance Method Summary collapse
- #call(env) ⇒ Object
-
#initialize(app) ⇒ Endpoint
constructor
A new instance of Endpoint.
Constructor Details
#initialize(app) ⇒ Endpoint
Returns a new instance of Endpoint.
4 5 6 |
# File 'lib/rack/acme/endpoint.rb', line 4 def initialize(app) @app = app end |
Instance Method Details
#call(env) ⇒ Object
8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 |
# File 'lib/rack/acme/endpoint.rb', line 8 def call(env) request = ::Rack::Request.new(env) if (m = request.fullpath.match(%r{\A/.well-known/acme-challenge/(.+)\z})) token = m[1] content = ::Rack::Acme.cache[token] if content return [200, {}, [content]] else return [404, {}, ["No match for #{token}"]] end else @app.call(env) end end |