]> git.ipfire.org Git - thirdparty/openssl.git/commitdiff
http_client.c: fix error reporting (a char was missing; improve style)
authorDr. David von Oheimb <David.von.Oheimb@siemens.com>
Thu, 17 Jun 2021 07:31:50 +0000 (09:31 +0200)
committerDr. David von Oheimb <dev@ddvo.net>
Fri, 18 Jun 2021 12:29:19 +0000 (14:29 +0200)
Reviewed-by: Tomas Mraz <tomas@openssl.org>
Reviewed-by: Paul Dale <pauli@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/15796)

crypto/http/http_client.c

index ef8750303c5153c70e79dbe3b2b554c62a60e28d..e28db962887f411a48a60c0c8be185325d3f535a 100644 (file)
@@ -434,10 +434,10 @@ static int parse_http_line1(char *line, int *found_keep_alive)
         else
             retcode = HTTP_R_RECEIVED_ERROR;
         if (*reason == '\0')
-            ERR_raise_data(ERR_LIB_HTTP, retcode, "Code=%s", code);
+            ERR_raise_data(ERR_LIB_HTTP, retcode, "code=%s", code);
         else
             ERR_raise_data(ERR_LIB_HTTP, retcode,
-                           "Code=%s, Reason=%s", code, reason);
+                           "code=%s, reason=%s", code, reason);
         return 0;
     }
 
@@ -1289,7 +1289,7 @@ int OSSL_HTTP_proxy_connect(BIO *bio, const char *server, const char *port,
         /*-
          * The first line is the HTTP response.
          * According to RFC 7230, it is formatted exactly like this:
-         * HTTP/d.d ddd Reason text\r\n
+         * HTTP/d.d ddd reason text\r\n
          */
         read_len = BIO_gets(fbio, mbuf, BUF_SIZE);
         /* the BIO may not block, so we must wait for the 1st line to come in */
@@ -1316,14 +1316,13 @@ int OSSL_HTTP_proxy_connect(BIO *bio, const char *server, const char *port,
 
         /* RFC 7231 4.3.6: any 2xx status code is valid */
         if (strncmp(mbufp, " 2", strlen(" 2")) != 0) {
-            mbufp += 1;
             /* chop any trailing whitespace */
             while (read_len > 0 && ossl_isspace(mbuf[read_len - 1]))
                 read_len--;
             mbuf[read_len] = '\0';
             ERR_raise_data(ERR_LIB_HTTP, HTTP_R_CONNECT_FAILURE,
-                           "Reason=%s", mbufp);
-            BIO_printf(bio_err, "%s: HTTP CONNECT failed, Reason=%s\n",
+                           "reason=%s", mbufp);
+            BIO_printf(bio_err, "%s: HTTP CONNECT failed, reason=%s\n",
                        prog, mbufp);
             goto end;
         }