http_client.c: fix HTTP_VERSION_STR_LEN and make it more efficient master
authorDr. David von Oheimb <David.von.Oheimb@siemens.com>
Thu, 17 Jun 2021 11:29:06 +0000 (13:29 +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 1652a2c..aea53b3 100644 (file)
@@ -26,9 +26,9 @@
 #define HAS_PREFIX(str, prefix) (strncmp(str, prefix, sizeof(prefix) - 1) == 0)
 #define HTTP_PREFIX "HTTP/"
 #define HTTP_VERSION_PATT "1." /* allow 1.x */
+#define HTTP_VERSION_STR_LEN sizeof(HTTP_VERSION_PATT) /* == strlen("1.0") */
 #define HTTP_PREFIX_VERSION HTTP_PREFIX""HTTP_VERSION_PATT
 #define HTTP_1_0 HTTP_PREFIX_VERSION"0" /* "HTTP/1.0" */
-#define HTTP_VERSION_STR_LEN (strlen(HTTP_PREFIX_VERSION) + 1)
 #define HTTP_LINE1_MINLEN (sizeof(HTTP_PREFIX_VERSION "x 200\n") - 1)
 #define HTTP_VERSION_MAX_REDIRECTIONS 50