Merge branch 'master' of https://github.com/singularity-viewer/SingularityViewer
This commit is contained in:
@@ -262,6 +262,11 @@ U64 totalTime()
|
|||||||
// No wrapping, we're all okay.
|
// No wrapping, we're all okay.
|
||||||
gTotalTimeClockCount += current_clock_count - gLastTotalTimeClockCount;
|
gTotalTimeClockCount += current_clock_count - gLastTotalTimeClockCount;
|
||||||
}
|
}
|
||||||
|
else if((gLastTotalTimeClockCount - current_clock_count)<0xFFFF)
|
||||||
|
{
|
||||||
|
//clock is glitching and walking backwards - ignore it
|
||||||
|
gTotalTimeClockCount = gLastTotalTimeClockCount;
|
||||||
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
// We've wrapped. Compensate correctly
|
// We've wrapped. Compensate correctly
|
||||||
|
|||||||
@@ -415,6 +415,63 @@ BOOL LLImageJ2COJ::encodeImpl(LLImageJ2C &base, const LLImageRaw &raw_image, con
|
|||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
inline S32 extractLong4( U8 const *aBuffer, int nOffset )
|
||||||
|
{
|
||||||
|
S32 ret = aBuffer[ nOffset ] << 24;
|
||||||
|
ret += aBuffer[ nOffset + 1 ] << 16;
|
||||||
|
ret += aBuffer[ nOffset + 2 ] << 8;
|
||||||
|
ret += aBuffer[ nOffset + 3 ];
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
|
||||||
|
inline S32 extractShort2( U8 const *aBuffer, int nOffset )
|
||||||
|
{
|
||||||
|
S32 ret = aBuffer[ nOffset ] << 8;
|
||||||
|
ret += aBuffer[ nOffset + 1 ];
|
||||||
|
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
|
||||||
|
inline bool isSOC( U8 const *aBuffer )
|
||||||
|
{
|
||||||
|
return aBuffer[ 0 ] == 0xFF && aBuffer[ 1 ] == 0x4F;
|
||||||
|
}
|
||||||
|
|
||||||
|
inline bool isSIZ( U8 const *aBuffer )
|
||||||
|
{
|
||||||
|
return aBuffer[ 0 ] == 0xFF && aBuffer[ 1 ] == 0x51;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool getMetadataFast( LLImageJ2C &aImage, S32 &aW, S32 &aH, S32 &aComps )
|
||||||
|
{
|
||||||
|
const int J2K_HDR_LEN( 42 );
|
||||||
|
const int J2K_HDR_X1( 8 );
|
||||||
|
const int J2K_HDR_Y1( 12 );
|
||||||
|
const int J2K_HDR_X0( 16 );
|
||||||
|
const int J2K_HDR_Y0( 20 );
|
||||||
|
const int J2K_HDR_NUMCOMPS( 40 );
|
||||||
|
|
||||||
|
if( aImage.getDataSize() < J2K_HDR_LEN )
|
||||||
|
return false;
|
||||||
|
|
||||||
|
U8 const* pBuffer = aImage.getData();
|
||||||
|
|
||||||
|
if( !isSOC( pBuffer ) || !isSIZ( pBuffer+2 ) )
|
||||||
|
return false;
|
||||||
|
|
||||||
|
S32 x1 = extractLong4( pBuffer, J2K_HDR_X1 );
|
||||||
|
S32 y1 = extractLong4( pBuffer, J2K_HDR_Y1 );
|
||||||
|
S32 x0 = extractLong4( pBuffer, J2K_HDR_X0 );
|
||||||
|
S32 y0 = extractLong4( pBuffer, J2K_HDR_Y0 );
|
||||||
|
S32 numComps = extractShort2( pBuffer, J2K_HDR_NUMCOMPS );
|
||||||
|
|
||||||
|
aComps = numComps;
|
||||||
|
aW = x1 - x0;
|
||||||
|
aH = y1 - y0;
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
BOOL LLImageJ2COJ::getMetadata(LLImageJ2C &base)
|
BOOL LLImageJ2COJ::getMetadata(LLImageJ2C &base)
|
||||||
{
|
{
|
||||||
//
|
//
|
||||||
@@ -424,6 +481,18 @@ BOOL LLImageJ2COJ::getMetadata(LLImageJ2C &base)
|
|||||||
// Update the raw discard level
|
// Update the raw discard level
|
||||||
base.updateRawDiscardLevel();
|
base.updateRawDiscardLevel();
|
||||||
|
|
||||||
|
S32 width(0);
|
||||||
|
S32 height(0);
|
||||||
|
S32 img_components(0);
|
||||||
|
|
||||||
|
if ( getMetadataFast( base, width, height, img_components ) )
|
||||||
|
{
|
||||||
|
base.setSize(width, height, img_components);
|
||||||
|
return TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Do it the old and slow way, decode the image with openjpeg
|
||||||
|
|
||||||
opj_dparameters_t parameters; /* decompression parameters */
|
opj_dparameters_t parameters; /* decompression parameters */
|
||||||
opj_event_mgr_t event_mgr; /* event manager */
|
opj_event_mgr_t event_mgr; /* event manager */
|
||||||
opj_image_t *image = NULL;
|
opj_image_t *image = NULL;
|
||||||
@@ -482,12 +551,11 @@ BOOL LLImageJ2COJ::getMetadata(LLImageJ2C &base)
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Copy image data into our raw image format (instead of the separate channel format
|
// Copy image data into our raw image format (instead of the separate channel format
|
||||||
S32 width = 0;
|
|
||||||
S32 height = 0;
|
|
||||||
|
|
||||||
S32 img_components = image->numcomps;
|
img_components = image->numcomps;
|
||||||
width = image->x1 - image->x0;
|
width = image->x1 - image->x0;
|
||||||
height = image->y1 - image->y0;
|
height = image->y1 - image->y0;
|
||||||
|
|
||||||
base.setSize(width, height, img_components);
|
base.setSize(width, height, img_components);
|
||||||
|
|
||||||
/* free image data structure */
|
/* free image data structure */
|
||||||
|
|||||||
@@ -1222,19 +1222,6 @@ void CurlEasyRequest::removed_from_multi_handle(AICurlEasyRequest_wat& curl_easy
|
|||||||
mHandleEventsTarget->removed_from_multi_handle(curl_easy_request_w);
|
mHandleEventsTarget->removed_from_multi_handle(curl_easy_request_w);
|
||||||
}
|
}
|
||||||
|
|
||||||
void CurlEasyRequest::print_diagnostics(CURLcode code)
|
|
||||||
{
|
|
||||||
if (code == CURLE_OPERATION_TIMEDOUT)
|
|
||||||
{
|
|
||||||
// mTimeout SHOULD always be set, but I see no reason not to test it, as
|
|
||||||
// this is far from the code that guaranteeds that it is set.
|
|
||||||
if (mTimeout)
|
|
||||||
{
|
|
||||||
mTimeout->print_diagnostics(this);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
PerHostRequestQueuePtr CurlEasyRequest::getPerHostPtr(void)
|
PerHostRequestQueuePtr CurlEasyRequest::getPerHostPtr(void)
|
||||||
{
|
{
|
||||||
if (!mPerHostPtr)
|
if (!mPerHostPtr)
|
||||||
@@ -1314,6 +1301,25 @@ void BufferedCurlEasyRequest::resetState(void)
|
|||||||
mInput.reset();
|
mInput.reset();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void BufferedCurlEasyRequest::print_diagnostics(CURLcode code)
|
||||||
|
{
|
||||||
|
char* eff_url;
|
||||||
|
getinfo(CURLINFO_EFFECTIVE_URL, &eff_url);
|
||||||
|
if (code == CURLE_OPERATION_TIMEDOUT)
|
||||||
|
{
|
||||||
|
// mTimeout SHOULD always be set, but I see no reason not to test it, as
|
||||||
|
// this is far from the code that guaranteeds that it is set.
|
||||||
|
if (mTimeout)
|
||||||
|
{
|
||||||
|
mTimeout->print_diagnostics(this, eff_url);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
llwarns << "Curl returned error code " << code << " (" << curl_easy_strerror(code) << ") for HTTP request to \"" << eff_url << "\"." << llendl;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
ThreadSafeBufferedCurlEasyRequest* BufferedCurlEasyRequest::get_lockobj(void)
|
ThreadSafeBufferedCurlEasyRequest* BufferedCurlEasyRequest::get_lockobj(void)
|
||||||
{
|
{
|
||||||
return static_cast<ThreadSafeBufferedCurlEasyRequest*>(AIThreadSafeSimple<BufferedCurlEasyRequest>::wrapper_cast(this));
|
return static_cast<ThreadSafeBufferedCurlEasyRequest*>(AIThreadSafeSimple<BufferedCurlEasyRequest>::wrapper_cast(this));
|
||||||
|
|||||||
@@ -97,7 +97,7 @@ class HTTPTimeout : public LLRefCount {
|
|||||||
bool has_stalled(void) const { return mStalled < sClockCount; }
|
bool has_stalled(void) const { return mStalled < sClockCount; }
|
||||||
|
|
||||||
// Called from BufferedCurlEasyRequest::processOutput if a timeout occurred.
|
// Called from BufferedCurlEasyRequest::processOutput if a timeout occurred.
|
||||||
void print_diagnostics(CurlEasyRequest const* curl_easy_request);
|
void print_diagnostics(CurlEasyRequest const* curl_easy_request, char const* eff_url);
|
||||||
|
|
||||||
#if defined(CWDEBUG) || defined(DEBUG_CURLIO)
|
#if defined(CWDEBUG) || defined(DEBUG_CURLIO)
|
||||||
void* get_lockobj(void) const { return mLockObj; }
|
void* get_lockobj(void) const { return mLockObj; }
|
||||||
@@ -344,9 +344,6 @@ class CurlEasyRequest : public CurlEasyHandle {
|
|||||||
finished(curl_easy_request_w);
|
finished(curl_easy_request_w);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Called by in case of an error.
|
|
||||||
void print_diagnostics(CURLcode code);
|
|
||||||
|
|
||||||
// Called by MultiHandle::check_msg_queue() to fill info with the transfer info.
|
// Called by MultiHandle::check_msg_queue() to fill info with the transfer info.
|
||||||
void getTransferInfo(AITransferInfo* info);
|
void getTransferInfo(AITransferInfo* info);
|
||||||
|
|
||||||
@@ -356,7 +353,7 @@ class CurlEasyRequest : public CurlEasyHandle {
|
|||||||
// For debugging purposes.
|
// For debugging purposes.
|
||||||
void print_curl_timings(void) const;
|
void print_curl_timings(void) const;
|
||||||
|
|
||||||
private:
|
protected:
|
||||||
curl_slist* mHeaders;
|
curl_slist* mHeaders;
|
||||||
AICurlEasyHandleEvents* mHandleEventsTarget;
|
AICurlEasyHandleEvents* mHandleEventsTarget;
|
||||||
CURLcode mResult; //AIFIXME: this does not belong in the request object, but belongs in the response object.
|
CURLcode mResult; //AIFIXME: this does not belong in the request object, but belongs in the response object.
|
||||||
@@ -478,6 +475,9 @@ class BufferedCurlEasyRequest : public CurlEasyRequest {
|
|||||||
// Called from curlHeaderCallback.
|
// Called from curlHeaderCallback.
|
||||||
void setStatusAndReason(U32 status, std::string const& reason);
|
void setStatusAndReason(U32 status, std::string const& reason);
|
||||||
|
|
||||||
|
// Called from processOutput by in case of an error.
|
||||||
|
void print_diagnostics(CURLcode code);
|
||||||
|
|
||||||
public:
|
public:
|
||||||
// Return pointer to the ThreadSafe (wrapped) version of this object.
|
// Return pointer to the ThreadSafe (wrapped) version of this object.
|
||||||
ThreadSafeBufferedCurlEasyRequest* get_lockobj(void);
|
ThreadSafeBufferedCurlEasyRequest* get_lockobj(void);
|
||||||
|
|||||||
@@ -1971,9 +1971,102 @@ void HTTPTimeout::done(AICurlEasyRequest_wat const& curlEasyRequest_w, CURLcode
|
|||||||
DoutCurl("done: mStalled set to -1");
|
DoutCurl("done: mStalled set to -1");
|
||||||
}
|
}
|
||||||
|
|
||||||
void HTTPTimeout::print_diagnostics(CurlEasyRequest const* curl_easy_request)
|
void HTTPTimeout::print_diagnostics(CurlEasyRequest const* curl_easy_request, char const* eff_url)
|
||||||
{
|
{
|
||||||
llwarns << "Request to " << curl_easy_request->getLowercaseHostname() << " timed out for " << curl_easy_request->getTimeoutPolicy()->name() << llendl;
|
llwarns << "Request to \"" << curl_easy_request->getLowercaseHostname() << "\" timed out for " << curl_easy_request->getTimeoutPolicy()->name() << llendl;
|
||||||
|
llinfos << "Effective URL: \"" << eff_url << "\"." << llendl;
|
||||||
|
double namelookup_time, connect_time, appconnect_time, pretransfer_time, starttransfer_time;
|
||||||
|
curl_easy_request->getinfo(CURLINFO_NAMELOOKUP_TIME, &namelookup_time);
|
||||||
|
curl_easy_request->getinfo(CURLINFO_CONNECT_TIME, &connect_time);
|
||||||
|
curl_easy_request->getinfo(CURLINFO_APPCONNECT_TIME, &appconnect_time);
|
||||||
|
curl_easy_request->getinfo(CURLINFO_PRETRANSFER_TIME, &pretransfer_time);
|
||||||
|
curl_easy_request->getinfo(CURLINFO_STARTTRANSFER_TIME, &starttransfer_time);
|
||||||
|
if (namelookup_time == 0)
|
||||||
|
{
|
||||||
|
llwarns << "Huh? Curl returned CURLE_OPERATION_TIMEDOUT, but DNS lookup did not occur according to timings. Expected CURLE_COULDNT_RESOLVE_PROXY or CURLE_COULDNT_RESOLVE_HOST!" << llendl;
|
||||||
|
llassert(connect_time == 0);
|
||||||
|
llassert(appconnect_time == 0);
|
||||||
|
llassert(pretransfer_time == 0);
|
||||||
|
llassert(starttransfer_time == 0);
|
||||||
|
// Fatal error for diagnostics.
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
// If namelookup_time is less than 500 microseconds, then it's very likely just a DNS cache lookup.
|
||||||
|
else if (namelookup_time < 500e-6)
|
||||||
|
{
|
||||||
|
llinfos << "Hostname was still in DNS cache." << llendl;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
llwarns << "DNS lookup of " << curl_easy_request->getLowercaseHostname() << " took " << namelookup_time << " seconds." << llendl;
|
||||||
|
}
|
||||||
|
if (connect_time == 0)
|
||||||
|
{
|
||||||
|
llwarns << "Huh? Curl returned CURLE_OPERATION_TIMEDOUT, but connection did not occur according to timings. Expected CURLE_COULDNT_CONNECT!" << llendl;
|
||||||
|
llassert(appconnect_time == 0);
|
||||||
|
llassert(pretransfer_time == 0);
|
||||||
|
llassert(starttransfer_time == 0);
|
||||||
|
// Fatal error for diagnostics.
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
// If connect_time is almost equal to namelookup_time, then it was just set because it was already connected.
|
||||||
|
if (connect_time - namelookup_time <= 1e-6)
|
||||||
|
{
|
||||||
|
llinfos << "The socket was already connected (to remote or proxy)." << llendl;
|
||||||
|
if (appconnect_time == 0)
|
||||||
|
{
|
||||||
|
llwarns << "The SSL/TLS handshake never occurred according to the timings!" << llendl;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
// If appconnect_time is almost equal to connect_time, then it was just set because this is a connection re-use.
|
||||||
|
if (appconnect_time - connect_time <= 1e-6)
|
||||||
|
{
|
||||||
|
llinfos << "Connection with HTTP server was already established; this was a re-used connection." << llendl;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
llinfos << "SSL/TLS handshake with HTTP server took " << (appconnect_time - connect_time) << " seconds." << llendl;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
llinfos << "Socket connected to remote host (or proxy) in " << (connect_time - namelookup_time) << " seconds." << llendl;
|
||||||
|
if (appconnect_time == 0)
|
||||||
|
{
|
||||||
|
llwarns << "The SSL/TLS handshake never occurred according to the timings!" << llendl;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
llinfos << "SSL/TLS handshake with HTTP server took " << (appconnect_time - connect_time) << " seconds." << llendl;
|
||||||
|
}
|
||||||
|
if (pretransfer_time == 0)
|
||||||
|
{
|
||||||
|
llwarns << "The transfer never happened because there was too much in the pipeline (apparently)." << llendl;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
else if (pretransfer_time - appconnect_time >= 1e-6)
|
||||||
|
{
|
||||||
|
llinfos << "Apparently there was a delay, due to waits in line for the pipeline, of " << (pretransfer_time - appconnect_time) << " seconds before the transfer began." << llendl;
|
||||||
|
}
|
||||||
|
if (starttransfer_time == 0)
|
||||||
|
{
|
||||||
|
llwarns << "No data was ever received from the server according to the timings." << llendl;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
llinfos << "The time it took to send the request to the server plus the time it took before the server started to reply was " << (starttransfer_time - pretransfer_time) << " seconds." << llendl;
|
||||||
|
}
|
||||||
|
if (mNothingReceivedYet)
|
||||||
|
{
|
||||||
|
llinfos << "No data at all was actually received from the server." << llendl;
|
||||||
|
}
|
||||||
|
if (mUploadFinished)
|
||||||
|
{
|
||||||
|
llinfos << "The request upload finished successfully." << llendl;
|
||||||
|
}
|
||||||
|
if (mLastSecond > 0 && mLowSpeedOn)
|
||||||
|
{
|
||||||
|
llinfos << "The " << (mNothingReceivedYet ? "upload" : "download") << " did last " << mLastSecond << " second" << ((mLastSecond == 1) ? "" : "s") << ", before it timed out." << llendl;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
} // namespace curlthread
|
} // namespace curlthread
|
||||||
|
|||||||
@@ -110,7 +110,7 @@ struct AIHTTPReceivedHeadersCharCompare {
|
|||||||
struct AIHTTPReceivedHeadersCompare {
|
struct AIHTTPReceivedHeadersCompare {
|
||||||
bool operator()(std::string const& h1, std::string const& h2) const
|
bool operator()(std::string const& h1, std::string const& h2) const
|
||||||
{
|
{
|
||||||
static AIHTTPReceivedHeadersCharCompare const predicate;
|
static AIHTTPReceivedHeadersCharCompare predicate;
|
||||||
return std::lexicographical_compare(h1.begin(), h1.end(), h2.begin(), h2.end(), predicate);
|
return std::lexicographical_compare(h1.begin(), h1.end(), h2.begin(), h2.end(), predicate);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -144,7 +144,7 @@ class AIHTTPTimeoutPolicyBase : public AIHTTPTimeoutPolicy {
|
|||||||
AIHTTPTimeoutPolicy(NULL, dns_lookup_grace, subsequent_connects, reply_delay, low_speed_time, low_speed_limit, curl_transaction, total_delay) { }
|
AIHTTPTimeoutPolicy(NULL, dns_lookup_grace, subsequent_connects, reply_delay, low_speed_time, low_speed_limit, curl_transaction, total_delay) { }
|
||||||
|
|
||||||
// Derive base from base.
|
// Derive base from base.
|
||||||
AIHTTPTimeoutPolicyBase(AIHTTPTimeoutPolicyBase& rhs, PolicyOp const& op = PolicyOp()) : AIHTTPTimeoutPolicy(rhs) { op.perform(this); }
|
AIHTTPTimeoutPolicyBase(AIHTTPTimeoutPolicyBase& rhs, PolicyOp const& op) : AIHTTPTimeoutPolicy(rhs) { op.perform(this); }
|
||||||
|
|
||||||
// Called for every derived policy.
|
// Called for every derived policy.
|
||||||
void derived(AIHTTPTimeoutPolicy* derived) { mDerived.push_back(derived); }
|
void derived(AIHTTPTimeoutPolicy* derived) { mDerived.push_back(derived); }
|
||||||
@@ -631,24 +631,32 @@ AIHTTPTimeoutPolicyBase AIHTTPTimeoutPolicy::sDebugSettingsCurlTimeout(
|
|||||||
AITP_default_maximum_curl_transaction,
|
AITP_default_maximum_curl_transaction,
|
||||||
AITP_default_maximum_total_delay);
|
AITP_default_maximum_total_delay);
|
||||||
|
|
||||||
|
// Note: Broken compiler doesn't allow as to use temporaries for the Operator ojects,
|
||||||
|
// so they are instantiated separately.
|
||||||
|
|
||||||
// This used to be '5 seconds'.
|
// This used to be '5 seconds'.
|
||||||
|
Transaction transactionOp5s(5);
|
||||||
AIHTTPTimeoutPolicyBase transfer_5s(AIHTTPTimeoutPolicyBase::getDebugSettingsCurlTimeout(),
|
AIHTTPTimeoutPolicyBase transfer_5s(AIHTTPTimeoutPolicyBase::getDebugSettingsCurlTimeout(),
|
||||||
Transaction(5)
|
transactionOp5s
|
||||||
);
|
);
|
||||||
|
|
||||||
// This used to be '18 seconds'.
|
// This used to be '18 seconds'.
|
||||||
|
Transaction transactionOp18s(18);
|
||||||
AIHTTPTimeoutPolicyBase transfer_18s(AIHTTPTimeoutPolicyBase::getDebugSettingsCurlTimeout(),
|
AIHTTPTimeoutPolicyBase transfer_18s(AIHTTPTimeoutPolicyBase::getDebugSettingsCurlTimeout(),
|
||||||
Transaction(18)
|
transactionOp18s
|
||||||
);
|
);
|
||||||
|
|
||||||
// This used to be '300 seconds'. We derive this from the hardcoded result so users can't mess with it.
|
// This used to be '300 seconds'. We derive this from the hardcoded result so users can't mess with it.
|
||||||
|
Transaction transactionOp300s(300);
|
||||||
AIHTTPTimeoutPolicyBase transfer_300s(HTTPTimeoutPolicy_default,
|
AIHTTPTimeoutPolicyBase transfer_300s(HTTPTimeoutPolicy_default,
|
||||||
Transaction(300)
|
transactionOp300s
|
||||||
);
|
);
|
||||||
|
|
||||||
// This used to be a call to setopt(CURLOPT_CONNECTTIMEOUT, 40L) with the remark 'Be a little impatient about establishing connections.'
|
// This used to be a call to setopt(CURLOPT_CONNECTTIMEOUT, 40L) with the remark 'Be a little impatient about establishing connections.'
|
||||||
|
Connect connectOp40s(40);
|
||||||
AIHTTPTimeoutPolicyBase connect_40s(AIHTTPTimeoutPolicyBase::getDebugSettingsCurlTimeout(),
|
AIHTTPTimeoutPolicyBase connect_40s(AIHTTPTimeoutPolicyBase::getDebugSettingsCurlTimeout(),
|
||||||
Connect(40));
|
connectOp40s
|
||||||
|
);
|
||||||
|
|
||||||
// End of policy definitions.
|
// End of policy definitions.
|
||||||
//=======================================================================================================
|
//=======================================================================================================
|
||||||
|
|||||||
@@ -136,7 +136,7 @@ class FileInjector : public Injector
|
|||||||
|
|
||||||
/*virtual*/ U32 get_body(LLChannelDescriptors const& channels, buffer_ptr_t& buffer)
|
/*virtual*/ U32 get_body(LLChannelDescriptors const& channels, buffer_ptr_t& buffer)
|
||||||
{
|
{
|
||||||
llifstream fstream(mFilename, std::iostream::binary | std::iostream::out);
|
llifstream fstream(mFilename, std::ios::binary);
|
||||||
if (!fstream.is_open())
|
if (!fstream.is_open())
|
||||||
throw AICurlNoBody(llformat("Failed to open \"%s\".", mFilename.c_str()));
|
throw AICurlNoBody(llformat("Failed to open \"%s\".", mFilename.c_str()));
|
||||||
LLBufferStream ostream(channels, buffer.get());
|
LLBufferStream ostream(channels, buffer.get());
|
||||||
@@ -149,7 +149,8 @@ class FileInjector : public Injector
|
|||||||
#endif
|
#endif
|
||||||
while (fstream)
|
while (fstream)
|
||||||
{
|
{
|
||||||
std::streamsize len = fstream.readsome(tmpbuf, sizeof(tmpbuf));
|
fstream.read(tmpbuf, sizeof(tmpbuf));
|
||||||
|
std::streamsize len = fstream.gcount();
|
||||||
if (len > 0)
|
if (len > 0)
|
||||||
{
|
{
|
||||||
ostream.write(tmpbuf, len);
|
ostream.write(tmpbuf, len);
|
||||||
@@ -158,6 +159,8 @@ class FileInjector : public Injector
|
|||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if (fstream.bad())
|
||||||
|
throw AICurlNoBody(llformat("An error occured while reading \"%s\".", mFilename.c_str()));
|
||||||
fstream.close();
|
fstream.close();
|
||||||
ostream << std::flush;
|
ostream << std::flush;
|
||||||
llassert(total_len == file_size && total_len == ostream.count_out());
|
llassert(total_len == file_size && total_len == ostream.count_out());
|
||||||
@@ -231,7 +234,7 @@ void LLHTTPClient::getByteRange(std::string const& url, S32 offset, S32 bytes, R
|
|||||||
request(url, LLURLRequest::HTTP_GET, NULL, responder, headers);
|
request(url, LLURLRequest::HTTP_GET, NULL, responder, headers);
|
||||||
}
|
}
|
||||||
|
|
||||||
void LLHTTPClient::head(std::string const& url, ResponderPtr responder, AIHTTPHeaders& headers)
|
void LLHTTPClient::head(std::string const& url, ResponderHeadersOnly* responder, AIHTTPHeaders& headers)
|
||||||
{
|
{
|
||||||
request(url, LLURLRequest::HTTP_HEAD, NULL, responder, headers);
|
request(url, LLURLRequest::HTTP_HEAD, NULL, responder, headers);
|
||||||
}
|
}
|
||||||
@@ -241,7 +244,7 @@ void LLHTTPClient::get(std::string const& url, ResponderPtr responder, AIHTTPHea
|
|||||||
request(url, LLURLRequest::HTTP_GET, NULL, responder, headers);
|
request(url, LLURLRequest::HTTP_GET, NULL, responder, headers);
|
||||||
}
|
}
|
||||||
|
|
||||||
void LLHTTPClient::getHeaderOnly(std::string const& url, ResponderPtr responder, AIHTTPHeaders& headers)
|
void LLHTTPClient::getHeaderOnly(std::string const& url, ResponderHeadersOnly* responder, AIHTTPHeaders& headers)
|
||||||
{
|
{
|
||||||
request(url, LLURLRequest::HTTP_HEAD, NULL, responder, headers);
|
request(url, LLURLRequest::HTTP_HEAD, NULL, responder, headers);
|
||||||
}
|
}
|
||||||
@@ -290,6 +293,13 @@ AIHTTPTimeoutPolicy const& LLHTTPClient::ResponderBase::getHTTPTimeoutPolicy(voi
|
|||||||
void LLHTTPClient::ResponderBase::decode_llsd_body(U32 status, std::string const& reason, LLChannelDescriptors const& channels, buffer_ptr_t const& buffer, LLSD& content)
|
void LLHTTPClient::ResponderBase::decode_llsd_body(U32 status, std::string const& reason, LLChannelDescriptors const& channels, buffer_ptr_t const& buffer, LLSD& content)
|
||||||
{
|
{
|
||||||
AICurlInterface::Stats::llsd_body_count++;
|
AICurlInterface::Stats::llsd_body_count++;
|
||||||
|
if (status == HTTP_INTERNAL_ERROR)
|
||||||
|
{
|
||||||
|
// In case of an internal error (ie, a curl error), a description of the (curl) error is the best we can do.
|
||||||
|
// In any case, the body if anything was received at all, can not be relied upon.
|
||||||
|
content = reason;
|
||||||
|
return;
|
||||||
|
}
|
||||||
// If the status indicates success (and we get here) then we expect the body to be LLSD.
|
// If the status indicates success (and we get here) then we expect the body to be LLSD.
|
||||||
bool const should_be_llsd = (200 <= status && status < 300);
|
bool const should_be_llsd = (200 <= status && status < 300);
|
||||||
if (should_be_llsd)
|
if (should_be_llsd)
|
||||||
@@ -334,6 +344,13 @@ void LLHTTPClient::ResponderBase::decode_llsd_body(U32 status, std::string const
|
|||||||
void LLHTTPClient::ResponderBase::decode_raw_body(U32 status, std::string const& reason, LLChannelDescriptors const& channels, buffer_ptr_t const& buffer, std::string& content)
|
void LLHTTPClient::ResponderBase::decode_raw_body(U32 status, std::string const& reason, LLChannelDescriptors const& channels, buffer_ptr_t const& buffer, std::string& content)
|
||||||
{
|
{
|
||||||
AICurlInterface::Stats::raw_body_count++;
|
AICurlInterface::Stats::raw_body_count++;
|
||||||
|
if (status == HTTP_INTERNAL_ERROR)
|
||||||
|
{
|
||||||
|
// In case of an internal error (ie, a curl error), a description of the (curl) error is the best we can do.
|
||||||
|
// In any case, the body if anything was received at all, can not be relied upon.
|
||||||
|
content = reason;
|
||||||
|
return;
|
||||||
|
}
|
||||||
LLMutexLock lock(buffer->getMutex());
|
LLMutexLock lock(buffer->getMutex());
|
||||||
LLBufferArray::const_segment_iterator_t const end = buffer->endSegment();
|
LLBufferArray::const_segment_iterator_t const end = buffer->endSegment();
|
||||||
for (LLBufferArray::const_segment_iterator_t iter = buffer->beginSegment(); iter != end; ++iter)
|
for (LLBufferArray::const_segment_iterator_t iter = buffer->beginSegment(); iter != end; ++iter)
|
||||||
|
|||||||
@@ -183,6 +183,39 @@ public:
|
|||||||
// This function must delete the ResponderBase object when the reference count reaches zero.
|
// This function must delete the ResponderBase object when the reference count reaches zero.
|
||||||
};
|
};
|
||||||
|
|
||||||
|
// Responders derived from this base class should use HTTPClient::head or HTTPClient::getHeaderOnly.
|
||||||
|
// That will set the curl option CURLOPT_NOBODY so that only headers are received.
|
||||||
|
class ResponderHeadersOnly : public ResponderBase {
|
||||||
|
private:
|
||||||
|
/*virtual*/ bool needsHeaders(void) const { return true; }
|
||||||
|
|
||||||
|
protected:
|
||||||
|
// ResponderBase event
|
||||||
|
|
||||||
|
// The responder finished. Do not override this function in derived classes; override completedRaw instead.
|
||||||
|
/*virtual*/ void finished(CURLcode code, U32 http_status, std::string const& reason, LLChannelDescriptors const& channels, buffer_ptr_t const& buffer)
|
||||||
|
{
|
||||||
|
mCode = code;
|
||||||
|
// Allow classes derived from ResponderHeadersOnly to override completedHeaders.
|
||||||
|
completedHeaders(http_status, reason, mReceivedHeaders);
|
||||||
|
mFinished = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
protected:
|
||||||
|
#ifdef SHOW_ASSERT
|
||||||
|
// Responders derived from this class must override completedHeaders.
|
||||||
|
// They may not attempt to override any of the virual functions defined by ResponderBase.
|
||||||
|
// Define those functions here with different parameters in order to cause a compile
|
||||||
|
// warning when a class accidently tries to override them.
|
||||||
|
enum YOU_MAY_ONLY_OVERRIDE_COMPLETED_HEADERS { };
|
||||||
|
virtual void completedRaw(YOU_MAY_ONLY_OVERRIDE_COMPLETED_HEADERS) { }
|
||||||
|
virtual void completed(YOU_MAY_ONLY_OVERRIDE_COMPLETED_HEADERS) { }
|
||||||
|
virtual void result(YOU_MAY_ONLY_OVERRIDE_COMPLETED_HEADERS) { }
|
||||||
|
virtual void errorWithContent(YOU_MAY_ONLY_OVERRIDE_COMPLETED_HEADERS) { }
|
||||||
|
virtual void error(YOU_MAY_ONLY_OVERRIDE_COMPLETED_HEADERS) { }
|
||||||
|
#endif
|
||||||
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @class ResponderWithCompleted
|
* @class ResponderWithCompleted
|
||||||
* @brief Base class for Responders that implement completed, or completedRaw if the response is not LLSD.
|
* @brief Base class for Responders that implement completed, or completedRaw if the response is not LLSD.
|
||||||
@@ -195,8 +228,8 @@ public:
|
|||||||
/*virtual*/ void finished(CURLcode code, U32 http_status, std::string const& reason, LLChannelDescriptors const& channels, buffer_ptr_t const& buffer)
|
/*virtual*/ void finished(CURLcode code, U32 http_status, std::string const& reason, LLChannelDescriptors const& channels, buffer_ptr_t const& buffer)
|
||||||
{
|
{
|
||||||
mCode = code;
|
mCode = code;
|
||||||
// Allow classes derived from ResponderBase to override completedRaw
|
// Allow classes derived from ResponderWithCompleted to override completedRaw
|
||||||
// (if not they should override completed or be derived from Responder instead).
|
// (if not they should override completed or be derived from ResponderWithResult instead).
|
||||||
completedRaw(http_status, reason, channels, buffer);
|
completedRaw(http_status, reason, channels, buffer);
|
||||||
mFinished = true;
|
mFinished = true;
|
||||||
}
|
}
|
||||||
@@ -324,8 +357,8 @@ public:
|
|||||||
|
|
||||||
/** @name non-blocking API */
|
/** @name non-blocking API */
|
||||||
//@{
|
//@{
|
||||||
static void head(std::string const& url, ResponderPtr responder, AIHTTPHeaders& headers);
|
static void head(std::string const& url, ResponderHeadersOnly* responder, AIHTTPHeaders& headers);
|
||||||
static void head(std::string const& url, ResponderPtr responder)
|
static void head(std::string const& url, ResponderHeadersOnly* responder)
|
||||||
{ AIHTTPHeaders headers; head(url, responder, headers); }
|
{ AIHTTPHeaders headers; head(url, responder, headers); }
|
||||||
|
|
||||||
static void getByteRange(std::string const& url, S32 offset, S32 bytes, ResponderPtr responder, AIHTTPHeaders& headers);
|
static void getByteRange(std::string const& url, S32 offset, S32 bytes, ResponderPtr responder, AIHTTPHeaders& headers);
|
||||||
@@ -344,8 +377,8 @@ public:
|
|||||||
static void put(std::string const& url, LLSD const& body, ResponderPtr responder)
|
static void put(std::string const& url, LLSD const& body, ResponderPtr responder)
|
||||||
{ AIHTTPHeaders headers; put(url, body, responder, headers); }
|
{ AIHTTPHeaders headers; put(url, body, responder, headers); }
|
||||||
|
|
||||||
static void getHeaderOnly(std::string const& url, ResponderPtr responder, AIHTTPHeaders& headers);
|
static void getHeaderOnly(std::string const& url, ResponderHeadersOnly* responder, AIHTTPHeaders& headers);
|
||||||
static void getHeaderOnly(std::string const& url, ResponderPtr responder)
|
static void getHeaderOnly(std::string const& url, ResponderHeadersOnly* responder)
|
||||||
{ AIHTTPHeaders headers; getHeaderOnly(url, responder, headers); }
|
{ AIHTTPHeaders headers; getHeaderOnly(url, responder, headers); }
|
||||||
|
|
||||||
static void post(std::string const& url, LLSD const& body, ResponderPtr responder, AIHTTPHeaders& headers);
|
static void post(std::string const& url, LLSD const& body, ResponderPtr responder, AIHTTPHeaders& headers);
|
||||||
|
|||||||
@@ -212,7 +212,6 @@ bool LLURLRequest::configure(AICurlEasyRequest_wat const& curlEasyRequest_w)
|
|||||||
switch(mAction)
|
switch(mAction)
|
||||||
{
|
{
|
||||||
case HTTP_HEAD:
|
case HTTP_HEAD:
|
||||||
curlEasyRequest_w->setopt(CURLOPT_HEADER, 1);
|
|
||||||
curlEasyRequest_w->setopt(CURLOPT_NOBODY, 1);
|
curlEasyRequest_w->setopt(CURLOPT_NOBODY, 1);
|
||||||
curlEasyRequest_w->setopt(CURLOPT_FOLLOWLOCATION, 1);
|
curlEasyRequest_w->setopt(CURLOPT_FOLLOWLOCATION, 1);
|
||||||
rv = true;
|
rv = true;
|
||||||
|
|||||||
@@ -124,14 +124,9 @@ BOOL PreventSetUnhandledExceptionFilter()
|
|||||||
|
|
||||||
newJump[ 0 ] = 0xE9; // JMP absolute
|
newJump[ 0 ] = 0xE9; // JMP absolute
|
||||||
memcpy( &newJump[ 1 ], &dwRelativeAddr, sizeof( pNewFunc ) );
|
memcpy( &newJump[ 1 ], &dwRelativeAddr, sizeof( pNewFunc ) );
|
||||||
//SIZE_T bytesWritten;
|
SIZE_T bytesWritten;
|
||||||
//BOOL bRet = WriteProcessMemory( GetCurrentProcess(), pOrgEntry, newJump, sizeof( pNewFunc ) + 1, &bytesWritten );
|
BOOL bRet = WriteProcessMemory( GetCurrentProcess(), pOrgEntry, newJump, sizeof( pNewFunc ) + 1, &bytesWritten );
|
||||||
DWORD oldProtect;
|
return bRet;
|
||||||
BOOL bRet = VirtualProtect(pOrgEntry, sizeof(pNewFunc) + 1, PAGE_READWRITE, &oldProtect);
|
|
||||||
if (!bRet) return FALSE;
|
|
||||||
memcpy(pOrgEntry, newJump, sizeof(pNewFunc) + 1);
|
|
||||||
VirtualProtect(pOrgEntry, sizeof(pNewFunc) + 1, oldProtect, &oldProtect);
|
|
||||||
return TRUE;
|
|
||||||
#else
|
#else
|
||||||
return FALSE;
|
return FALSE;
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -9,6 +9,17 @@
|
|||||||
<string>settings_rlv.xml</string>
|
<string>settings_rlv.xml</string>
|
||||||
</array>
|
</array>
|
||||||
|
|
||||||
|
<key>SGIgnoreSimulatorCameraConstraints</key>
|
||||||
|
<map>
|
||||||
|
<key>Comment</key>
|
||||||
|
<string>Don't let the simulator push your camera around</string>
|
||||||
|
<key>Persist</key>
|
||||||
|
<integer>1</integer>
|
||||||
|
<key>Type</key>
|
||||||
|
<string>Boolean</string>
|
||||||
|
<key>Value</key>
|
||||||
|
<integer>0</integer>
|
||||||
|
</map>
|
||||||
<key>SGAllowRiggedMeshSelection</key>
|
<key>SGAllowRiggedMeshSelection</key>
|
||||||
<map>
|
<map>
|
||||||
<key>Comment</key>
|
<key>Comment</key>
|
||||||
|
|||||||
@@ -1844,7 +1844,10 @@ LLVector3d LLAgentCamera::calcCameraPositionTargetGlobal(BOOL *hit_limit)
|
|||||||
local_camera_offset = gAgent.getFrameAgent().rotateToAbsolute( local_camera_offset );
|
local_camera_offset = gAgent.getFrameAgent().rotateToAbsolute( local_camera_offset );
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!mCameraCollidePlane.isExactlyZero() && (!isAgentAvatarValid() || !gAgentAvatarp->isSitting()))
|
if ( !mCameraCollidePlane.isExactlyZero()
|
||||||
|
&& !gSavedSettings.getBOOL("SGIgnoreSimulatorCameraConstraints")
|
||||||
|
&& isAgentAvatarValid()
|
||||||
|
&& !gAgentAvatarp->isSitting())
|
||||||
{
|
{
|
||||||
LLVector3 plane_normal;
|
LLVector3 plane_normal;
|
||||||
plane_normal.setVec(mCameraCollidePlane.mV);
|
plane_normal.setVec(mCameraCollidePlane.mV);
|
||||||
|
|||||||
@@ -645,8 +645,8 @@ bool LLAppViewer::init()
|
|||||||
|
|
||||||
AIStateMachine::setMaxCount(gSavedSettings.getU32("StateMachineMaxTime"));
|
AIStateMachine::setMaxCount(gSavedSettings.getU32("StateMachineMaxTime"));
|
||||||
|
|
||||||
AIHTTPTimeoutPolicy::setDefaultCurlTimeout(
|
{
|
||||||
AIHTTPTimeoutPolicy(
|
AIHTTPTimeoutPolicy policy_tmp(
|
||||||
"CurlTimeout* Debug Settings",
|
"CurlTimeout* Debug Settings",
|
||||||
gSavedSettings.getU32("CurlTimeoutDNSLookup"),
|
gSavedSettings.getU32("CurlTimeoutDNSLookup"),
|
||||||
gSavedSettings.getU32("CurlTimeoutConnect"),
|
gSavedSettings.getU32("CurlTimeoutConnect"),
|
||||||
@@ -655,7 +655,9 @@ bool LLAppViewer::init()
|
|||||||
gSavedSettings.getU32("CurlTimeoutLowSpeedLimit"),
|
gSavedSettings.getU32("CurlTimeoutLowSpeedLimit"),
|
||||||
gSavedSettings.getU32("CurlTimeoutMaxTransaction"),
|
gSavedSettings.getU32("CurlTimeoutMaxTransaction"),
|
||||||
gSavedSettings.getU32("CurlTimeoutMaxTotalDelay")
|
gSavedSettings.getU32("CurlTimeoutMaxTotalDelay")
|
||||||
));
|
);
|
||||||
|
AIHTTPTimeoutPolicy::setDefaultCurlTimeout(policy_tmp);
|
||||||
|
}
|
||||||
|
|
||||||
initThreads();
|
initThreads();
|
||||||
LL_INFOS("InitInfo") << "Threads initialized." << LL_ENDL ;
|
LL_INFOS("InitInfo") << "Threads initialized." << LL_ENDL ;
|
||||||
|
|||||||
@@ -53,7 +53,7 @@ static LLFloaterURLEntry* sInstance = NULL;
|
|||||||
// Move this to its own file.
|
// Move this to its own file.
|
||||||
// helper class that tries to download a URL from a web site and calls a method
|
// helper class that tries to download a URL from a web site and calls a method
|
||||||
// on the Panel Land Media and to discover the MIME type
|
// on the Panel Land Media and to discover the MIME type
|
||||||
class LLMediaTypeResponder : public LLHTTPClient::ResponderIgnoreBody
|
class LLMediaTypeResponder : public LLHTTPClient::ResponderHeadersOnly
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
LLMediaTypeResponder( const LLHandle<LLFloater> parent ) :
|
LLMediaTypeResponder( const LLHandle<LLFloater> parent ) :
|
||||||
@@ -62,20 +62,20 @@ public:
|
|||||||
|
|
||||||
LLHandle<LLFloater> mParent;
|
LLHandle<LLFloater> mParent;
|
||||||
|
|
||||||
virtual bool needsHeaders(void) const { return true; }
|
|
||||||
|
|
||||||
virtual void completedHeaders(U32 status, std::string const& reason, AIHTTPReceivedHeaders const& headers)
|
virtual void completedHeaders(U32 status, std::string const& reason, AIHTTPReceivedHeaders const& headers)
|
||||||
{
|
{
|
||||||
std::string media_type;
|
if (200 <= status && status < 300)
|
||||||
bool content_type_found = headers.getFirstValue("content-type", media_type);
|
{
|
||||||
llassert_always(content_type_found);
|
std::string media_type;
|
||||||
std::string::size_type idx1 = media_type.find_first_of(";");
|
if (headers.getFirstValue("content-type", media_type))
|
||||||
std::string mime_type = media_type.substr(0, idx1);
|
{
|
||||||
completeAny(status, mime_type);
|
std::string::size_type idx1 = media_type.find_first_of(";");
|
||||||
}
|
std::string mime_type = media_type.substr(0, idx1);
|
||||||
|
completeAny(status, mime_type);
|
||||||
virtual void error( U32 status, const std::string& reason )
|
return;
|
||||||
{
|
}
|
||||||
|
llwarns << "LLMediaTypeResponder::completedHeaders: OK HTTP status (" << status << ") but no Content-Type! Received headers: " << headers << llendl;
|
||||||
|
}
|
||||||
completeAny(status, "none/none");
|
completeAny(status, "none/none");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -168,7 +168,7 @@ std::string gFullName;
|
|||||||
|
|
||||||
// helper class that trys to download a URL from a web site and calls a method
|
// helper class that trys to download a URL from a web site and calls a method
|
||||||
// on parent class indicating if the web server is working or not
|
// on parent class indicating if the web server is working or not
|
||||||
class LLIamHereLogin : public LLHTTPClient::ResponderWithCompleted
|
class LLIamHereLogin : public LLHTTPClient::ResponderHeadersOnly
|
||||||
{
|
{
|
||||||
private:
|
private:
|
||||||
LLIamHereLogin( LLPanelLogin* parent ) :
|
LLIamHereLogin( LLPanelLogin* parent ) :
|
||||||
@@ -188,10 +188,7 @@ class LLIamHereLogin : public LLHTTPClient::ResponderWithCompleted
|
|||||||
mParent = parentIn;
|
mParent = parentIn;
|
||||||
};
|
};
|
||||||
|
|
||||||
// We don't actually expect LLSD back, so need to override completedRaw
|
/*virtual*/ void completedHeaders(U32 status, std::string const& reason, AIHTTPReceivedHeaders const& headers)
|
||||||
virtual void completedRaw(U32 status, const std::string& reason,
|
|
||||||
const LLChannelDescriptors& channels,
|
|
||||||
const LLIOPipe::buffer_ptr_t& buffer)
|
|
||||||
{
|
{
|
||||||
if (mParent)
|
if (mParent)
|
||||||
{
|
{
|
||||||
@@ -887,7 +884,7 @@ void LLPanelLogin::refreshLoginPage()
|
|||||||
|
|
||||||
std::string login_page = gHippoGridManager->getConnectedGrid()->getLoginPage();
|
std::string login_page = gHippoGridManager->getConnectedGrid()->getLoginPage();
|
||||||
if (!login_page.empty()) {
|
if (!login_page.empty()) {
|
||||||
LLHTTPClient::head(login_page, gResponsePtr);
|
LLHTTPClient::head(login_page, gResponsePtr.get());
|
||||||
} else {
|
} else {
|
||||||
sInstance->setSiteIsAlive(false);
|
sInstance->setSiteIsAlive(false);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1316,9 +1316,8 @@ bool LLTextureFetchWorker::doWork(S32 param)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
mRequestedSize = mDesiredSize;
|
mRequestedSize = mDesiredSize - cur_size;
|
||||||
mRequestedDiscard = mDesiredDiscard;
|
mRequestedDiscard = mDesiredDiscard;
|
||||||
mRequestedSize -= cur_size;
|
|
||||||
mRequestedOffset = cur_size;
|
mRequestedOffset = cur_size;
|
||||||
|
|
||||||
bool res = false;
|
bool res = false;
|
||||||
@@ -1909,6 +1908,7 @@ S32 LLTextureFetchWorker::callbackHttpGet(const LLChannelDescriptors& channels,
|
|||||||
// *TODO: This shouldn't be happening any more
|
// *TODO: This shouldn't be happening any more
|
||||||
llwarns << "data_size = " << data_size << " > requested: " << mRequestedSize << llendl;
|
llwarns << "data_size = " << data_size << " > requested: " << mRequestedSize << llendl;
|
||||||
mHaveAllData = TRUE;
|
mHaveAllData = TRUE;
|
||||||
|
mRequestedOffset = 0;
|
||||||
llassert_always(mDecodeHandle == 0);
|
llassert_always(mDecodeHandle == 0);
|
||||||
mFormattedImage = NULL; // discard any previous data we had
|
mFormattedImage = NULL; // discard any previous data we had
|
||||||
}
|
}
|
||||||
@@ -1919,7 +1919,7 @@ S32 LLTextureFetchWorker::callbackHttpGet(const LLChannelDescriptors& channels,
|
|||||||
// so presumably we have all of it
|
// so presumably we have all of it
|
||||||
mHaveAllData = TRUE;
|
mHaveAllData = TRUE;
|
||||||
}
|
}
|
||||||
mRequestedSize = llmin(data_size, mRequestedSize);
|
mRequestedSize = data_size;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -71,7 +71,7 @@ const int RIGHT_BUTTON = 1;
|
|||||||
///////////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////////
|
||||||
// Helper class that tries to download a URL from a web site and calls a method
|
// Helper class that tries to download a URL from a web site and calls a method
|
||||||
// on the Panel Land Media and to discover the MIME type
|
// on the Panel Land Media and to discover the MIME type
|
||||||
class LLMimeDiscoveryResponder : public LLHTTPClient::ResponderIgnoreBody
|
class LLMimeDiscoveryResponder : public LLHTTPClient::ResponderHeadersOnly
|
||||||
{
|
{
|
||||||
LOG_CLASS(LLMimeDiscoveryResponder);
|
LOG_CLASS(LLMimeDiscoveryResponder);
|
||||||
public:
|
public:
|
||||||
@@ -80,16 +80,21 @@ public:
|
|||||||
mInitialized(false)
|
mInitialized(false)
|
||||||
{}
|
{}
|
||||||
|
|
||||||
/*virtual*/ bool needsHeaders(void) const { return true; }
|
|
||||||
|
|
||||||
/*virtual*/ void completedHeaders(U32 status, std::string const& reason, AIHTTPReceivedHeaders const& headers)
|
/*virtual*/ void completedHeaders(U32 status, std::string const& reason, AIHTTPReceivedHeaders const& headers)
|
||||||
{
|
{
|
||||||
std::string media_type;
|
if (200 <= status && status < 300)
|
||||||
bool content_type_found = headers.getFirstValue("content-type", media_type);
|
{
|
||||||
llassert_always(content_type_found);
|
std::string media_type;
|
||||||
std::string::size_type idx1 = media_type.find_first_of(";");
|
if (headers.getFirstValue("content-type", media_type))
|
||||||
std::string mime_type = media_type.substr(0, idx1);
|
{
|
||||||
completeAny(status, mime_type);
|
std::string::size_type idx1 = media_type.find_first_of(";");
|
||||||
|
std::string mime_type = media_type.substr(0, idx1);
|
||||||
|
completeAny(status, mime_type);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
llwarns << "LLMimeDiscoveryResponder::completedHeaders: OK HTTP status (" << status << ") but no Content-Type! Received headers: " << headers << llendl;
|
||||||
|
}
|
||||||
|
completeAny(status, "none/none");
|
||||||
}
|
}
|
||||||
|
|
||||||
void completeAny(U32 status, const std::string& mime_type)
|
void completeAny(U32 status, const std::string& mime_type)
|
||||||
|
|||||||
@@ -690,6 +690,31 @@ LPTOP_LEVEL_EXCEPTION_FILTER WINAPI MyDummySetUnhandledExceptionFilter(
|
|||||||
return gFilterFunc;
|
return gFilterFunc;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
BOOL PreventSetUnhandledExceptionFilter()
|
||||||
|
{
|
||||||
|
HMODULE hKernel32 = LoadLibrary(_T("kernel32.dll"));
|
||||||
|
if (hKernel32 == NULL)
|
||||||
|
return FALSE;
|
||||||
|
|
||||||
|
void *pOrgEntry = GetProcAddress(hKernel32, "SetUnhandledExceptionFilter");
|
||||||
|
if(pOrgEntry == NULL)
|
||||||
|
return FALSE;
|
||||||
|
|
||||||
|
unsigned char newJump[ 100 ];
|
||||||
|
DWORD dwOrgEntryAddr = (DWORD)pOrgEntry;
|
||||||
|
dwOrgEntryAddr += 5; // add 5 for 5 op-codes for jmp far
|
||||||
|
void *pNewFunc = &MyDummySetUnhandledExceptionFilter;
|
||||||
|
DWORD dwNewEntryAddr = (DWORD) pNewFunc;
|
||||||
|
DWORD dwRelativeAddr = dwNewEntryAddr - dwOrgEntryAddr;
|
||||||
|
|
||||||
|
newJump[ 0 ] = 0xE9; // JMP absolute
|
||||||
|
memcpy(&newJump[ 1 ], &dwRelativeAddr, sizeof(pNewFunc));
|
||||||
|
SIZE_T bytesWritten;
|
||||||
|
BOOL bRet = WriteProcessMemory(GetCurrentProcess(),
|
||||||
|
pOrgEntry, newJump, sizeof(pNewFunc) + 1, &bytesWritten);
|
||||||
|
return bRet;
|
||||||
|
}
|
||||||
|
|
||||||
// static
|
// static
|
||||||
void LLWinDebug::initExceptionHandler(LPTOP_LEVEL_EXCEPTION_FILTER filter_func)
|
void LLWinDebug::initExceptionHandler(LPTOP_LEVEL_EXCEPTION_FILTER filter_func)
|
||||||
{
|
{
|
||||||
@@ -740,6 +765,9 @@ void LLWinDebug::initExceptionHandler(LPTOP_LEVEL_EXCEPTION_FILTER filter_func)
|
|||||||
LPTOP_LEVEL_EXCEPTION_FILTER prev_filter;
|
LPTOP_LEVEL_EXCEPTION_FILTER prev_filter;
|
||||||
prev_filter = SetUnhandledExceptionFilter(filter_func);
|
prev_filter = SetUnhandledExceptionFilter(filter_func);
|
||||||
|
|
||||||
|
// *REMOVE:Mani
|
||||||
|
//PreventSetUnhandledExceptionFilter();
|
||||||
|
|
||||||
if(prev_filter != gFilterFunc)
|
if(prev_filter != gFilterFunc)
|
||||||
{
|
{
|
||||||
LL_WARNS("AppInit")
|
LL_WARNS("AppInit")
|
||||||
|
|||||||
Reference in New Issue
Block a user