From 78610ce4da99a7edf52f9200bd11db2e660624e4 Mon Sep 17 00:00:00 2001
From: Rye Mutt <rye@alchemyviewer.org>
Date: Thu, 20 Jan 2022 12:48:56 -0500
Subject: [PATCH] Maybe fix http tests with new curl

---
 indra/llcorehttp/_httpoprequest.cpp         | 4 ++--
 indra/llcorehttp/httpheaders.cpp            | 6 +++---
 indra/llcorehttp/llhttpconstants.cpp        | 1 +
 indra/llcorehttp/llhttpconstants.h          | 1 +
 indra/llcorehttp/tests/test_httprequest.hpp | 8 ++++----
 indra/llmessage/llcorehttputil.cpp          | 4 ++--
 6 files changed, 13 insertions(+), 11 deletions(-)

diff --git a/indra/llcorehttp/_httpoprequest.cpp b/indra/llcorehttp/_httpoprequest.cpp
index 82f3e332554..085597e7107 100644
--- a/indra/llcorehttp/_httpoprequest.cpp
+++ b/indra/llcorehttp/_httpoprequest.cpp
@@ -648,12 +648,12 @@ HttpStatus HttpOpRequest::prepareRequest(HttpService * service)
 		break;
 	}
 
-	if (!mReqHeaders || !mReqHeaders->find("Connection"))
+	if (!mReqHeaders || !mReqHeaders->find(HTTP_OUT_HEADER_CONNECTION))
 	{
         mCurlHeaders = curl_slist_append(mCurlHeaders, "Connection: keep-alive");
 	}
 
-	if (!mReqHeaders || !mReqHeaders->find("Keep-Alive"))
+	if (!mReqHeaders || !mReqHeaders->find(HTTP_OUT_HEADER_KEEP_ALIVE))
 	{
         mCurlHeaders = curl_slist_append(mCurlHeaders, "Keep-Alive: 300");
 	}
diff --git a/indra/llcorehttp/httpheaders.cpp b/indra/llcorehttp/httpheaders.cpp
index 1c0381ccb6e..7e4eadc8fd8 100644
--- a/indra/llcorehttp/httpheaders.cpp
+++ b/indra/llcorehttp/httpheaders.cpp
@@ -51,7 +51,7 @@ void HttpHeaders::append(const std::string & name, const std::string & value)
         }
     }
 
-	mHeaders.push_back(value_type(name, value));
+	mHeaders.emplace_back(name, value);
 }
 
 
@@ -66,7 +66,7 @@ void HttpHeaders::append(const char * name, const char * value)
         }
     }
 
-	mHeaders.push_back(value_type(name, value));
+	mHeaders.emplace_back(name, value);
 }
 
 
@@ -108,7 +108,7 @@ void HttpHeaders::appendNormal(const char * header, size_t size)
 		name.assign(header, size);
 	}
 
-	mHeaders.push_back(value_type(name, value));
+    mHeaders.emplace_back(name, value);
 }
 
 
diff --git a/indra/llcorehttp/llhttpconstants.cpp b/indra/llcorehttp/llhttpconstants.cpp
index 71d4f19408d..30c0fe1892d 100755
--- a/indra/llcorehttp/llhttpconstants.cpp
+++ b/indra/llcorehttp/llhttpconstants.cpp
@@ -88,6 +88,7 @@ const std::string HTTP_OUT_HEADER_VARY("Vary");
 const std::string HTTP_OUT_HEADER_VIA("Via");
 const std::string HTTP_OUT_HEADER_WARNING("Warning");
 const std::string HTTP_OUT_HEADER_WWW_AUTHENTICATE("WWW-Authenticate");
+const std::string HTTP_OUT_HEADER_SL_UDP_LISTEN_PORT("X-SecondLife-UDP-Listen-Port");
 
 // Incoming headers are normalized to lower-case.
 const std::string HTTP_IN_HEADER_ACCEPT_LANGUAGE("accept-language");
diff --git a/indra/llcorehttp/llhttpconstants.h b/indra/llcorehttp/llhttpconstants.h
index 121448854eb..150547a4e2b 100755
--- a/indra/llcorehttp/llhttpconstants.h
+++ b/indra/llcorehttp/llhttpconstants.h
@@ -178,6 +178,7 @@ extern const std::string HTTP_OUT_HEADER_VARY;
 extern const std::string HTTP_OUT_HEADER_VIA;
 extern const std::string HTTP_OUT_HEADER_WARNING;
 extern const std::string HTTP_OUT_HEADER_WWW_AUTHENTICATE;
+extern const std::string HTTP_OUT_HEADER_SL_UDP_LISTEN_PORT;
 
 // Incoming headers are normalized to lower-case.
 extern const std::string HTTP_IN_HEADER_ACCEPT_LANGUAGE;
diff --git a/indra/llcorehttp/tests/test_httprequest.hpp b/indra/llcorehttp/tests/test_httprequest.hpp
index 2add62ab4df..1179661e828 100644
--- a/indra/llcorehttp/tests/test_httprequest.hpp
+++ b/indra/llcorehttp/tests/test_httprequest.hpp
@@ -2334,7 +2334,7 @@ void HttpRequestTestObjectType::test<20>()
 		headers = HttpHeaders::ptr_t(new HttpHeaders());
         headers->append("Keep-Alive", "120");
 		headers->append("Accept", "text/html");
-		headers->append("Content-Type", "application/llsd+xml");
+		headers->append(HTTP_OUT_HEADER_CONTENT_TYPE "application/llsd+xml");
 		headers->append("Cache-Control", "no-store");
 		
 		// And a buffer array
@@ -2532,9 +2532,9 @@ void HttpRequestTestObjectType::test<21>()
 
 		// headers
 		headers = HttpHeaders::ptr_t(new HttpHeaders);
-		headers->append("Content-Type", "text/plain");
-		headers->append("Content-Type", "text/html");
-		headers->append("Content-Type", "application/llsd+xml");
+		headers->append(HTTP_OUT_HEADER_CONTENT_TYPE, "text/plain");
+		headers->append(HTTP_OUT_HEADER_CONTENT_TYPE, "text/html");
+		headers->append(HTTP_OUT_HEADER_CONTENT_TYPE, "application/llsd+xml");
 		
 		// And a buffer array
 		const char * msg("<xml><llsd><string>It was the best of times, it was the worst of times.</string></llsd></xml>");
diff --git a/indra/llmessage/llcorehttputil.cpp b/indra/llmessage/llcorehttputil.cpp
index 20fdb33c03c..7473d350249 100644
--- a/indra/llmessage/llcorehttputil.cpp
+++ b/indra/llmessage/llcorehttputil.cpp
@@ -1181,9 +1181,9 @@ void HttpCoroutineAdapter::checkDefaultHeaders(LLCore::HttpHeaders::ptr_t &heade
         headers->append(HTTP_OUT_HEADER_CONTENT_TYPE, HTTP_CONTENT_LLSD_XML);
     }
 
-    if (!headers->find("X-SecondLife-UDP-Listen-Port") && gMessageSystem)
+    if (!headers->find(HTTP_OUT_HEADER_SL_UDP_LISTEN_PORT) && gMessageSystem)
     {
-        headers->append("X-SecondLife-UDP-Listen-Port", llformat("%d", gMessageSystem->mPort));
+        headers->append(HTTP_OUT_HEADER_SL_UDP_LISTEN_PORT, llformat("%d", gMessageSystem->mPort));
     }
 }
 
-- 
GitLab