fix: server-host !6 incorrectly binds to IPv4 address
Updates streaming-commons to version 0.2.3.1. This resolves #3202. Signed-off-by: Taimoor Zaeem <taimoorzaeem@gmail.com>
This commit is contained in:
committed by
Steve Chavez
parent
8180905890
commit
58efc2680e
@@ -7,6 +7,7 @@ All notable changes to this project will be documented in this file. From versio
|
|||||||
## Fixed
|
## Fixed
|
||||||
|
|
||||||
- Fix `db-pre-config` function failing when function names are pg reserved words by @taimoorzaeem in #4380
|
- Fix `db-pre-config` function failing when function names are pg reserved words by @taimoorzaeem in #4380
|
||||||
|
- Fix `server-host=!6` incorrectly binds to IPv4 address by @taimoorzaeem in #3202
|
||||||
|
|
||||||
## [14.0] - 2025-10-24
|
## [14.0] - 2025-10-24
|
||||||
|
|
||||||
|
|||||||
@@ -1 +1 @@
|
|||||||
index-state: hackage.haskell.org 2025-10-13T04:53:27Z
|
index-state: hackage.haskell.org 2025-10-29T04:02:18Z
|
||||||
|
|||||||
@@ -60,6 +60,16 @@ let
|
|||||||
}
|
}
|
||||||
{ };
|
{ };
|
||||||
|
|
||||||
|
# TODO: Remove once available in nixpkgs haskellPackages
|
||||||
|
streaming-commons =
|
||||||
|
prev.callHackageDirect
|
||||||
|
{
|
||||||
|
pkg = "streaming-commons";
|
||||||
|
ver = "0.2.3.1";
|
||||||
|
sha256 = "sha256-Gl2eaJcWe1sxmcE/octWlH9uSnERguf+5H66K4fV87s=";
|
||||||
|
}
|
||||||
|
{ };
|
||||||
|
|
||||||
# Downgrade hasql and related packages while we are still on GHC 9.4 for the static build.
|
# Downgrade hasql and related packages while we are still on GHC 9.4 for the static build.
|
||||||
hasql = lib.dontCheck (lib.doJailbreak prev.hasql_1_6_4_4);
|
hasql = lib.dontCheck (lib.doJailbreak prev.hasql_1_6_4_4);
|
||||||
hasql-dynamic-statements = lib.dontCheck prev.hasql-dynamic-statements_0_3_1_5;
|
hasql-dynamic-statements = lib.dontCheck prev.hasql-dynamic-statements_0_3_1_5;
|
||||||
|
|||||||
+1
-1
@@ -139,7 +139,7 @@ library
|
|||||||
, regex-tdfa >= 1.2.2 && < 1.4
|
, regex-tdfa >= 1.2.2 && < 1.4
|
||||||
, retry >= 0.7.4 && < 0.10
|
, retry >= 0.7.4 && < 0.10
|
||||||
, scientific >= 0.3.4 && < 0.4
|
, scientific >= 0.3.4 && < 0.4
|
||||||
, streaming-commons >= 0.1.1 && < 0.3
|
, streaming-commons >= 0.2.3.1 && < 0.3
|
||||||
, swagger2 >= 2.4 && < 2.9
|
, swagger2 >= 2.4 && < 2.9
|
||||||
, text >= 1.2.2 && < 2.2
|
, text >= 1.2.2 && < 2.2
|
||||||
, time >= 1.6 && < 1.13
|
, time >= 1.6 && < 1.13
|
||||||
|
|||||||
@@ -14,3 +14,4 @@ extra-deps:
|
|||||||
- hasql-pool-1.0.1
|
- hasql-pool-1.0.1
|
||||||
- jose-jwt-0.10.0
|
- jose-jwt-0.10.0
|
||||||
- postgresql-libpq-0.10.1.0
|
- postgresql-libpq-0.10.1.0
|
||||||
|
- streaming-commons-0.2.3.1
|
||||||
|
|||||||
@@ -39,6 +39,13 @@ packages:
|
|||||||
size: 1096
|
size: 1096
|
||||||
original:
|
original:
|
||||||
hackage: postgresql-libpq-0.10.1.0
|
hackage: postgresql-libpq-0.10.1.0
|
||||||
|
- completed:
|
||||||
|
hackage: streaming-commons-0.2.3.1@sha256:ed7999fea9e912b1211ea93d7e20a7998bf4753166370c94048885650f303bf0,4841
|
||||||
|
pantry-tree:
|
||||||
|
sha256: f08e83fb00fd45865fa8cfdef5ecef7161d5135257ee98050bfbe4b807ad65f8
|
||||||
|
size: 2374
|
||||||
|
original:
|
||||||
|
hackage: streaming-commons-0.2.3.1
|
||||||
snapshots:
|
snapshots:
|
||||||
- completed:
|
- completed:
|
||||||
sha256: 238fa745b64f91184f9aa518fe04bdde6552533d169b0da5256670df83a0f1a9
|
sha256: 238fa745b64f91184f9aa518fe04bdde6552533d169b0da5256670df83a0f1a9
|
||||||
|
|||||||
+11
-3
@@ -94,11 +94,19 @@ def run(
|
|||||||
"Run PostgREST and yield an endpoint that is ready for connections."
|
"Run PostgREST and yield an endpoint that is ready for connections."
|
||||||
|
|
||||||
with tempfile.TemporaryDirectory() as tmpdir:
|
with tempfile.TemporaryDirectory() as tmpdir:
|
||||||
|
|
||||||
|
# with python requests, "localhost" doesn't automatically resolves
|
||||||
|
# to [::1], hence we use this explicitly when host is ipv6 special
|
||||||
|
# address
|
||||||
|
ipv6_special_addresses = ["*6", "!6"]
|
||||||
|
|
||||||
|
localhost = "[::1]" if host in ipv6_special_addresses else "localhost"
|
||||||
|
|
||||||
if port:
|
if port:
|
||||||
env["PGRST_SERVER_PORT"] = str(port)
|
env["PGRST_SERVER_PORT"] = str(port)
|
||||||
env["PGRST_SERVER_HOST"] = host or "localhost"
|
env["PGRST_SERVER_HOST"] = host or localhost
|
||||||
# When constructing IPv6 address, host address should be bracketed like [host]
|
# When constructing IPv6 address, host address should be bracketed like [host]
|
||||||
apihost = f"[{host}]" if host and is_ipv6(host) else "localhost"
|
apihost = f"[{host}]" if host and is_ipv6(host) else localhost
|
||||||
baseurl = f"http://{apihost}:{port}"
|
baseurl = f"http://{apihost}:{port}"
|
||||||
else:
|
else:
|
||||||
socketfile = pathlib.Path(tmpdir) / "postgrest.sock"
|
socketfile = pathlib.Path(tmpdir) / "postgrest.sock"
|
||||||
@@ -107,7 +115,7 @@ def run(
|
|||||||
|
|
||||||
adminport = freeport(port)
|
adminport = freeport(port)
|
||||||
env["PGRST_ADMIN_SERVER_PORT"] = str(adminport)
|
env["PGRST_ADMIN_SERVER_PORT"] = str(adminport)
|
||||||
adminhost = f"[{host}]" if host and is_ipv6(host) else "localhost"
|
adminhost = f"[{host}]" if host and is_ipv6(host) else localhost
|
||||||
adminurl = f"http://{adminhost}:{adminport}"
|
adminurl = f"http://{adminhost}:{adminport}"
|
||||||
|
|
||||||
command = [POSTGREST_BIN]
|
command = [POSTGREST_BIN]
|
||||||
|
|||||||
Reference in New Issue
Block a user