rb-portless 0.3.0.dev.20260630.fb5fc36 → 0.3.0
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 +4 -4
- data/CHANGELOG.md +6 -3
- data/lib/portless/proxy.rb +10 -7
- data/lib/portless/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: e49a039bffaf418a826c61337253e8cf3f46c54b500f30936fba6e8153f96804
|
|
4
|
+
data.tar.gz: b4c6fad1e96ac1c2fd11a9366ad36273af95976e2abcdb1387d4b1b60dd1bd27
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 7754996324bcc3c53dac67a3c2999cc2c57d25d0bc6126ac4041d6dfb2936c49ca675b63ddb1fb24d86ad5b3a49b76b76e7397ae20f32f0d637f3b3f63e4f640
|
|
7
|
+
data.tar.gz: ec5a8e7ff23b18f7766015e11627938776d88eb672fe174a3902e273af14d044f69db69a146de48284799e08de5425544837a94160cf3c2ddf6eff7faa447673
|
data/CHANGELOG.md
CHANGED
|
@@ -15,9 +15,12 @@ All notable changes to this project are documented here. The format follows
|
|
|
15
15
|
|
|
16
16
|
- **Risky-TLD warning.** Warn when the configured `tld` ends in a real/reserved
|
|
17
17
|
TLD (`dev`, `app`, `local`, …) that could intercept live traffic.
|
|
18
|
-
- **More tests** —
|
|
19
|
-
|
|
20
|
-
|
|
18
|
+
- **More tests** — `Proxy#call` is now public, so the proxy's routing + error
|
|
19
|
+
logic is unit-tested (404 / 508 loop guard / 502 dead-backend, all stamped with
|
|
20
|
+
the health header) plus health probes and privilege logic (42 tests). The
|
|
21
|
+
successful byte-forward + **WebSocket upgrade relay** (ActionCable) need a live
|
|
22
|
+
reactor and are verified end-to-end manually — async-http servers can't be torn
|
|
23
|
+
down in-process without deadlock.
|
|
21
24
|
|
|
22
25
|
|
|
23
26
|
- **Startup banner.** Running a dev server through rb-portless now prints a clear
|
data/lib/portless/proxy.rb
CHANGED
|
@@ -51,13 +51,10 @@ module Portless
|
|
|
51
51
|
routes.find { |r| host.end_with?(".#{r.hostname}") }
|
|
52
52
|
end
|
|
53
53
|
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
end
|
|
59
|
-
|
|
60
|
-
def handle(request)
|
|
54
|
+
# The reverse-proxy app: resolve the request's host to a backend, forward it,
|
|
55
|
+
# stamp the health header. Public so it can be mounted in a test reactor
|
|
56
|
+
# (Async::HTTP::Server.for(endpoint, &proxy.method(:call))).
|
|
57
|
+
def call(request)
|
|
61
58
|
host = request_host(request)
|
|
62
59
|
route = route_for(host)
|
|
63
60
|
return error(404, "No app is registered for #{host}.") unless route
|
|
@@ -72,6 +69,12 @@ module Portless
|
|
|
72
69
|
error(502, "Backend for #{host} is not responding (#{e.class}).")
|
|
73
70
|
end
|
|
74
71
|
|
|
72
|
+
private
|
|
73
|
+
|
|
74
|
+
def make_server(endpoint)
|
|
75
|
+
Async::HTTP::Server.for(endpoint) { |request| call(request) }
|
|
76
|
+
end
|
|
77
|
+
|
|
75
78
|
def build_forward(request, host, hops)
|
|
76
79
|
headers = Protocol::HTTP::Headers.new
|
|
77
80
|
request.headers.each do |key, value|
|
data/lib/portless/version.rb
CHANGED