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:17 UTC
[incubator-nuttx-apps] 03/04: webclient: Don't forget to check http status before webclient_get_tunnel
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;