Skip to content

Commit b1c25c5

Browse files
Adjust end of request support to also look at the protocol version
before being enabled.
1 parent 293339f commit b1c25c5

File tree

3 files changed

+17
-11
lines changed

3 files changed

+17
-11
lines changed

src/oracledb/impl/thin/capabilities.pyx

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -50,17 +50,27 @@ cdef class Capabilities:
5050
self.sdu = 8192 # initial value to use
5151

5252
cdef void _adjust_for_protocol(self, uint16_t protocol_version,
53-
uint16_t protocol_options):
53+
uint16_t protocol_options, uint32_t flags):
54+
"""
55+
Adjust the capabilities of the protocol based on the server's response
56+
to the initial connection request.
57+
"""
5458
self.protocol_version = protocol_version
5559
self.supports_oob = protocol_options & TNS_GSO_CAN_RECV_ATTENTION
60+
if flags & TNS_ACCEPT_FLAG_FAST_AUTH:
61+
self.supports_fast_auth = True
62+
if protocol_version >= TNS_VERSION_MIN_END_OF_RESPONSE \
63+
and flags & TNS_ACCEPT_FLAG_HAS_END_OF_REQUEST:
64+
self.compile_caps[TNS_CCAP_TTC4] |= TNS_CCAP_END_OF_REQUEST
65+
self.supports_end_of_request = True
5666

5767
@cython.boundscheck(False)
5868
cdef void _adjust_for_server_compile_caps(self, bytearray server_caps):
5969
if server_caps[TNS_CCAP_FIELD_VERSION] < self.ttc_field_version:
6070
self.ttc_field_version = server_caps[TNS_CCAP_FIELD_VERSION]
6171
self.compile_caps[TNS_CCAP_FIELD_VERSION] = self.ttc_field_version
6272
if self.ttc_field_version < TNS_CCAP_FIELD_VERSION_23_4 \
63-
or not server_caps[TNS_CCAP_TTC4] & TNS_CCAP_END_OF_REQUEST:
73+
and self.supports_end_of_request:
6474
self.compile_caps[TNS_CCAP_TTC4] ^= TNS_CCAP_END_OF_REQUEST
6575
self.supports_end_of_request = False
6676

@@ -114,8 +124,7 @@ cdef class Capabilities:
114124
self.compile_caps[TNS_CCAP_TTC2] = TNS_CCAP_ZLNP
115125
self.compile_caps[TNS_CCAP_OCI2] = TNS_CCAP_DRCP
116126
self.compile_caps[TNS_CCAP_CLIENT_FN] = TNS_CCAP_CLIENT_FN_MAX
117-
self.compile_caps[TNS_CCAP_TTC4] = TNS_CCAP_INBAND_NOTIFICATION | \
118-
TNS_CCAP_END_OF_REQUEST
127+
self.compile_caps[TNS_CCAP_TTC4] = TNS_CCAP_INBAND_NOTIFICATION
119128
self.compile_caps[TNS_CCAP_TTC5] = TNS_CCAP_VECTOR_SUPPORT
120129

121130
@cython.boundscheck(False)

src/oracledb/impl/thin/constants.pxi

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -571,7 +571,7 @@ cdef enum:
571571
TNS_VERSION_MIN_ACCEPTED = 315 # 12.1
572572
TNS_VERSION_MIN_LARGE_SDU = 315
573573
TNS_VERSION_MIN_OOB_CHECK = 318
574-
TNS_VERSION_MIN_UUID = 319
574+
TNS_VERSION_MIN_END_OF_RESPONSE = 319
575575

576576
# control packet types
577577
cdef enum:

src/oracledb/impl/thin/messages.pyx

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1827,7 +1827,7 @@ cdef class ConnectMessage(Message):
18271827
cdef:
18281828
uint16_t protocol_version, protocol_options
18291829
const char_type *redirect_data
1830-
uint32_t flags
1830+
uint32_t flags = 0
18311831
bytes db_uuid
18321832
if buf._current_packet.packet_type == TNS_PACKET_TYPE_REDIRECT:
18331833
if not self.read_redirect_data_len:
@@ -1851,11 +1851,8 @@ cdef class ConnectMessage(Message):
18511851
if protocol_version >= TNS_VERSION_MIN_OOB_CHECK:
18521852
buf.skip_raw_bytes(5)
18531853
buf.read_uint32(&flags)
1854-
if flags & TNS_ACCEPT_FLAG_FAST_AUTH:
1855-
buf._caps.supports_fast_auth = True
1856-
if flags & TNS_ACCEPT_FLAG_HAS_END_OF_REQUEST:
1857-
buf._caps.supports_end_of_request = True
1858-
buf._caps._adjust_for_protocol(protocol_version, protocol_options)
1854+
buf._caps._adjust_for_protocol(protocol_version, protocol_options,
1855+
flags)
18591856
buf._transport._full_packet_size = True
18601857
elif buf._current_packet.packet_type == TNS_PACKET_TYPE_REFUSE:
18611858
response = self.error_info.message

0 commit comments

Comments
 (0)