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/06/03 08:33:14 UTC

[incubator-nuttx-apps] branch master updated (c116f8b67 -> a56301464)

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

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


    from c116f8b67 webclient: Add https proxy (https over http) support
     new dbee24086 webclient.c: Fix the placement of "Public Function" banner
     new 3f4e723ff webclient: dispose the response body by default
     new a696c8945 webclient: Don't forget to check http status before webclient_get_tunnel
     new a56301464 webclient: make webclient_get_tunnel assert http_status

The 4 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


Summary of changes:
 netutils/webclient/webclient.c | 33 ++++++++++++++++++++++++++++-----
 1 file changed, 28 insertions(+), 5 deletions(-)


[incubator-nuttx-apps] 03/04: webclient: Don't forget to check http status before webclient_get_tunnel

Posted by xi...@apache.org.
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 a696c8945eafa419eeb5e7dd662bf7aadce0a619
Author: YAMAMOTO Takashi <ya...@midokura.com>
AuthorDate: Thu Jun 2 13:42:06 2022 +0900

    webclient: Don't forget to check http status before webclient_get_tunnel
---
 netutils/webclient/webclient.c | 22 ++++++++++++++++++++++
 1 file changed, 22 insertions(+)

diff --git a/netutils/webclient/webclient.c b/netutils/webclient/webclient.c
index 6ade1afef..3b1e32fc3 100644
--- a/netutils/webclient/webclient.c
+++ b/netutils/webclient/webclient.c
@@ -1390,6 +1390,28 @@ int webclient_perform(FAR struct webclient_context *ctx)
           if (ws->tunnel != NULL)
             {
               ret = webclient_perform(ws->tunnel);
+              if (ret == 0)
+                {
+                  unsigned int http_status = ws->tunnel->http_status;
+
+                  if (http_status / 100 != 2)
+                    {
+                      nerr("HTTP-level error %u on tunnel attempt\n",
+                           http_status);
+
+                      /* 407 Proxy Authentication Required */
+
+                      if (http_status == 407)
+                        {
+                          ret = -EPERM;
+                        }
+                      else
+                        {
+                          ret = -EIO;
+                        }
+                    }
+                }
+
               if (ret == 0)
                 {
                   FAR struct webclient_conn_s *tunnel_conn;


[incubator-nuttx-apps] 01/04: webclient.c: Fix the placement of "Public Function" banner

Posted by xi...@apache.org.
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 dbee240869a9e9f6764aa5583372d7941d8e4a2a
Author: YAMAMOTO Takashi <ya...@midokura.com>
AuthorDate: Thu Jun 2 13:22:03 2022 +0900

    webclient.c: Fix the placement of "Public Function" banner
---
 netutils/webclient/webclient.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/netutils/webclient/webclient.c b/netutils/webclient/webclient.c
index b121d27b5..38fb49dda 100644
--- a/netutils/webclient/webclient.c
+++ b/netutils/webclient/webclient.c
@@ -1116,6 +1116,10 @@ static int wget_gethostip(FAR char *hostname, FAR struct in_addr *dest)
 #endif
 }
 
+/****************************************************************************
+ * Public Functions
+ ****************************************************************************/
+
 /****************************************************************************
  * Name: webclient_perform
  *
@@ -2082,10 +2086,6 @@ errout_with_errno:
   return ret;
 }
 
-/****************************************************************************
- * Public Functions
- ****************************************************************************/
-
 /****************************************************************************
  * Name: webclient_abort
  *


[incubator-nuttx-apps] 02/04: webclient: dispose the response body by default

Posted by xi...@apache.org.
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 3f4e723ff73b16ad8899a29a84fe544c4c985b3f
Author: YAMAMOTO Takashi <ya...@midokura.com>
AuthorDate: Thu Jun 2 13:22:59 2022 +0900

    webclient: dispose the response body by default
    
    Instead of a NULL dereference.
    
    This fixes a crash on CONNECT failure when trying to proxy https.
---
 netutils/webclient/webclient.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/netutils/webclient/webclient.c b/netutils/webclient/webclient.c
index 38fb49dda..6ade1afef 100644
--- a/netutils/webclient/webclient.c
+++ b/netutils/webclient/webclient.c
@@ -1976,7 +1976,7 @@ int webclient_perform(FAR struct webclient_context *ctx)
                               goto errout_with_errno;
                             }
                         }
-                      else
+                      else if (ctx->callback)
                         {
                           ctx->callback(&ws->buffer, ws->offset,
                                         ws->offset + received,


[incubator-nuttx-apps] 04/04: webclient: make webclient_get_tunnel assert http_status

Posted by xi...@apache.org.
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 a56301464613d406eeaa69dabad083f7dfeecd68
Author: YAMAMOTO Takashi <ya...@midokura.com>
AuthorDate: Thu Jun 2 13:43:25 2022 +0900

    webclient: make webclient_get_tunnel assert http_status
---
 netutils/webclient/webclient.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/netutils/webclient/webclient.c b/netutils/webclient/webclient.c
index 3b1e32fc3..f5599e9ca 100644
--- a/netutils/webclient/webclient.c
+++ b/netutils/webclient/webclient.c
@@ -2430,6 +2430,7 @@ int webclient_get_tunnel(FAR struct webclient_context *ctx,
   struct webclient_conn_s *conn;
 
   _CHECK_STATE(ctx, WEBCLIENT_CONTEXT_STATE_TUNNEL_ESTABLISHED);
+  DEBUGASSERT(ctx->http_status / 100 == 2);
   ws = ctx->ws;
   DEBUGASSERT(ws != NULL);
   conn = ws->conn;