Raise a more meaningful exception when attempting to use https_proxy with

protocol tcp.
This commit is contained in:
Anthony Tuininga 2022-07-15 11:39:44 -06:00
parent 52c8c4df4b
commit a7023bf1e6
3 changed files with 12 additions and 0 deletions

View File

@ -10,6 +10,13 @@ For deprecations, see :ref:`Deprecations <deprecations>`.
oracledb 1.0.2 (July 2022)
--------------------------
Thin Mode Changes
+++++++++++++++++
#) When using the connection parameter `https_proxy` while using protocol
`tcp`, a more meaningful exception is now raised:
`DPY-2029: https_proxy requires use of the tcps protocol`.
oracledb 1.0.1 (June 2022)
--------------------------

View File

@ -152,6 +152,7 @@ ERR_INVALID_CONNECT_PARAMS = 2025
ERR_INVALID_POOL_CLASS = 2026
ERR_INVALID_POOL_PARAMS = 2027
ERR_EXPECTING_LIST_FOR_ARRAY_VAR = 2028
ERR_HTTPS_PROXY_REQUIRES_TCPS = 2029
# error numbers that result in NotSupportedError
ERR_TIME_NOT_SUPPORTED = 3000
@ -285,6 +286,8 @@ ERR_MESSAGE_FORMATS = {
'to cursor.var()',
ERR_FEATURE_NOT_SUPPORTED:
'{feature} is only supported in python-oracledb {driver_type} mode',
ERR_HTTPS_PROXY_REQUIRES_TCPS:
'https_proxy requires use of the tcps protocol',
ERR_INCONSISTENT_DATATYPES:
'cannot convert from data type {input_type} to {output_type}',
ERR_INCORRECT_VAR_ARRAYSIZE:

View File

@ -198,6 +198,8 @@ cdef class ThinConnImpl(BaseConnImpl):
bint use_proxy = (address.https_proxy is not None)
double timeout = description.tcp_connect_timeout
if use_proxy:
if address.protocol != "tcps":
errors._raise_err(errors.ERR_HTTPS_PROXY_REQUIRES_TCPS)
connect_info = (address.https_proxy, address.https_proxy_port)
else:
connect_info = (address.host, address.port)