summaryrefslogtreecommitdiff
path: root/indra/llcorehttp/_httpoprequest.cpp
diff options
context:
space:
mode:
authorNat Goodspeed <nat@lindenlab.com>2017-10-11 14:35:49 -0400
committerNat Goodspeed <nat@lindenlab.com>2017-10-11 14:35:49 -0400
commit0c7bc67814dd4fa347401c24ba0e1be78e4b838f (patch)
tree450fc1ce0aff2f2880c32b3ca85161ca0ceff8a6 /indra/llcorehttp/_httpoprequest.cpp
parentb6d22de58850fc9a5b34eeb5b7930e5845bfc42d (diff)
parent25be14381e29481413c94edf5436c0af715a1578 (diff)
Automated merge with ssh://bitbucket.org/lindenlab/viewer-release
Diffstat (limited to 'indra/llcorehttp/_httpoprequest.cpp')
-rw-r--r--indra/llcorehttp/_httpoprequest.cpp27
1 files changed, 26 insertions, 1 deletions
diff --git a/indra/llcorehttp/_httpoprequest.cpp b/indra/llcorehttp/_httpoprequest.cpp
index fceed8524b..721147ffb0 100644
--- a/indra/llcorehttp/_httpoprequest.cpp
+++ b/indra/llcorehttp/_httpoprequest.cpp
@@ -47,6 +47,8 @@
#include "llhttpconstants.h"
#include "llproxy.h"
+#include "httpstats.h"
+
// *DEBUG: "[curl:bugs] #1420" problem and testing.
//
// A pipelining problem, https://sourceforge.net/p/curl/bugs/1420/,
@@ -247,6 +249,8 @@ void HttpOpRequest::visitNotifier(HttpRequest * request)
response->setHeaders(mReplyHeaders);
response->setRequestURL(mReqURL);
+ response->setRequestMethod(methodToString(mReqMethod));
+
if (mReplyOffset || mReplyLength)
{
// Got an explicit offset/length in response
@@ -810,6 +814,7 @@ size_t HttpOpRequest::writeCallback(void * data, size_t size, size_t nmemb, void
}
const size_t req_size(size * nmemb);
const size_t write_size(op->mReplyBody->append(static_cast<char *>(data), req_size));
+ HTTPStats::instance().recordDataDown(write_size);
return write_size;
}
@@ -838,7 +843,8 @@ size_t HttpOpRequest::readCallback(void * data, size_t size, size_t nmemb, void
const size_t do_size((std::min)(req_size, body_size - op->mCurlBodyPos));
const size_t read_size(op->mReqBody->read(op->mCurlBodyPos, static_cast<char *>(data), do_size));
- op->mCurlBodyPos += read_size;
+ HTTPStats::instance().recordDataUp(read_size);
+ op->mCurlBodyPos += read_size;
return read_size;
}
@@ -1143,6 +1149,25 @@ int HttpOpRequest::debugCallback(CURL * handle, curl_infotype info, char * buffe
return 0;
}
+std::string HttpOpRequest::methodToString(const HttpOpRequest::EMethod &e)
+{
+ if (e == HOR_COPY)
+ return "COPY";
+ else if (e == HOR_DELETE)
+ return "DELETE";
+ else if (e == HOR_GET)
+ return "GET";
+ else if (e == HOR_MOVE)
+ return "MOVE";
+ else if (e == HOR_PATCH)
+ return "PATCH";
+ else if (e == HOR_POST)
+ return "POST";
+ else if (e == HOR_PUT)
+ return "PUT";
+
+ return "UNKNOWN";
+}
} // end namespace LLCore