You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@nuttx.apache.org by xi...@apache.org on 2022/03/08 01:44:06 UTC

[incubator-nuttx-apps] 02/04: webclient: Send HTTP 1.1 request if enabled

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

xiaoxiang pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-nuttx-apps.git

commit 7949059ec2891f65e2db398158a9a244f1faea8c
Author: YAMAMOTO Takashi <ya...@midokura.com>
AuthorDate: Mon Mar 7 09:29:55 2022 +0900

    webclient: Send HTTP 1.1 request if enabled
---
 netutils/webclient/webclient.c | 16 +++++++++++++++-
 1 file changed, 15 insertions(+), 1 deletion(-)

diff --git a/netutils/webclient/webclient.c b/netutils/webclient/webclient.c
index df1cd8f..5b07bac 100644
--- a/netutils/webclient/webclient.c
+++ b/netutils/webclient/webclient.c
@@ -1120,7 +1120,21 @@ int webclient_perform(FAR struct webclient_context *ctx)
 #endif
 
           dest = append(dest, ep, " ");
-          dest = append(dest, ep, g_http10);
+          if (ctx->protocol_version == WEBCLIENT_PROTOCOL_VERSION_HTTP_1_0)
+            {
+              dest = append(dest, ep, g_http10);
+            }
+          else if (ctx->protocol_version ==
+                   WEBCLIENT_PROTOCOL_VERSION_HTTP_1_1)
+            {
+              dest = append(dest, ep, g_http11);
+            }
+          else
+            {
+              ret = -EINVAL;
+              goto errout_with_errno;
+            }
+
           dest = append(dest, ep, g_httpcrnl);
           dest = append(dest, ep, g_httphost);
           dest = append(dest, ep, ws->hostname);