Skip to content

Commit

Permalink
FIX: [mhd] return content length for downloads
Browse files Browse the repository at this point in the history
  • Loading branch information
koying committed Jan 26, 2018
1 parent e756cc5 commit 2e8220f
Showing 1 changed file with 7 additions and 8 deletions.
15 changes: 7 additions & 8 deletions xbmc/network/httprequesthandler/HTTPFileHandler.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -77,18 +77,17 @@ void CHTTPFileHandler::SetFile(const std::string& file, int responseStatus)
StringUtils::ToLower(ext);
m_response.contentType = CMime::GetMimeType(ext);

// determine the last modified date
XFILE::CFile fileObj;
if (!fileObj.Open(m_url, XFILE::READ_NO_CACHE))
// determine the last modified date & size
struct __stat64 statBuffer;
if (XFILE::CFile::Stat(m_url, &statBuffer) == 0)
{
m_response.type = HTTPError;
m_response.status = MHD_HTTP_INTERNAL_SERVER_ERROR;
SetLastModifiedDate(&statBuffer);
m_response.totalLength = statBuffer.st_size;
}
else
{
struct __stat64 statBuffer;
if (fileObj.Stat(&statBuffer) == 0)
SetLastModifiedDate(&statBuffer);
m_response.type = HTTPError;
m_response.status = MHD_HTTP_INTERNAL_SERVER_ERROR;
}
}

Expand Down

0 comments on commit 2e8220f

Please sign in to comment.