diff options
Diffstat (limited to 'indra/llcorehttp')
| -rw-r--r-- | indra/llcorehttp/CMakeLists.txt | 1 | ||||
| -rw-r--r-- | indra/llcorehttp/_httpinternal.h | 82 | ||||
| -rw-r--r-- | indra/llcorehttp/_httplibcurl.cpp | 17 | ||||
| -rw-r--r-- | indra/llcorehttp/_httplibcurl.h | 14 | ||||
| -rw-r--r-- | indra/llcorehttp/_httpoperation.cpp | 3 | ||||
| -rw-r--r-- | indra/llcorehttp/_httpoprequest.cpp | 62 | ||||
| -rw-r--r-- | indra/llcorehttp/_httpoprequest.h | 6 | ||||
| -rw-r--r-- | indra/llcorehttp/_httppolicy.cpp | 4 | ||||
| -rw-r--r-- | indra/llcorehttp/_httppolicy.h | 3 | ||||
| -rw-r--r-- | indra/llcorehttp/_httppolicyglobal.cpp | 10 | ||||
| -rw-r--r-- | indra/llcorehttp/_httpservice.cpp | 9 | ||||
| -rw-r--r-- | indra/llcorehttp/_refcounted.cpp | 4 | ||||
| -rw-r--r-- | indra/llcorehttp/bufferarray.cpp | 4 | ||||
| -rw-r--r-- | indra/llcorehttp/httpcommon.cpp | 2 | ||||
| -rw-r--r-- | indra/llcorehttp/httpoptions.cpp | 8 | ||||
| -rw-r--r-- | indra/llcorehttp/httprequest.cpp | 1 | ||||
| -rw-r--r-- | indra/llcorehttp/httprequest.h | 6 | 
17 files changed, 160 insertions, 76 deletions
| diff --git a/indra/llcorehttp/CMakeLists.txt b/indra/llcorehttp/CMakeLists.txt index 9d8bae973e..acf4c0d6a3 100644 --- a/indra/llcorehttp/CMakeLists.txt +++ b/indra/llcorehttp/CMakeLists.txt @@ -53,6 +53,7 @@ set(llcorehttp_HEADER_FILES      httpoptions.h      httprequest.h      httpresponse.h +    _httpinternal.h      _httplibcurl.h      _httpopcancel.h      _httpoperation.h diff --git a/indra/llcorehttp/_httpinternal.h b/indra/llcorehttp/_httpinternal.h new file mode 100644 index 0000000000..bc0bd6a2ab --- /dev/null +++ b/indra/llcorehttp/_httpinternal.h @@ -0,0 +1,82 @@ +/** + * @file httpinternal.h + * @brief Implementation constants and magic numbers + * + * $LicenseInfo:firstyear=2012&license=viewerlgpl$ + * Second Life Viewer Source Code + * Copyright (C) 2012, Linden Research, Inc. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; + * version 2.1 of the License only. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA + * + * Linden Research, Inc., 945 Battery Street, San Francisco, CA  94111  USA + * $/LicenseInfo$ + */ + +#ifndef	_LLCORE_HTTP_INTERNAL_H_ +#define	_LLCORE_HTTP_INTERNAL_H_ + + +// If you find this included in a public interface header, +// something wrong is probably happening. + + +namespace LLCore +{ + +// Maxium number of policy classes that can be defined. +// *FIXME:  Currently limited to the default class, extend. +const int POLICY_CLASS_LIMIT = 1; + +// Debug/informational tracing.  Used both +// as a global option and in per-request traces. +const int TRACE_OFF = 0; +const int TRACE_LOW = 1; +const int TRACE_CURL_HEADERS = 2; +const int TRACE_CURL_BODIES = 3; + +const int TRACE_MIN = TRACE_OFF; +const int TRACE_MAX = TRACE_CURL_BODIES; + +// Request retry limits +const int DEFAULT_RETRY_COUNT = 5; +const int LIMIT_RETRY_MIN = 0; +const int LIMIT_RETRY_MAX = 100; + +const int DEFAULT_HTTP_REDIRECTS = 10; + +// Timeout value used for both connect and protocol exchange. +// Retries and time-on-queue are not included and aren't +// accounted for. +const long DEFAULT_TIMEOUT = 30L; +const long LIMIT_TIMEOUT_MIN = 0L; +const long LIMIT_TIMEOUT_MAX = 3600L; + +// Limits on connection counts +const int DEFAULT_CONNECTIONS = 8; +const int LIMIT_CONNECTIONS_MIN = 1; +const int LIMIT_CONNECTIONS_MAX = 256; + +// Tuning parameters + +// Time worker thread sleeps after a pass through the +// request, ready and active queues. +const int LOOP_SLEEP_NORMAL_MS = 2; + +// Block allocation size (a tuning parameter) is found +// in bufferarray.h. + +}  // end namespace LLCore + +#endif	// _LLCORE_HTTP_INTERNAL_H_ diff --git a/indra/llcorehttp/_httplibcurl.cpp b/indra/llcorehttp/_httplibcurl.cpp index a176dd5b2a..65eb642056 100644 --- a/indra/llcorehttp/_httplibcurl.cpp +++ b/indra/llcorehttp/_httplibcurl.cpp @@ -31,6 +31,8 @@  #include "_httpoprequest.h"  #include "_httppolicy.h" +#include "llhttpstatuscodes.h" +  namespace LLCore  { @@ -39,7 +41,8 @@ namespace LLCore  HttpLibcurl::HttpLibcurl(HttpService * service)  	: mService(service)  { -	for (int policy_class(0); policy_class < HttpRequest::POLICY_CLASS_LIMIT; ++policy_class) +	// *FIXME:  Use active policy class count later +	for (int policy_class(0); policy_class < LL_ARRAY_SIZE(mMultiHandles); ++policy_class)  	{  		mMultiHandles[policy_class] = 0;  	} @@ -61,7 +64,7 @@ HttpLibcurl::~HttpLibcurl()  		mActiveOps.erase(item);  	} -	for (int policy_class(0); policy_class < HttpRequest::POLICY_CLASS_LIMIT; ++policy_class) +	for (int policy_class(0); policy_class < LL_ARRAY_SIZE(mMultiHandles); ++policy_class)  	{  		if (mMultiHandles[policy_class])  		{ @@ -89,7 +92,7 @@ HttpService::ELoopSpeed HttpLibcurl::processTransport()  	HttpService::ELoopSpeed	ret(HttpService::REQUEST_SLEEP);  	// Give libcurl some cycles to do I/O & callbacks -	for (int policy_class(0); policy_class < HttpRequest::POLICY_CLASS_LIMIT; ++policy_class) +	for (int policy_class(0); policy_class < LL_ARRAY_SIZE(mMultiHandles); ++policy_class)  	{  		if (! mMultiHandles[policy_class])  			continue; @@ -144,7 +147,7 @@ HttpService::ELoopSpeed HttpLibcurl::processTransport()  void HttpLibcurl::addOp(HttpOpRequest * op)  { -	llassert_always(op->mReqPolicy < HttpRequest::POLICY_CLASS_LIMIT); +	llassert_always(op->mReqPolicy < POLICY_CLASS_LIMIT);  	llassert_always(mMultiHandles[op->mReqPolicy] != NULL);  	// Create standard handle @@ -159,7 +162,7 @@ void HttpLibcurl::addOp(HttpOpRequest * op)  	curl_multi_add_handle(mMultiHandles[op->mReqPolicy], op->mCurlHandle);  	op->mCurlActive = true; -	if (op->mTracing > 0) +	if (op->mTracing > TRACE_OFF)  	{  		HttpPolicy & policy(mService->getPolicy()); @@ -208,7 +211,7 @@ bool HttpLibcurl::completeRequest(CURLM * multi_handle, CURL * handle, CURLcode  	}  	if (op->mStatus)  	{ -		int http_status(200); +		int http_status(HTTP_OK);  		curl_easy_getinfo(handle, CURLINFO_RESPONSE_CODE, &http_status);  		op->mStatus = LLCore::HttpStatus(http_status); @@ -220,7 +223,7 @@ bool HttpLibcurl::completeRequest(CURLM * multi_handle, CURL * handle, CURLcode  	op->mCurlHandle = NULL;  	// Tracing -	if (op->mTracing > 0) +	if (op->mTracing > TRACE_OFF)  	{  		LL_INFOS("CoreHttp") << "TRACE, RequestComplete, Handle:  "  							 << static_cast<HttpHandle>(op) diff --git a/indra/llcorehttp/_httplibcurl.h b/indra/llcorehttp/_httplibcurl.h index 16b68bde43..0d0c4cad6d 100644 --- a/indra/llcorehttp/_httplibcurl.h +++ b/indra/llcorehttp/_httplibcurl.h @@ -36,6 +36,7 @@  #include "httprequest.h"  #include "_httpservice.h" +#include "_httpinternal.h"  namespace LLCore @@ -91,17 +92,8 @@ protected:  protected:  	HttpService *		mService;				// Simple reference, not owner  	active_set_t		mActiveOps; -	CURLM *				mMultiHandles[HttpRequest::POLICY_CLASS_LIMIT]; -};  // end class HttpLibcurl - - -// --------------------------------------- -// Free functions -// --------------------------------------- - - -curl_slist * append_headers_to_slist(const HttpHeaders *, curl_slist * slist); - +	CURLM *				mMultiHandles[POLICY_CLASS_LIMIT]; +}; // end class HttpLibcurl  }  // end namespace LLCore diff --git a/indra/llcorehttp/_httpoperation.cpp b/indra/llcorehttp/_httpoperation.cpp index 5a31bf90e7..0d9553434e 100644 --- a/indra/llcorehttp/_httpoperation.cpp +++ b/indra/llcorehttp/_httpoperation.cpp @@ -33,6 +33,7 @@  #include "_httprequestqueue.h"  #include "_httpreplyqueue.h"  #include "_httpservice.h" +#include "_httpinternal.h"  #include "lltimer.h" @@ -142,7 +143,7 @@ HttpStatus HttpOperation::cancel()  void HttpOperation::addAsReply()  { -	if (mTracing > 0) +	if (mTracing > TRACE_OFF)  	{  		LL_INFOS("CoreHttp") << "TRACE, ToReplyQueue, Handle:  "  							 << static_cast<HttpHandle>(this) diff --git a/indra/llcorehttp/_httpoprequest.cpp b/indra/llcorehttp/_httpoprequest.cpp index ce41ebcce0..04a8e0baff 100644 --- a/indra/llcorehttp/_httpoprequest.cpp +++ b/indra/llcorehttp/_httpoprequest.cpp @@ -42,6 +42,7 @@  #include "_httppolicy.h"  #include "_httppolicyglobal.h"  #include "_httplibcurl.h" +#include "_httpinternal.h"  #include "llhttpstatuscodes.h"  #include "llproxy.h" @@ -73,13 +74,14 @@ void escape_libcurl_debug_data(char * buffer, size_t len, bool scrub,  							   std::string & safe_line); -#if defined(WIN32) +#if LL_WINDOWS  // Not available on windows where the legacy strtok interface  // is thread-safe.  char *strtok_r(char *str, const char *delim, char **saveptr); -#endif +#endif // LL_WINDOWS +  } @@ -108,7 +110,7 @@ HttpOpRequest::HttpOpRequest()  	  mReplyHeaders(NULL),  	  mPolicyRetries(0),  	  mPolicyRetryAt(HttpTime(0)), -	  mPolicyRetryLimit(5) +	  mPolicyRetryLimit(DEFAULT_RETRY_COUNT)  {  	// *NOTE:  As members are added, retry initialization/cleanup  	// may need to be extended in @prepareRequest(). @@ -334,8 +336,8 @@ void HttpOpRequest::setupCommon(HttpRequest::policy_t policy_id,  			mProcFlags |= PF_SAVE_HEADERS;  		}  		mPolicyRetryLimit = options->getRetries(); -		mPolicyRetryLimit = llclamp(mPolicyRetryLimit, 0, 100); -		mTracing = (std::max)(mTracing, llclamp(options->getTrace(), 0, 3)); +		mPolicyRetryLimit = llclamp(mPolicyRetryLimit, LIMIT_RETRY_MIN, LIMIT_RETRY_MAX); +		mTracing = (std::max)(mTracing, llclamp(options->getTrace(), TRACE_MIN, TRACE_MAX));  	}  } @@ -384,7 +386,7 @@ HttpStatus HttpOpRequest::prepareRequest(HttpService * service)  	curl_easy_setopt(mCurlHandle, CURLOPT_DNS_CACHE_TIMEOUT, 0);  	curl_easy_setopt(mCurlHandle, CURLOPT_AUTOREFERER, 1);  	curl_easy_setopt(mCurlHandle, CURLOPT_FOLLOWLOCATION, 1); -	curl_easy_setopt(mCurlHandle, CURLOPT_MAXREDIRS, 10);		// *FIXME:  parameterize this later +	curl_easy_setopt(mCurlHandle, CURLOPT_MAXREDIRS, DEFAULT_HTTP_REDIRECTS);	// *FIXME:  parameterize this later  	curl_easy_setopt(mCurlHandle, CURLOPT_WRITEFUNCTION, writeCallback);  	curl_easy_setopt(mCurlHandle, CURLOPT_WRITEDATA, mCurlHandle);  	curl_easy_setopt(mCurlHandle, CURLOPT_READFUNCTION, readCallback); @@ -452,8 +454,6 @@ HttpStatus HttpOpRequest::prepareRequest(HttpService * service)  			curl_easy_setopt(mCurlHandle, CURLOPT_INFILESIZE, data_size);  			curl_easy_setopt(mCurlHandle, CURLOPT_POSTFIELDS, (void *) NULL);  			mCurlHeaders = curl_slist_append(mCurlHeaders, "Expect:"); -			mCurlHeaders = curl_slist_append(mCurlHeaders, "Connection: keep-alive"); -			mCurlHeaders = curl_slist_append(mCurlHeaders, "Keep-alive: 300");  		}  		break; @@ -463,7 +463,7 @@ HttpStatus HttpOpRequest::prepareRequest(HttpService * service)  	}  	// Tracing -	if (mTracing > 1) +	if (mTracing >= TRACE_CURL_HEADERS)  	{  		curl_easy_setopt(mCurlHandle, CURLOPT_VERBOSE, 1);  		curl_easy_setopt(mCurlHandle, CURLOPT_DEBUGDATA, mCurlHandle); @@ -478,7 +478,7 @@ HttpStatus HttpOpRequest::prepareRequest(HttpService * service)  		char range_line[64]; -#if defined(WIN32) +#if LL_WINDOWS  		_snprintf_s(range_line, sizeof(range_line), sizeof(range_line) - 1,  					(mReqLength ? fmt1 : fmt2),  					(unsigned long) mReqOffset, (unsigned long) (mReqOffset + mReqLength - 1)); @@ -486,7 +486,7 @@ HttpStatus HttpOpRequest::prepareRequest(HttpService * service)  		snprintf(range_line, sizeof(range_line),  				 (mReqLength ? fmt1 : fmt2),  				 (unsigned long) mReqOffset, (unsigned long) (mReqOffset + mReqLength - 1)); -#endif // defined(WIN32) +#endif // LL_WINDOWS  		range_line[sizeof(range_line) - 1] = '\0';  		mCurlHeaders = curl_slist_append(mCurlHeaders, range_line);  	} @@ -494,11 +494,11 @@ HttpStatus HttpOpRequest::prepareRequest(HttpService * service)  	mCurlHeaders = curl_slist_append(mCurlHeaders, "Pragma:");  	// Request options -	long timeout(30); +	long timeout(DEFAULT_TIMEOUT);  	if (mReqOptions)  	{  		timeout = mReqOptions->getTimeout(); -		timeout = llclamp(timeout, 0L, 3600L); +		timeout = llclamp(timeout, LIMIT_TIMEOUT_MIN, LIMIT_TIMEOUT_MAX);  	}  	curl_easy_setopt(mCurlHandle, CURLOPT_TIMEOUT, timeout);  	curl_easy_setopt(mCurlHandle, CURLOPT_CONNECTTIMEOUT, timeout); @@ -599,11 +599,11 @@ size_t HttpOpRequest::headerCallback(void * data, size_t size, size_t nmemb, voi  		memcpy(hdr_buffer, hdr_data, frag_size);  		hdr_buffer[frag_size] = '\0'; -#if defined(WIN32) +#if LL_WINDOWS  		if (! _strnicmp(hdr_buffer, con_ran_line, (std::min)(frag_size, con_ran_line_len)))  #else  		if (! strncasecmp(hdr_buffer, con_ran_line, (std::min)(frag_size, con_ran_line_len))) -#endif +#endif	// LL_WINDOWS  		{  			unsigned int first(0), last(0), length(0);  			int status; @@ -654,7 +654,7 @@ int HttpOpRequest::debugCallback(CURL * handle, curl_infotype info, char * buffe  	switch (info)  	{  	case CURLINFO_TEXT: -		if (op->mTracing > 1) +		if (op->mTracing >= TRACE_CURL_HEADERS)  		{  			tag = "TEXT";  			escape_libcurl_debug_data(buffer, len, true, safe_line); @@ -663,7 +663,7 @@ int HttpOpRequest::debugCallback(CURL * handle, curl_infotype info, char * buffe  		break;  	case CURLINFO_HEADER_IN: -		if (op->mTracing > 1) +		if (op->mTracing >= TRACE_CURL_HEADERS)  		{  			tag = "HEADERIN";  			escape_libcurl_debug_data(buffer, len, true, safe_line); @@ -672,20 +672,20 @@ int HttpOpRequest::debugCallback(CURL * handle, curl_infotype info, char * buffe  		break;  	case CURLINFO_HEADER_OUT: -		if (op->mTracing > 1) +		if (op->mTracing >= TRACE_CURL_HEADERS)  		{  			tag = "HEADEROUT"; -			escape_libcurl_debug_data(buffer, len, true, safe_line); +			escape_libcurl_debug_data(buffer, 2 * len, true, safe_line);		// Goes out as one line  			logit = true;  		}  		break;  	case CURLINFO_DATA_IN: -		if (op->mTracing > 1) +		if (op->mTracing >= TRACE_CURL_HEADERS)  		{  			tag = "DATAIN";  			logit = true; -			if (op->mTracing > 2) +			if (op->mTracing >= TRACE_CURL_BODIES)  			{  				escape_libcurl_debug_data(buffer, len, false, safe_line);  			} @@ -699,11 +699,11 @@ int HttpOpRequest::debugCallback(CURL * handle, curl_infotype info, char * buffe  		break;  	case CURLINFO_DATA_OUT: -		if (op->mTracing > 1) +		if (op->mTracing >= TRACE_CURL_HEADERS)  		{  			tag = "DATAOUT";  			logit = true; -			if (op->mTracing > 2) +			if (op->mTracing >= TRACE_CURL_BODIES)  			{  				escape_libcurl_debug_data(buffer, len, false, safe_line);  			} @@ -755,22 +755,22 @@ int parse_content_range_header(char * buffer,  	if (! strtok_r(buffer, ": \t", &tok_state))  		match = false;  	if (match && (tok = strtok_r(NULL, " \t", &tok_state))) -#if defined(WIN32) +#if LL_WINDOWS  		match = 0 == _stricmp("bytes", tok);  #else  		match = 0 == strcasecmp("bytes", tok); -#endif +#endif // LL_WINDOWS  	if (match && ! (tok = strtok_r(NULL, " \t", &tok_state)))  		match = false;  	if (match)  	{  		unsigned int lcl_first(0), lcl_last(0), lcl_len(0); -#if defined(WIN32) +#if LL_WINDOWS  		if (3 == sscanf_s(tok, "%u-%u/%u", &lcl_first, &lcl_last, &lcl_len))  #else  		if (3 == sscanf(tok, "%u-%u/%u", &lcl_first, &lcl_last, &lcl_len)) -#endif +#endif // LL_WINDOWS  		{  			if (lcl_first > lcl_last || lcl_last >= lcl_len)  				return -1; @@ -779,11 +779,11 @@ int parse_content_range_header(char * buffer,  			*length = lcl_len;  			return 0;  		} -#if defined(WIN32) +#if LL_WINDOWS  		if (2 == sscanf_s(tok, "%u-%u/*", &lcl_first, &lcl_last))  #else  		if (2 == sscanf(tok, "%u-%u/*", &lcl_first, &lcl_last)) -#endif +#endif	// LL_WINDOWS  		{  			if (lcl_first > lcl_last)  				return -1; @@ -798,14 +798,14 @@ int parse_content_range_header(char * buffer,  	return 1;  } -#if defined(WIN32) +#if LL_WINDOWS  char *strtok_r(char *str, const char *delim, char ** savestate)  {  	return strtok_s(str, delim, savestate);  } -#endif +#endif // LL_WINDOWS  void escape_libcurl_debug_data(char * buffer, size_t len, bool scrub, std::string & safe_line) diff --git a/indra/llcorehttp/_httpoprequest.h b/indra/llcorehttp/_httpoprequest.h index 9278445763..f2b709a3a2 100644 --- a/indra/llcorehttp/_httpoprequest.h +++ b/indra/llcorehttp/_httpoprequest.h @@ -172,6 +172,12 @@ public:  };  // end class HttpOpRequestCompare +// --------------------------------------- +// Free functions +// --------------------------------------- + +curl_slist * append_headers_to_slist(const HttpHeaders *, curl_slist * slist); +  }   // end namespace LLCore  #endif	// _LLCORE_HTTP_OPREQUEST_H_ diff --git a/indra/llcorehttp/_httppolicy.cpp b/indra/llcorehttp/_httppolicy.cpp index 0e08d88276..4be9f1d45f 100644 --- a/indra/llcorehttp/_httppolicy.cpp +++ b/indra/llcorehttp/_httppolicy.cpp @@ -126,7 +126,7 @@ HttpService::ELoopSpeed HttpPolicy::processReadyQueue()  	for (int policy_class(0); policy_class < LL_ARRAY_SIZE(mState); ++policy_class)  	{  		int active(transport.getActiveCountInClass(policy_class)); -		int needed(8 - active); +		int needed(DEFAULT_CONNECTIONS - active);				// *FIXME:  move to policy class  		HttpRetryQueue & retryq(mState[policy_class].mRetryQueue);  		HttpReadyQueue & readyq(mState[policy_class].mReadyQueue); @@ -242,7 +242,7 @@ bool HttpPolicy::stageAfterCompletion(HttpOpRequest * op)  int HttpPolicy::getReadyCount(HttpRequest::policy_t policy_class)  { -	if (policy_class < HttpRequest::POLICY_CLASS_LIMIT) +	if (policy_class < POLICY_CLASS_LIMIT)				// *FIXME:  use actual active class count  	{  		return (mState[policy_class].mReadyQueue.size()  				+ mState[policy_class].mRetryQueue.size()); diff --git a/indra/llcorehttp/_httppolicy.h b/indra/llcorehttp/_httppolicy.h index 4114f64848..05de9303b5 100644 --- a/indra/llcorehttp/_httppolicy.h +++ b/indra/llcorehttp/_httppolicy.h @@ -33,6 +33,7 @@  #include "_httpreadyqueue.h"  #include "_httpretryqueue.h"  #include "_httppolicyglobal.h" +#include "_httpinternal.h"  namespace LLCore @@ -108,7 +109,7 @@ protected:  		HttpRetryQueue		mRetryQueue;  	}; -	State				mState[HttpRequest::POLICY_CLASS_LIMIT]; +	State				mState[POLICY_CLASS_LIMIT];  	HttpService *		mService;				// Naked pointer, not refcounted, not owner  	HttpPolicyGlobal	mGlobalOptions; diff --git a/indra/llcorehttp/_httppolicyglobal.cpp b/indra/llcorehttp/_httppolicyglobal.cpp index 6b1de38fd6..ca04839eaf 100644 --- a/indra/llcorehttp/_httppolicyglobal.cpp +++ b/indra/llcorehttp/_httppolicyglobal.cpp @@ -26,6 +26,8 @@  #include "_httppolicyglobal.h" +#include "_httpinternal.h" +  namespace LLCore  { @@ -33,8 +35,8 @@ namespace LLCore  HttpPolicyGlobal::HttpPolicyGlobal()  	: mSetMask(0UL), -	  mConnectionLimit(32L), -	  mTrace(0), +	  mConnectionLimit(DEFAULT_CONNECTIONS), +	  mTrace(TRACE_OFF),  	  mUseLLProxy(0)  {} @@ -64,11 +66,11 @@ HttpStatus HttpPolicyGlobal::set(HttpRequest::EGlobalPolicy opt, long value)  	switch (opt)  	{  	case HttpRequest::GP_CONNECTION_LIMIT: -		mConnectionLimit = value; +		mConnectionLimit = llclamp(value, long(LIMIT_CONNECTIONS_MIN), long(LIMIT_CONNECTIONS_MAX));  		break;  	case HttpRequest::GP_TRACE: -		mTrace = llclamp(value, 0L, 3L); +		mTrace = llclamp(value, long(TRACE_MIN), long(TRACE_MAX));  		break;  	case HttpRequest::GP_LLPROXY: diff --git a/indra/llcorehttp/_httpservice.cpp b/indra/llcorehttp/_httpservice.cpp index 87a78820f5..25f64acc42 100644 --- a/indra/llcorehttp/_httpservice.cpp +++ b/indra/llcorehttp/_httpservice.cpp @@ -34,15 +34,12 @@  #include "_httppolicy.h"  #include "_httplibcurl.h"  #include "_thread.h" +#include "_httpinternal.h"  #include "lltimer.h"  #include "llthread.h" -// Tuning parameters -static const int LOOP_SLEEP_NORMAL_MS = 2;		// Normal per-loop sleep in milliseconds - -  namespace LLCore  { @@ -230,11 +227,11 @@ HttpService::ELoopSpeed HttpService::processRequestQueue(ELoopSpeed loop)  		if (! mExitRequested)  		{  			// Setup for subsequent tracing -			long tracing(0); +			long tracing(TRACE_OFF);  			mPolicy->getGlobalOptions().get(HttpRequest::GP_TRACE, &tracing);  			op->mTracing = (std::max)(op->mTracing, int(tracing)); -			if (op->mTracing > 0) +			if (op->mTracing > TRACE_OFF)  			{  				LL_INFOS("CoreHttp") << "TRACE, FromRequestQueue, Handle:  "  									 << static_cast<HttpHandle>(op) diff --git a/indra/llcorehttp/_refcounted.cpp b/indra/llcorehttp/_refcounted.cpp index 11d75fdf97..e7d0b72741 100644 --- a/indra/llcorehttp/_refcounted.cpp +++ b/indra/llcorehttp/_refcounted.cpp @@ -30,11 +30,11 @@  namespace LLCoreInt  { -#if		! defined(WIN32) +#if		! LL_WINDOWS  const S32 RefCounted::NOT_REF_COUNTED; -#endif	// ! defined(WIN32) +#endif	// ! LL_WINDOWS  RefCounted::~RefCounted()  {} diff --git a/indra/llcorehttp/bufferarray.cpp b/indra/llcorehttp/bufferarray.cpp index ae92057df0..5eaa60c9ba 100644 --- a/indra/llcorehttp/bufferarray.cpp +++ b/indra/llcorehttp/bufferarray.cpp @@ -85,9 +85,9 @@ public:  // ================================== -#if	! defined(WIN32) +#if	! LL_WINDOWS  const size_t BufferArray::BLOCK_ALLOC_SIZE; -#endif	// ! defined(WIN32) +#endif	// ! LL_WINDOWS  BufferArray::BufferArray()  	: LLCoreInt::RefCounted(true), diff --git a/indra/llcorehttp/httpcommon.cpp b/indra/llcorehttp/httpcommon.cpp index 9f17b5c842..1b18976359 100644 --- a/indra/llcorehttp/httpcommon.cpp +++ b/indra/llcorehttp/httpcommon.cpp @@ -54,9 +54,9 @@ std::string HttpStatus::toHex() const  	result.fill('0');  	result << std::hex << operator unsigned long();  	return result.str(); -	  } +  std::string HttpStatus::toString() const  {  	static const char * llcore_errors[] = diff --git a/indra/llcorehttp/httpoptions.cpp b/indra/llcorehttp/httpoptions.cpp index c11d89e619..f2771c1f29 100644 --- a/indra/llcorehttp/httpoptions.cpp +++ b/indra/llcorehttp/httpoptions.cpp @@ -26,6 +26,8 @@  #include "httpoptions.h" +#include "_httpinternal.h" +  namespace LLCore  { @@ -34,9 +36,9 @@ namespace LLCore  HttpOptions::HttpOptions()  	: RefCounted(true),  	  mWantHeaders(false), -	  mTracing(0), -	  mTimeout(30), -	  mRetries(5) +	  mTracing(TRACE_OFF), +	  mTimeout(DEFAULT_TIMEOUT), +	  mRetries(DEFAULT_RETRY_COUNT)  {} diff --git a/indra/llcorehttp/httprequest.cpp b/indra/llcorehttp/httprequest.cpp index 2036ecfd1c..e906ff8a1e 100644 --- a/indra/llcorehttp/httprequest.cpp +++ b/indra/llcorehttp/httprequest.cpp @@ -108,6 +108,7 @@ HttpStatus HttpRequest::setPolicyGlobalOption(EGlobalPolicy opt, const std::stri  HttpRequest::policy_t HttpRequest::createPolicyClass()  { +	// *FIXME:  Implement classes  	policy_t policy_id = 1;  	return policy_id; diff --git a/indra/llcorehttp/httprequest.h b/indra/llcorehttp/httprequest.h index 4e78ed3719..24fff24b83 100644 --- a/indra/llcorehttp/httprequest.h +++ b/indra/llcorehttp/httprequest.h @@ -102,10 +102,6 @@ public:  	/// eventual service for any HTTP request.  	static const int DEFAULT_POLICY_ID = 0; -	/// Maximum number of policies that may be defined.  No policy -	/// ID will equal or exceed this value. -	static const int POLICY_CLASS_LIMIT = 1; -	  	enum EGlobalPolicy  	{  		/// Maximum number of connections the library will use to @@ -163,7 +159,7 @@ public:  	/// Create a new policy class into which requests can be made.  	///  	/// @return			If positive, the policy_id used to reference -	///					the class in other methods.  If -1, an error +	///					the class in other methods.  If 0, an error  	///					occurred and @see getStatus() may provide more  	///					detail on the reason.  	static policy_t createPolicyClass(); | 
