]> www.infradead.org Git - users/dwmw2/openconnect.git/commitdiff
http: print proper log message on empty response
authorSimon Ser <contact@emersion.fr>
Tue, 25 Jun 2024 16:14:13 +0000 (18:14 +0200)
committerSimon Ser <contact@emersion.fr>
Tue, 25 Jun 2024 16:14:13 +0000 (18:14 +0200)
The same log message was used for both an error HTTP status and an
empty HTTP response. Use different messages for each case.

Signed-off-by: Simon Ser <contact@emersion.fr>
http.c

diff --git a/http.c b/http.c
index 5656e9bf8fca6bf9448963ebdf45dc4d67d21c4f..702b6ffa29fa839de9fffa89256ad2b39994e3e0 100644 (file)
--- a/http.c
+++ b/http.c
@@ -979,9 +979,13 @@ int do_https_request(struct openconnect_info *vpninfo, const char *method, const
                goto out;
        }
        if (!buf->pos || result != 200) {
-               vpn_progress(vpninfo, PRG_ERR,
-                            _("Unexpected %d result from server\n"),
-                            result);
+               if (!buf->pos)
+                       vpn_progress(vpninfo, PRG_ERR,
+                                    _("Unexpected empty response body from server\n"));
+               else
+                       vpn_progress(vpninfo, PRG_ERR,
+                                    _("Unexpected %d result from server\n"),
+                                    result);
                if (result == 401 || result == 403)
                        result = -EPERM;
                else if (result == 512) /* GlobalProtect invalid username/password */