Merge remote-tracking branch 'aleric/master'

This commit is contained in:
Latif Khalifa
2013-06-14 18:31:48 +02:00
7 changed files with 52 additions and 10 deletions

View File

@@ -122,6 +122,20 @@ AIPerService::AIPerService(AIPerService const&) : mHTTPBandwidth(0)
// - userinfo does not contain a '@', and if it exists, is always terminated by a '@'. // - userinfo does not contain a '@', and if it exists, is always terminated by a '@'.
// - port does not contain a ':', and if it exists is always prepended by a ':'. // - port does not contain a ':', and if it exists is always prepended by a ':'.
// //
// This function also needs to deal with full paths, in which case it should return
// an empty string.
//
// Full paths can have the form: "/something..."
// or "C:\something..."
// and maybe even "C:/something..."
//
// The first form leads to an empty string being returned because the '/' signals the
// end of the authority and we'll return immediately.
// The second one will abort when hitting the backslash because that is an illegal
// character in an url (before the first '/' anyway).
// The third will abort because "C:" would be the hostname and a colon in the hostname
// is not legal.
//
//static //static
std::string AIPerService::extract_canonical_servicename(std::string const& url) std::string AIPerService::extract_canonical_servicename(std::string const& url)
{ {
@@ -159,8 +173,13 @@ std::string AIPerService::extract_canonical_servicename(std::string const& url)
} }
else else
{ {
// Found slash that is not part of the "sheme://" string. Signals end of authority. // Found a slash that is not part of the "sheme://" string. Signals end of authority.
// We're done. // We're done.
if (hostname < sheme_colon)
{
// This happens when windows filenames are passed to this function of the form "C:/..."
servicename.clear();
}
break; break;
} }
} }
@@ -173,6 +192,12 @@ std::string AIPerService::extract_canonical_servicename(std::string const& url)
servicename.clear(); // Remove the "userinfo@" servicename.clear(); // Remove the "userinfo@"
} }
} }
else if (c == '\\')
{
// Found a backslash, which is an illegal character for an URL. This is a windows path... reject it.
servicename.clear();
break;
}
if (p >= hostname) if (p >= hostname)
{ {
// Convert hostname to lowercase in a way that we compare two hostnames equal iff libcurl does. // Convert hostname to lowercase in a way that we compare two hostnames equal iff libcurl does.

View File

@@ -2196,6 +2196,7 @@ size_t BufferedCurlEasyRequest::curlHeaderCallback(char* data, size_t size, size
return header_len; return header_len;
} }
std::string header(header_line, header_len); std::string header(header_line, header_len);
bool being_redirected = false;
bool done = false; bool done = false;
if (!LLStringUtil::_isASCII(header)) if (!LLStringUtil::_isASCII(header))
{ {
@@ -2240,7 +2241,7 @@ size_t BufferedCurlEasyRequest::curlHeaderCallback(char* data, size_t size, size
if (status >= 300 && status < 400) if (status >= 300 && status < 400)
{ {
// Timeout administration needs to know if we're being redirected. // Timeout administration needs to know if we're being redirected.
self_w->httptimeout()->being_redirected(); being_redirected = true;
} }
} }
// Update HTTP bandwidth. // Update HTTP bandwidth.
@@ -2254,6 +2255,14 @@ size_t BufferedCurlEasyRequest::curlHeaderCallback(char* data, size_t size, size
// Transfer timed out. Return 0 which will abort with error CURLE_WRITE_ERROR. // Transfer timed out. Return 0 which will abort with error CURLE_WRITE_ERROR.
return 0; return 0;
} }
if (being_redirected)
{
// Call this after data_received(), because that might reset mBeingRedirected if it causes a late- upload_finished!
// Ie, when the upload finished was not detected and this is a redirect header then the call to data_received()
// will call upload_finished() which sets HTTPTimeout::mUploadFinished (and resets HTTPTimeout::mBeingRedirected),
// after which we set HTTPTimeout::mBeingRedirected here because we ARE being redirected.
self_w->httptimeout()->being_redirected();
}
if (done) if (done)
{ {
return header_len; return header_len;

View File

@@ -157,7 +157,10 @@ void HTTPTimeout::upload_starting(void)
// | // |
void HTTPTimeout::upload_finished(void) void HTTPTimeout::upload_finished(void)
{ {
// Disable this assert when there isn't enough debug output to do anything with it.
#if defined(CWDEBUG) || defined(DEBUG_CURLIO)
llassert(!mUploadFinished); // If we get here twice, then the 'upload finished' detection failed. llassert(!mUploadFinished); // If we get here twice, then the 'upload finished' detection failed.
#endif
mUploadFinished = true; mUploadFinished = true;
// Only accept a call to upload_starting() if being_redirected() is called after this point. // Only accept a call to upload_starting() if being_redirected() is called after this point.
mBeingRedirected = false; mBeingRedirected = false;

View File

@@ -367,7 +367,7 @@ void LLKeywords::findSegments(std::vector<LLTextSegmentPtr>* seg_list, const LLW
return; return;
} }
S32 text_len = wtext.size() + 1; S32 text_len = wtext.size();
seg_list->push_back( new LLTextSegment( LLColor3(defaultColor), 0, text_len ) ); seg_list->push_back( new LLTextSegment( LLColor3(defaultColor), 0, text_len ) );
@@ -584,6 +584,7 @@ void LLKeywords::insertSegment(std::vector<LLTextSegmentPtr>& seg_list, LLTextSe
{ {
LLTextSegmentPtr last = seg_list.back(); LLTextSegmentPtr last = seg_list.back();
S32 new_seg_end = new_segment->getEnd(); S32 new_seg_end = new_segment->getEnd();
llassert(new_seg_end <= text_len);
if( new_segment->getStart() == last->getStart() ) if( new_segment->getStart() == last->getStart() )
{ {

View File

@@ -1064,7 +1064,11 @@ void LLPanelFriends::onClickPay(void* user_data)
void LLPanelFriends::confirmModifyRights(rights_map_t& rights, EGrantRevoke command) void LLPanelFriends::confirmModifyRights(rights_map_t& rights, EGrantRevoke command)
{ {
if (rights.empty()) return; if (rights.empty()) return;
// Make a copy on the heap: rights is allocated on the stack.
// This copy will be deleted in LLPanelFriends::modifyRightsConfirmation.
rights_map_t* heap_rights = new rights_map_t(rights);
// for single friend, show their name // for single friend, show their name
if (rights.size() == 1) if (rights.size() == 1)
{ {
@@ -1078,14 +1082,14 @@ void LLPanelFriends::confirmModifyRights(rights_map_t& rights, EGrantRevoke comm
LLNotificationsUtil::add("GrantModifyRights", LLNotificationsUtil::add("GrantModifyRights",
args, args,
LLSD(), LLSD(),
boost::bind(&LLPanelFriends::modifyRightsConfirmation, this, _1, _2, &rights)); boost::bind(&LLPanelFriends::modifyRightsConfirmation, this, _1, _2, heap_rights));
} }
else else
{ {
LLNotificationsUtil::add("RevokeModifyRights", LLNotificationsUtil::add("RevokeModifyRights",
args, args,
LLSD(), LLSD(),
boost::bind(&LLPanelFriends::modifyRightsConfirmation, this, _1, _2, &rights)); boost::bind(&LLPanelFriends::modifyRightsConfirmation, this, _1, _2, heap_rights));
} }
} }
else else
@@ -1095,14 +1099,14 @@ void LLPanelFriends::confirmModifyRights(rights_map_t& rights, EGrantRevoke comm
LLNotificationsUtil::add("GrantModifyRightsMultiple", LLNotificationsUtil::add("GrantModifyRightsMultiple",
LLSD(), LLSD(),
LLSD(), LLSD(),
boost::bind(&LLPanelFriends::modifyRightsConfirmation, this, _1, _2, &rights)); boost::bind(&LLPanelFriends::modifyRightsConfirmation, this, _1, _2, heap_rights));
} }
else else
{ {
LLNotificationsUtil::add("RevokeModifyRightsMultiple", LLNotificationsUtil::add("RevokeModifyRightsMultiple",
LLSD(), LLSD(),
LLSD(), LLSD(),
boost::bind(&LLPanelFriends::modifyRightsConfirmation, this, _1, _2, &rights)); boost::bind(&LLPanelFriends::modifyRightsConfirmation, this, _1, _2, heap_rights));
} }
} }
} }

View File

@@ -170,7 +170,7 @@ static bool handleRenderPerfTestChanged(const LLSD& newvalue)
LLPipeline::RENDER_TYPE_CLASSIC_CLOUDS, LLPipeline::RENDER_TYPE_CLASSIC_CLOUDS,
LLPipeline::RENDER_TYPE_HUD_PARTICLES, LLPipeline::RENDER_TYPE_HUD_PARTICLES,
LLPipeline::END_RENDER_TYPES); LLPipeline::END_RENDER_TYPES);
gPipeline.setRenderDebugFeatureControl(LLPipeline::RENDER_DEBUG_FEATURE_UI, false); gPipeline.setRenderDebugFeatureControl(~(U32)0, false); // Reset all RENDER_DEBUG_FEATURE_* flags.
} }
else else
{ {

View File

@@ -5951,7 +5951,7 @@ void LLPipeline::setRenderDebugFeatureControl(U32 bit, bool value)
} }
else else
{ {
gPipeline.mRenderDebugFeatureMask &= !bit; gPipeline.mRenderDebugFeatureMask &= ~bit;
} }
} }