summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHuan Nguyen <[email protected]>2025-05-14 12:40:17 -0600
committerHuan Nguyen <[email protected]>2025-05-22 09:09:44 -0600
commit9702171925f1426eff060168e14ebbef51e3d21d (patch)
tree253deb1cfc917d87bdd64e335a58e2e8d9dc20d4
parent5af33d7d55e67dc93ddff52ec6eb74674c69cbb7 (diff)
Move empty packet check in nx_secure_tls_session_send
It was causing some tests to hang forever because they were expecting different errors to be returned. We do want to keep the check for empty packets as the netx_web_invalid_release_test expects that sending an empty packet fails. Note that the test also tests HTTPS, which will technically send a non-empty packet because the empty packet will be modified to include the TLS data. However, the empty packet check in nx_secure_tls_session_send will fulfill the same role as the check in nx_tcp_socket_send.c, checking for an empty packet prior to the modification of the packet to include TLS data. This gets the tests passing again.
-rw-r--r--nx_secure/src/nxe_secure_tls_session_send.c20
1 files changed, 10 insertions, 10 deletions
diff --git a/nx_secure/src/nxe_secure_tls_session_send.c b/nx_secure/src/nxe_secure_tls_session_send.c
index 09e9281c..85ad1726 100644
--- a/nx_secure/src/nxe_secure_tls_session_send.c
+++ b/nx_secure/src/nxe_secure_tls_session_send.c
@@ -91,16 +91,6 @@ UINT status;
return(NX_PTR_ERROR);
}
- if (packet_ptr -> nx_packet_length == 0)
- {
- /* Must check for empty packets here, as TLS data will make a packet's contents
- non-empty. _nx_tcp_socket_send_internal has a check for an empty packet
- that correctly works in an HTTP session but will result in a false negative if
- the session is HTTPS. Thus, this check is performed before the TLS session
- operations that modify the packet. */
- return(NX_INVALID_PACKET);
- }
-
if (tls_session -> nx_secure_tls_tcp_socket == NX_NULL)
{
return(NX_SECURE_TLS_SESSION_UNINITIALIZED);
@@ -121,6 +111,16 @@ UINT status;
/* Check for appropriate caller. */
NX_THREADS_ONLY_CALLER_CHECKING
+ if (packet_ptr -> nx_packet_length == 0)
+ {
+ /* Must check for empty packets here, as TLS data will make a packet's contents
+ non-empty. _nx_tcp_socket_send_internal has a check for an empty packet
+ that correctly works in an HTTP session but will result in a false negative if
+ the session is HTTPS. Thus, this check is performed before the TLS session
+ operations that modify the packet. */
+ return(NX_INVALID_PACKET);
+ }
+
status = _nx_secure_tls_session_send(tls_session, packet_ptr, wait_option);
/* Return completion status. */