summaryrefslogtreecommitdiff
path: root/indra/llcorehttp
diff options
context:
space:
mode:
authorRider Linden <rider@lindenlab.com>2015-05-27 17:15:01 -0700
committerRider Linden <rider@lindenlab.com>2015-05-27 17:15:01 -0700
commit83543e556cba8753077c9f004bb0dc71b4509007 (patch)
treedb3a0f30e486475f72ddf945a5a6263b1219a4a0 /indra/llcorehttp
parent9134a3a097607e427b18af010774eb842be893f2 (diff)
Memory leak (extra ref) in webprofile
Viewer media routines to coroutine. Post with raw respons in llcorehttputil LLCore::Http added headers only option (applies only on get)
Diffstat (limited to 'indra/llcorehttp')
-rwxr-xr-xindra/llcorehttp/_httpoprequest.cpp8
-rwxr-xr-xindra/llcorehttp/httpoptions.cpp29
-rwxr-xr-xindra/llcorehttp/httpoptions.h10
3 files changed, 36 insertions, 11 deletions
diff --git a/indra/llcorehttp/_httpoprequest.cpp b/indra/llcorehttp/_httpoprequest.cpp
index b1b05dc285..3b6647882e 100755
--- a/indra/llcorehttp/_httpoprequest.cpp
+++ b/indra/llcorehttp/_httpoprequest.cpp
@@ -532,6 +532,7 @@ HttpStatus HttpOpRequest::prepareRequest(HttpService * service)
long sslPeerV(0L);
long sslHostV(0L);
long dnsCacheTimeout(-1L);
+ long nobody(0L);
if (mReqOptions)
{
@@ -539,6 +540,7 @@ HttpStatus HttpOpRequest::prepareRequest(HttpService * service)
sslPeerV = mReqOptions->getSSLVerifyPeer() ? 1L : 0L;
sslHostV = mReqOptions->getSSLVerifyHost() ? 2L : 0L;
dnsCacheTimeout = mReqOptions->getDNSCacheTimeout();
+ nobody = mReqOptions->getHeadersOnly() ? 1L : 0L;
}
code = curl_easy_setopt(mCurlHandle, CURLOPT_FOLLOWLOCATION, follow_redirect);
check_curl_easy_code(code, CURLOPT_FOLLOWLOCATION);
@@ -548,6 +550,9 @@ HttpStatus HttpOpRequest::prepareRequest(HttpService * service)
code = curl_easy_setopt(mCurlHandle, CURLOPT_SSL_VERIFYHOST, sslHostV);
check_curl_easy_code(code, CURLOPT_SSL_VERIFYHOST);
+ code = curl_easy_setopt(mCurlHandle, CURLOPT_NOBODY, nobody);
+ check_curl_easy_code(code, CURLOPT_NOBODY);
+
// The Linksys WRT54G V5 router has an issue with frequent
// DNS lookups from LAN machines. If they happen too often,
// like for every HTTP request, the router gets annoyed after
@@ -587,7 +592,8 @@ HttpStatus HttpOpRequest::prepareRequest(HttpService * service)
switch (mReqMethod)
{
case HOR_GET:
- code = curl_easy_setopt(mCurlHandle, CURLOPT_HTTPGET, 1);
+ if (nobody == 0)
+ code = curl_easy_setopt(mCurlHandle, CURLOPT_HTTPGET, 1);
check_curl_easy_code(code, CURLOPT_HTTPGET);
break;
diff --git a/indra/llcorehttp/httpoptions.cpp b/indra/llcorehttp/httpoptions.cpp
index a4d08a80df..2b42bcaf6d 100755
--- a/indra/llcorehttp/httpoptions.cpp
+++ b/indra/llcorehttp/httpoptions.cpp
@@ -34,16 +34,17 @@ namespace LLCore
HttpOptions::HttpOptions() : RefCounted(true),
- mWantHeaders(false),
- mTracing(HTTP_TRACE_OFF),
- mTimeout(HTTP_REQUEST_TIMEOUT_DEFAULT),
- mTransferTimeout(HTTP_REQUEST_XFER_TIMEOUT_DEFAULT),
- mRetries(HTTP_RETRY_COUNT_DEFAULT),
- mUseRetryAfter(HTTP_USE_RETRY_AFTER_DEFAULT),
- mFollowRedirects(false),
- mVerifyPeer(false),
- mVerifyHost(false),
- mDNSCacheTimeout(-1L)
+ mWantHeaders(false),
+ mTracing(HTTP_TRACE_OFF),
+ mTimeout(HTTP_REQUEST_TIMEOUT_DEFAULT),
+ mTransferTimeout(HTTP_REQUEST_XFER_TIMEOUT_DEFAULT),
+ mRetries(HTTP_RETRY_COUNT_DEFAULT),
+ mUseRetryAfter(HTTP_USE_RETRY_AFTER_DEFAULT),
+ mFollowRedirects(false),
+ mVerifyPeer(false),
+ mVerifyHost(false),
+ mDNSCacheTimeout(-1L),
+ mNoBody(false)
{}
@@ -104,4 +105,12 @@ void HttpOptions::setDNSCacheTimeout(int timeout)
{
mDNSCacheTimeout = timeout;
}
+
+void HttpOptions::setHeadersOnly(bool nobody)
+{
+ mNoBody = nobody;
+ if (mNoBody)
+ setWantHeaders(true);
+}
+
} // end namespace LLCore
diff --git a/indra/llcorehttp/httpoptions.h b/indra/llcorehttp/httpoptions.h
index 765d2431bb..21ecff85af 100755
--- a/indra/llcorehttp/httpoptions.h
+++ b/indra/llcorehttp/httpoptions.h
@@ -149,6 +149,15 @@ public:
{
return mDNSCacheTimeout;
}
+
+ /// Retrieve only the headers and status from the request. Setting this
+ /// to true implies setWantHeaders(true) as well.
+ /// Default: false
+ void setHeadersOnly(bool nobody);
+ bool getHeadersOnly() const
+ {
+ return mNoBody;
+ }
protected:
bool mWantHeaders;
@@ -161,6 +170,7 @@ protected:
bool mVerifyPeer;
bool mVerifyHost;
int mDNSCacheTimeout;
+ bool mNoBody;
}; // end class HttpOptions