From 6c3375356e7366f4384d9233a43d2c58a01e7241 Mon Sep 17 00:00:00 2001
From: Monty Brandenberg <monty@lindenlab.com>
Date: Fri, 21 Dec 2012 22:21:58 +0000
Subject: [PATCH] SH-3331 Fix incorrect overrun message when sending body with
 HTTP request.  During readcallback, would generate an overrun-type message
 about reading position beyond end-of-data.  Mistake was is messaging when
 state is exactly at end of data (which is expected) versus an overrun.  Both
 result in declaring end-of-data to libcurl.  Also changed some of the status
 logging for the metrics payload to be less chatty on success, more
 informative on error.

---
 indra/llcorehttp/_httpoprequest.cpp | 9 +++++++--
 indra/newview/lltexturefetch.cpp    | 9 +++++----
 2 files changed, 12 insertions(+), 6 deletions(-)

diff --git a/indra/llcorehttp/_httpoprequest.cpp b/indra/llcorehttp/_httpoprequest.cpp
index 7db19b18410..51a8eaf9989 100644
--- a/indra/llcorehttp/_httpoprequest.cpp
+++ b/indra/llcorehttp/_httpoprequest.cpp
@@ -580,8 +580,13 @@ size_t HttpOpRequest::readCallback(void * data, size_t size, size_t nmemb, void
 	const size_t body_size(op->mReqBody->size());
 	if (body_size <= op->mCurlBodyPos)
 	{
-		LL_WARNS("HttpCore") << "Request body position beyond body size.  Aborting request."
-							 << LL_ENDL;
+		if (body_size < op->mCurlBodyPos)
+		{
+			// Warn but continue if the read position moves beyond end-of-body
+			// for some reason.
+			LL_WARNS("HttpCore") << "Request body position beyond body size.  Truncating request body."
+								 << LL_ENDL;
+		}
 		return 0;
 	}
 
diff --git a/indra/newview/lltexturefetch.cpp b/indra/newview/lltexturefetch.cpp
index a2854dd6d88..8af403c1c69 100644
--- a/indra/newview/lltexturefetch.cpp
+++ b/indra/newview/lltexturefetch.cpp
@@ -3678,13 +3678,14 @@ class AssetReportHandler : public LLCore::HttpHandler
 
 		if (status)
 		{
-			LL_WARNS("Texture") << "Successfully delivered asset metrics to grid."
-								<< LL_ENDL;
+			LL_DEBUGS("Texture") << "Successfully delivered asset metrics to grid."
+								 << LL_ENDL;
 		}
 		else
 		{
-			LL_WARNS("Texture") << "Error delivering asset metrics to grid.  Reason:  "
-								<< status.toString() << LL_ENDL;
+			LL_WARNS("Texture") << "Error delivering asset metrics to grid.  Status:  "
+								<< status.toHex()
+								<< ", Reason:  " << status.toString() << LL_ENDL;
 		}
 	}
 }; // end class AssetReportHandler
-- 
GitLab