falcon 0.48.5 → 0.48.6
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- checksums.yaml.gz.sig +0 -0
- data/lib/falcon/server.rb +1 -7
- data/lib/falcon/version.rb +1 -1
- data.tar.gz.sig +0 -0
- metadata +2 -3
- metadata.gz.sig +0 -0
- data/lib/falcon/middleware/validate.rb +0 -26
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 2a6198414f38d568e93d77452b6efa9b4f9267a5beedb57b8c7a96bd72a174cd
|
4
|
+
data.tar.gz: 164f1aa2a4407eba29965a0c1acc85364ad734b6a2aa1215d408b3d1e67bd4f5
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e6942fa58fda793327bfcb767a0e729f2417c90d4dcdb7bbdc9f1a8c81492575b95fc96ee294b69e555322d643f3dd8b0443b38f3efb92a3eb31f68d445ad34e
|
7
|
+
data.tar.gz: 8d4dcc4a530b7eaf74055e893fec7e101fa8e2419d9dc59713064f54fb679a566091f162220ecf5e25cbcf312db52a4f503dd65fb8398cf1f06c00dbab4ad39a
|
checksums.yaml.gz.sig
CHANGED
Binary file
|
data/lib/falcon/server.rb
CHANGED
@@ -10,7 +10,6 @@ require "protocol/http/content_encoding"
|
|
10
10
|
|
11
11
|
require "async/http/cache"
|
12
12
|
require_relative "middleware/verbose"
|
13
|
-
require_relative "middleware/validate"
|
14
13
|
require "protocol/rack"
|
15
14
|
|
16
15
|
module Falcon
|
@@ -18,19 +17,14 @@ module Falcon
|
|
18
17
|
class Server < Async::HTTP::Server
|
19
18
|
# Wrap a rack application into a middleware suitable the server.
|
20
19
|
# @parameter rack_app [Proc | Object] A rack application/middleware.
|
21
|
-
# @parameter validate [Boolean] Whether to add the {Middleware::Validate} middleware.
|
22
20
|
# @parameter verbose [Boolean] Whether to add the {Middleware::Verbose} middleware.
|
23
21
|
# @parameter cache [Boolean] Whether to add the {Async::HTTP::Cache} middleware.
|
24
|
-
def self.middleware(rack_app, verbose: false,
|
22
|
+
def self.middleware(rack_app, verbose: false, cache: true)
|
25
23
|
::Protocol::HTTP::Middleware.build do
|
26
24
|
if verbose
|
27
25
|
use Middleware::Verbose
|
28
26
|
end
|
29
27
|
|
30
|
-
if validate
|
31
|
-
use Middleware::Validate
|
32
|
-
end
|
33
|
-
|
34
28
|
if cache
|
35
29
|
use Async::HTTP::Cache::General
|
36
30
|
end
|
data/lib/falcon/version.rb
CHANGED
data.tar.gz.sig
CHANGED
Binary file
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: falcon
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.48.
|
4
|
+
version: 0.48.6
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Samuel Williams
|
@@ -60,7 +60,7 @@ cert_chain:
|
|
60
60
|
Q2K9NVun/S785AP05vKkXZEFYxqG6EW012U4oLcFl5MySFajYXRYbuUpH6AY+HP8
|
61
61
|
voD0MPg1DssDLKwXyt1eKD/+Fq0bFWhwVM/1XiAXL7lyYUyOq24KHgQ2Csg=
|
62
62
|
-----END CERTIFICATE-----
|
63
|
-
date: 2025-01-
|
63
|
+
date: 2025-01-29 00:00:00.000000000 Z
|
64
64
|
dependencies:
|
65
65
|
- !ruby/object:Gem::Dependency
|
66
66
|
name: async
|
@@ -267,7 +267,6 @@ files:
|
|
267
267
|
- lib/falcon/environment/virtual.rb
|
268
268
|
- lib/falcon/middleware/proxy.rb
|
269
269
|
- lib/falcon/middleware/redirect.rb
|
270
|
-
- lib/falcon/middleware/validate.rb
|
271
270
|
- lib/falcon/middleware/verbose.rb
|
272
271
|
- lib/falcon/proxy_endpoint.rb
|
273
272
|
- lib/falcon/rackup/handler.rb
|
metadata.gz.sig
CHANGED
Binary file
|
@@ -1,26 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
# Released under the MIT License.
|
4
|
-
# Copyright, 2025, by Samuel Williams.
|
5
|
-
|
6
|
-
module Falcon
|
7
|
-
module Middleware
|
8
|
-
# A HTTP middleware for validating incoming requests.
|
9
|
-
class Validate < Protocol::HTTP::Middleware
|
10
|
-
# Initialize the validate middleware.
|
11
|
-
# @parameter app [Protocol::HTTP::Middleware] The middleware to wrap.
|
12
|
-
def initialize(app)
|
13
|
-
super(app)
|
14
|
-
end
|
15
|
-
|
16
|
-
# Validate the incoming request.
|
17
|
-
def call(request)
|
18
|
-
unless request.path.start_with?("/")
|
19
|
-
return Protocol::HTTP::Response[400, {}, ["Invalid request path!"]]
|
20
|
-
end
|
21
|
-
|
22
|
-
return super
|
23
|
-
end
|
24
|
-
end
|
25
|
-
end
|
26
|
-
end
|