[LLMeshRepo sync] AICurl updates toward LLCurl

LLHTTPClient::getByteRange no longer throws AICurlNoEasyHandle, instead it returns whether or not it threw, to match the true/false convention of LLCurl.
- In addition, the header param has been shifted to earlier in this function to ease diffings.
ResponderBase now has static bool isGoodStatus, introduced into the Responder base class of LLCurl
This commit is contained in:
Inusaito Sayori
2014-04-17 20:23:48 -04:00
parent 4c82a5660f
commit 5c06afc977
6 changed files with 99 additions and 104 deletions

View File

@@ -237,13 +237,21 @@ void LLHTTPClient::request(
req->run(parent, new_parent_state, parent != NULL, true, default_engine);
}
void LLHTTPClient::getByteRange(std::string const& url, S32 offset, S32 bytes, ResponderPtr responder, AIHTTPHeaders& headers/*,*/ DEBUG_CURLIO_PARAM(EDebugCurl debug))
bool LLHTTPClient::getByteRange(std::string const& url, AIHTTPHeaders& headers, S32 offset, S32 bytes, ResponderPtr responder/*,*/ DEBUG_CURLIO_PARAM(EDebugCurl debug))
{
if(offset > 0 || bytes > 0)
try
{
headers.addHeader("Range", llformat("bytes=%d-%d", offset, offset + bytes - 1));
if (offset > 0 || bytes > 0)
{
headers.addHeader("Range", llformat("bytes=%d-%d", offset, offset + bytes - 1));
}
request(url, HTTP_GET, NULL, responder, headers, NULL/*,*/ DEBUG_CURLIO_PARAM(debug));
}
request(url, HTTP_GET, NULL, responder, headers, NULL/*,*/ DEBUG_CURLIO_PARAM(debug));
catch(AICurlNoEasyHandle const&)
{
return false;
}
return true;
}
void LLHTTPClient::head(std::string const& url, ResponderHeadersOnly* responder, AIHTTPHeaders& headers/*,*/ DEBUG_CURLIO_PARAM(EDebugCurl debug))