Skip to content

Commit 917aab0

Browse files
committed
Handle secondary TLS port 8443 as https by default
1 parent 2108c38 commit 917aab0

File tree

3 files changed

+3
-1
lines changed

3 files changed

+3
-1
lines changed

tests/unit/test_dbapi.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -325,6 +325,7 @@ def test_description_is_none_when_cursor_is_not_executed():
325325
("http://mytrinoserver.domain:9999", None, None, constants.HTTP),
326326
# Infer from port
327327
("mytrinoserver.domain", constants.DEFAULT_TLS_PORT, None, constants.HTTPS),
328+
("mytrinoserver.domain", constants.SECONDARY_TLS_PORT, None, constants.HTTPS),
328329
("mytrinoserver.domain", constants.DEFAULT_PORT, None, constants.HTTP),
329330
# http_scheme parameter has higher precedence than port parameter
330331
("mytrinoserver.domain", constants.DEFAULT_TLS_PORT, constants.HTTP, constants.HTTP),

trino/constants.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414

1515
DEFAULT_PORT = 8080
1616
DEFAULT_TLS_PORT = 443
17+
SECONDARY_TLS_PORT = 8443
1718
DEFAULT_SOURCE = "trino-python-client"
1819
DEFAULT_CATALOG: Optional[str] = None
1920
DEFAULT_SCHEMA: Optional[str] = None

trino/dbapi.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -208,7 +208,7 @@ def __init__(
208208
self.http_scheme = parsed_host.scheme
209209
elif http_scheme:
210210
self.http_scheme = http_scheme
211-
elif port == constants.DEFAULT_TLS_PORT:
211+
elif port in (constants.DEFAULT_TLS_PORT, constants.SECONDARY_TLS_PORT):
212212
self.http_scheme = constants.HTTPS
213213
elif port == constants.DEFAULT_PORT:
214214
self.http_scheme = constants.HTTP

0 commit comments

Comments
 (0)