You are viewing a plain text version of this content. The canonical link for it is here.
Posted to c-commits@axis.apache.org by ro...@apache.org on 2026/01/14 16:23:35 UTC

(axis-axis2-c-core) 02/02: AXIS2C-1535: Return HTTP 408 status code on timeout/connection errors

This is an automated email from the ASF dual-hosted git repository.

robertlazarski pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/axis-axis2-c-core.git

commit 5f49f8b6216fb0b086b976b32f75976f83d9df6b
Author: Robert Lazarski <ro...@gmail.com>
AuthorDate: Wed Jan 14 06:17:10 2026 -1000

    AXIS2C-1535: Return HTTP 408 status code on timeout/connection errors
    
    When the HTTP sender encountered a timeout (-2) or connection error (-1),
    it would return AXIS2_FAILURE without setting the status code on the message
    context. This caused axis2_svc_client_get_http_status_code() to return 0
    instead of a meaningful HTTP status code.
    
    Now set HTTP 408 (Request Timeout) before returning failure, allowing clients
    to properly detect timeout conditions via the status code API.
    
    Co-Authored-By: Claude Opus 4.5 <no...@anthropic.com>
---
 src/core/transport/http/sender/http_sender.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/src/core/transport/http/sender/http_sender.c b/src/core/transport/http/sender/http_sender.c
index 6e1195784..f79344bdc 100644
--- a/src/core/transport/http/sender/http_sender.c
+++ b/src/core/transport/http/sender/http_sender.c
@@ -1403,6 +1403,9 @@ axis2_http_sender_send(
     if(status_code < 0)
     {
         AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, "status_code < 0 (%d)", status_code);
+        /* AXIS2C-1535: Set HTTP 408 (Request Timeout) for timeout/connection errors
+         * so clients can detect this via axis2_svc_client_get_http_status_code() */
+        axis2_msg_ctx_set_status_code(msg_ctx, env, AXIS2_HTTP_RESPONSE_REQUEST_TIMEOUT_CODE_VAL);
         return AXIS2_FAILURE;
     }