Merge branch 'master' of git://github.com/Lirusaito/SingularityViewer into VoiceUpdate
This commit is contained in:
@@ -122,6 +122,20 @@ AIPerService::AIPerService(AIPerService const&) : mHTTPBandwidth(0)
|
||||
// - 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 ':'.
|
||||
//
|
||||
// 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
|
||||
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
|
||||
{
|
||||
// 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.
|
||||
if (hostname < sheme_colon)
|
||||
{
|
||||
// This happens when windows filenames are passed to this function of the form "C:/..."
|
||||
servicename.clear();
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -173,6 +192,12 @@ std::string AIPerService::extract_canonical_servicename(std::string const& url)
|
||||
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)
|
||||
{
|
||||
// Convert hostname to lowercase in a way that we compare two hostnames equal iff libcurl does.
|
||||
|
||||
@@ -2196,6 +2196,7 @@ size_t BufferedCurlEasyRequest::curlHeaderCallback(char* data, size_t size, size
|
||||
return header_len;
|
||||
}
|
||||
std::string header(header_line, header_len);
|
||||
bool being_redirected = false;
|
||||
bool done = false;
|
||||
if (!LLStringUtil::_isASCII(header))
|
||||
{
|
||||
@@ -2240,7 +2241,7 @@ size_t BufferedCurlEasyRequest::curlHeaderCallback(char* data, size_t size, size
|
||||
if (status >= 300 && status < 400)
|
||||
{
|
||||
// Timeout administration needs to know if we're being redirected.
|
||||
self_w->httptimeout()->being_redirected();
|
||||
being_redirected = true;
|
||||
}
|
||||
}
|
||||
// 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.
|
||||
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)
|
||||
{
|
||||
return header_len;
|
||||
|
||||
@@ -157,7 +157,10 @@ void HTTPTimeout::upload_starting(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.
|
||||
#endif
|
||||
mUploadFinished = true;
|
||||
// Only accept a call to upload_starting() if being_redirected() is called after this point.
|
||||
mBeingRedirected = false;
|
||||
|
||||
Reference in New Issue
Block a user