diff --git a/subsys/net/lib/http/http_client.c b/subsys/net/lib/http/http_client.c index c76b6287e53..9563f052e88 100644 --- a/subsys/net/lib/http/http_client.c +++ b/subsys/net/lib/http/http_client.c @@ -38,6 +38,9 @@ #define HTTP_CONTENT_LEN "Content-Length" #define HTTP_CONT_LEN_SIZE 6 +/* Default network activity timeout in seconds */ +#define HTTP_NETWORK_TIMEOUT K_SECONDS(CONFIG_HTTP_CLIENT_NETWORK_TIMEOUT) + int client_reset(struct http_ctx *ctx) { http_parser_init(&ctx->http.parser, HTTP_RESPONSE); @@ -235,7 +238,7 @@ int http_client_send_req(struct http_ctx *ctx, ctx->http.rsp.cb = cb; - ret = net_app_connect(&ctx->app_ctx, timeout); + ret = net_app_connect(&ctx->app_ctx, HTTP_NETWORK_TIMEOUT); if (ret < 0) { NET_DBG("Cannot connect to server (%d)", ret); return ret; @@ -244,7 +247,7 @@ int http_client_send_req(struct http_ctx *ctx, /* We might wait longer than timeout if the first connection * establishment takes long time (like with HTTPS) */ - if (k_sem_take(&ctx->http.connect_wait, timeout)) { + if (k_sem_take(&ctx->http.connect_wait, HTTP_NETWORK_TIMEOUT)) { NET_DBG("Connection timed out"); ret = -ETIMEDOUT; goto out;