Skip to content

Commit ba03561

Browse files
Raise a more meaningful exception when attempting to use https_proxy with
protocol tcp.
1 parent d972d7c commit ba03561

File tree

3 files changed

+12
-0
lines changed

3 files changed

+12
-0
lines changed

doc/src/release_notes.rst

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,13 @@ For deprecations, see :ref:`Deprecations <deprecations>`.
1010
oracledb 1.1.0 (TBD)
1111
--------------------
1212

13+
Thin Mode Changes
14+
+++++++++++++++++
15+
16+
#) When using the connection parameter `https_proxy` while using protocol
17+
`tcp`, a more meaningful exception is now raised:
18+
`DPY-2029: https_proxy requires use of the tcps protocol`.
19+
1320
Thick Mode Changes
1421
++++++++++++++++++
1522

src/oracledb/errors.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -152,6 +152,7 @@ def _raise_from_string(exc_type: Exception, message: str) -> None:
152152
ERR_INVALID_POOL_CLASS = 2026
153153
ERR_INVALID_POOL_PARAMS = 2027
154154
ERR_EXPECTING_LIST_FOR_ARRAY_VAR = 2028
155+
ERR_HTTPS_PROXY_REQUIRES_TCPS = 2029
155156

156157
# error numbers that result in NotSupportedError
157158
ERR_TIME_NOT_SUPPORTED = 3000
@@ -285,6 +286,8 @@ def _raise_from_string(exc_type: Exception, message: str) -> None:
285286
'to cursor.var()',
286287
ERR_FEATURE_NOT_SUPPORTED:
287288
'{feature} is only supported in python-oracledb {driver_type} mode',
289+
ERR_HTTPS_PROXY_REQUIRES_TCPS:
290+
'https_proxy requires use of the tcps protocol',
288291
ERR_INCONSISTENT_DATATYPES:
289292
'cannot convert from data type {input_type} to {output_type}',
290293
ERR_INCORRECT_VAR_ARRAYSIZE:

src/oracledb/impl/thin/connection.pyx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -198,6 +198,8 @@ cdef class ThinConnImpl(BaseConnImpl):
198198
bint use_proxy = (address.https_proxy is not None)
199199
double timeout = description.tcp_connect_timeout
200200
if use_proxy:
201+
if address.protocol != "tcps":
202+
errors._raise_err(errors.ERR_HTTPS_PROXY_REQUIRES_TCPS)
201203
connect_info = (address.https_proxy, address.https_proxy_port)
202204
else:
203205
connect_info = (address.host, address.port)

0 commit comments

Comments
 (0)