Skip to content

Commit

Permalink
ADD: [curl] getter for last effective url
Browse files Browse the repository at this point in the history
  • Loading branch information
koying committed Mar 3, 2017
1 parent 038c3ab commit 9767e36
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 0 deletions.
7 changes: 7 additions & 0 deletions xbmc/filesystem/CurlFile.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1105,6 +1105,7 @@ bool CCurlFile::Open(const CURL& url)
}
m_url = efurl;
}
m_lastEffectiveUrl = m_url;

return true;
}
Expand Down Expand Up @@ -1135,6 +1136,7 @@ bool CCurlFile::OpenForWrite(const CURL& url, bool bOverWrite)
char* efurl;
if (CURLE_OK == g_curlInterface.easy_getinfo(m_state->m_easyHandle, CURLINFO_EFFECTIVE_URL,&efurl) && efurl)
m_url = efurl;
m_lastEffectiveUrl = m_url;

m_opened = true;
m_forWrite = true;
Expand Down Expand Up @@ -1781,6 +1783,11 @@ void CCurlFile::SetRequestHeader(const std::string& header, long value)
m_requestheaders[header] = StringUtils::Format("%ld", value);
}

std::string CCurlFile::GetLastEffectiveUrl()
{
return m_lastEffectiveUrl;
}

std::string CCurlFile::GetServerReportedCharset(void)
{
if (!m_state)
Expand Down
3 changes: 3 additions & 0 deletions xbmc/filesystem/CurlFile.h
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,8 @@ namespace XFILE
void SetRequestHeader(const std::string& header, const std::string& value);
void SetRequestHeader(const std::string& header, long value);

std::string GetLastEffectiveUrl();

void ClearRequestHeaders();
void SetBufferSize(unsigned int size);

Expand Down Expand Up @@ -168,6 +170,7 @@ namespace XFILE
int64_t m_writeOffset;

std::string m_url;
std::string m_lastEffectiveUrl;
std::string m_userAgent;
std::string m_proxy;
std::string m_proxyuserpass;
Expand Down

0 comments on commit 9767e36

Please sign in to comment.