diff options
| author | Huan Nguyen <[email protected]> | 2025-02-06 15:30:51 -0700 |
|---|---|---|
| committer | Frédéric Desbiens <[email protected]> | 2025-02-11 10:59:14 -0500 |
| commit | 6ca0ac8fe72877336bf34d9ee28afbc0585ffba0 (patch) | |
| tree | c6127c702c47565b76645139d589cb349076b39c | |
| parent | 07f492e7d8cafef89293e35027c7d3f84cda1f97 (diff) | |
Add debugging prints and commented notes
Signed-off-by: Frédéric Desbiens <[email protected]>
| -rw-r--r-- | addons/web/nx_web_http_client.c | 5 | ||||
| -rw-r--r-- | addons/web/nx_web_http_server.c | 24 | ||||
| -rw-r--r-- | common/src/nx_tcp_socket_send_internal.c | 1 | ||||
| -rw-r--r-- | nx_secure/src/nxe_secure_tls_session_send.c | 5 | ||||
| -rw-r--r-- | test/regression/web_test/netx_web_invalid_release_test.c | 5 |
5 files changed, 39 insertions, 1 deletions
diff --git a/addons/web/nx_web_http_client.c b/addons/web/nx_web_http_client.c index dcb4393c..c705bbdd 100644 --- a/addons/web/nx_web_http_client.c +++ b/addons/web/nx_web_http_client.c @@ -5813,6 +5813,8 @@ UINT header_size; /* Call actual PUT data routine. */ status = _nx_web_http_client_put_packet(client_ptr, packet_ptr, wait_option); + printf("nxe_web_http_client_put_packet status to return: 0x%x\r\n", status); + /* Return completion status. */ return(status); } @@ -5952,6 +5954,8 @@ UINT status; /* Return to the READY state. */ client_ptr -> nx_web_http_client_state = NX_WEB_HTTP_CLIENT_STATE_READY; + printf("_nx_web_http_client_put_packet error return 0x%x\r\n", status); + /* Return an error. */ return(status); } @@ -5959,6 +5963,7 @@ UINT status; /* Otherwise, update the actual bytes transferred. */ client_ptr -> nx_web_http_client_actual_bytes_transferred = client_ptr -> nx_web_http_client_actual_bytes_transferred + length; + printf("_nx_web_http_client_put_packet success\r\n"); /* Return status to caller. */ return(NX_SUCCESS); } diff --git a/addons/web/nx_web_http_server.c b/addons/web/nx_web_http_server.c index 7a355172..49454a5b 100644 --- a/addons/web/nx_web_http_server.c +++ b/addons/web/nx_web_http_server.c @@ -4620,8 +4620,30 @@ UINT temp_realm_length = 0; "NetX HTTP Receive Timeout", sizeof("NetX HTTP Receive Timeout") - 1, NX_NULL, 0); - + printf("7\r\n"); + printf("code 0x%x\r\n", status); goto put_process_end; + // fx_file_close(&(server_ptr -> nx_web_http_server_file)); + // If file is not closed and we just return, tests pass. + /* Furthermore, netx_web_invalid_release_test is doing both loops. + If assigned 1 right before the loop, tests pass. Where is it getting + a value of 2 from? + Because CMake in /test/cmake/web/CMakeLists.txt is passing in the + definition of NX_WEB_HTTPS_ENABLE which means it is testing HTTPS as well + so what is the failure code on the second run, the run of HTTPS? Why is it + failing if the file is closed? + In tcp send, invalid packet is returned (0x12) if packet is empty. Adding + a printf inside _nx_tcp_socket_send_internal "empty packet not allowed" is + printing for the HTTP loop but not for the HTTPS loop, which succeeds. + netx_web_invalid_release_test + thread_client_entry() is receiving NX_SUCCESS (0) from nx_web_http_client_put_packet. + Because when using TCP, the TLS data is included in the packet, so it + is no longer empty, so invalid release is expecting a failure but gets a + real success? (When using HTTP the packet is empty.) + But then why does it work when the file is not closed between the HTTP request + and the HTTPS request? + */ + // return; } if (server_ptr -> nx_web_http_server_request_chunked) diff --git a/common/src/nx_tcp_socket_send_internal.c b/common/src/nx_tcp_socket_send_internal.c index 29742001..ab567a34 100644 --- a/common/src/nx_tcp_socket_send_internal.c +++ b/common/src/nx_tcp_socket_send_internal.c @@ -311,6 +311,7 @@ UINT compute_checksum = 1; { /* Empty packet is not allowed. */ + printf("empty packet not allowed\r\n"); return(NX_INVALID_PACKET); } diff --git a/nx_secure/src/nxe_secure_tls_session_send.c b/nx_secure/src/nxe_secure_tls_session_send.c index 2301fe9d..1dfb38eb 100644 --- a/nx_secure/src/nxe_secure_tls_session_send.c +++ b/nx_secure/src/nxe_secure_tls_session_send.c @@ -90,6 +90,11 @@ UINT status; return(NX_PTR_ERROR); } + if (packet_ptr -> nx_packet_length == 0) + { + // return(NX_INVALID_PACKET); + } + if (tls_session -> nx_secure_tls_tcp_socket == NX_NULL) { return(NX_SECURE_TLS_SESSION_UNINITIALIZED); diff --git a/test/regression/web_test/netx_web_invalid_release_test.c b/test/regression/web_test/netx_web_invalid_release_test.c index a92a2c64..c088cf34 100644 --- a/test/regression/web_test/netx_web_invalid_release_test.c +++ b/test/regression/web_test/netx_web_invalid_release_test.c @@ -273,13 +273,18 @@ NX_PACKET *recv_packet; error_counter++; /* Send the an empty packet. */ + printf("status before send: 0x%x\r\n", status); + tx_thread_sleep(10); status = nx_web_http_client_put_packet(&my_client, send_packet, 1 * NX_IP_PERIODIC_RATE); + printf("status after send: 0x%x\r\n", status); + tx_thread_sleep(100); if (status) { nx_packet_release(send_packet); } else { + printf("invalid release test put packet error loop %d status %d\r\n", i, status); error_counter++; } |
