xbmc
Classes | Public Member Functions | Static Public Member Functions | Protected Types | Protected Member Functions | Protected Attributes | List of all members
XFILE::CCurlFile Class Reference
Inheritance diagram for XFILE::CCurlFile:
Inheritance graph
[legend]
Collaboration diagram for XFILE::CCurlFile:
Collaboration graph
[legend]

Classes

class  CReadState
 

Public Member Functions

bool Open (const CURL &url) override
 
bool OpenForWrite (const CURL &url, bool bOverWrite=false) override
 
bool ReOpen (const CURL &url) override
 
bool Exists (const CURL &url) override
 
int64_t Seek (int64_t iFilePosition, int iWhence=SEEK_SET) override
 
int64_t GetPosition () override
 
int64_t GetLength () override
 
int Stat (const CURL &url, struct __stat64 *buffer) override
 Fills struct __stat64 with information about file specified by url. More...
 
void Close () override
 
bool ReadString (char *szLine, int iLineLength) override
 
ssize_t Read (void *lpBuf, size_t uiBufSize) override
 Attempt to read bufSize bytes from currently opened file into buffer bufPtr. More...
 
ssize_t Write (const void *lpBuf, size_t uiBufSize) override
 Attempt to write bufSize bytes from buffer bufPtr into currently opened file. More...
 
const std::string GetProperty (XFILE::FileProperty type, const std::string &name="") const override
 
const std::vector< std::string > GetPropertyValues (XFILE::FileProperty type, const std::string &name="") const override
 
int IoControl (EIoControl request, void *param) override
 
double GetDownloadSpeed () override
 
bool Post (const std::string &strURL, const std::string &strPostData, std::string &strHTML)
 
bool Get (const std::string &strURL, std::string &strHTML)
 
bool ReadData (std::string &strHTML)
 
bool Download (const std::string &strURL, const std::string &strFileName, unsigned int *pdwSize=NULL)
 
bool IsInternet ()
 
void Cancel ()
 
void Reset ()
 
void SetUserAgent (const std::string &sUserAgent)
 
void SetProxy (const std::string &type, const std::string &host, uint16_t port, const std::string &user, const std::string &password)
 
void SetCustomRequest (const std::string &request)
 
void SetAcceptEncoding (const std::string &encoding)
 
void SetAcceptCharset (const std::string &charset)
 
void SetTimeout (int connecttimeout)
 
void SetLowSpeedTime (int lowspeedtime)
 
void SetPostData (const std::string &postdata)
 
void SetReferer (const std::string &referer)
 
void SetCookie (const std::string &cookie)
 
void SetMimeType (const std::string &mimetype)
 
void SetRequestHeader (const std::string &header, const std::string &value)
 
void SetRequestHeader (const std::string &header, long value)
 
void ClearRequestHeaders ()
 
void SetBufferSize (unsigned int size)
 
const CHttpHeaderGetHttpHeader () const
 
std::string GetURL (void)
 
std::string GetRedirectURL ()
 
- Public Member Functions inherited from XFILE::IFile
virtual int Stat (struct __stat64 *buffer)
 Fills struct __stat64 with information about currently open file For st_mode function will set correctly _S_IFDIR (directory) flag and may set _S_IREAD (read permission), _S_IWRITE (write permission) flags if such information is available. More...
 
virtual void Flush ()
 
virtual int Truncate (int64_t size)
 
virtual int GetChunkSize ()
 
virtual bool Delete (const CURL &url)
 
virtual bool Rename (const CURL &url, const CURL &urlnew)
 
virtual bool SetHidden (const CURL &url, bool hidden)
 

Static Public Member Functions

static bool GetHttpHeader (const CURL &url, CHttpHeader &headers)
 
static bool GetMimeType (const CURL &url, std::string &content, const std::string &useragent="")
 
static bool GetContentType (const CURL &url, std::string &content, const std::string &useragent="")
 
static bool GetCookies (const CURL &url, std::string &cookies)
 

Protected Types

typedef std::map< std::string, std::string > MAPHTTPHEADERS
 

Protected Member Functions

void ParseAndCorrectUrl (CURL &url)
 
void SetCommonOptions (CReadState *state, bool failOnError=true)
 
void SetRequestHeaders (CReadState *state)
 
void SetCorrectHeaders (CReadState *state)
 
bool Service (const std::string &strURL, std::string &strHTML)
 
std::string GetInfoString (int infoType)
 

Protected Attributes

CReadStatem_state
 
CReadStatem_oldState
 
unsigned int m_bufferSize
 
int64_t m_writeOffset = 0
 
std::string m_url
 
std::string m_userAgent
 
ProxyType m_proxytype = PROXY_HTTP
 
std::string m_proxyhost
 
uint16_t m_proxyport = 3128
 
std::string m_proxyuser
 
std::string m_proxypassword
 
std::string m_customrequest
 
std::string m_acceptencoding
 
std::string m_acceptCharset
 
std::string m_ftpauth
 
std::string m_ftpport
 
std::string m_binary
 
std::string m_postdata
 
std::string m_referer
 
std::string m_cookie
 
std::string m_username
 
std::string m_password
 
std::string m_httpauth
 
std::string m_cipherlist
 
bool m_ftppasvip
 
int m_connecttimeout
 
int m_redirectlimit
 
int m_lowspeedtime
 
bool m_opened
 
bool m_forWrite
 
bool m_inError
 
bool m_seekable
 
bool m_multisession
 
bool m_skipshout
 
bool m_postdataset
 
bool m_allowRetry
 
bool m_verifyPeer = true
 
bool m_failOnError = true
 
curl_slist * m_dnsCacheList = nullptr
 
CRingBuffer m_buffer
 
char * m_overflowBuffer
 
unsigned int m_overflowSize = 0
 
int m_stillRunning
 
MAPHTTPHEADERS m_requestheaders
 
long m_httpresponse
 

Member Function Documentation

◆ ParseAndCorrectUrl()

void CCurlFile::ParseAndCorrectUrl ( CURL url)
protected
Todo:
create a tokenizer that doesn't skip empty's

◆ Read()

ssize_t XFILE::CCurlFile::Read ( void *  bufPtr,
size_t  bufSize 
)
inlineoverridevirtual

Attempt to read bufSize bytes from currently opened file into buffer bufPtr.

Parameters
bufPtrpointer to buffer
bufSizesize of the buffer
Returns
number of successfully read bytes if any bytes were read and stored in buffer, zero if no bytes are available to read (end of file was reached) or undetectable error occur, -1 in case of any explicit error

Implements XFILE::IFile.

◆ Seek()

int64_t CCurlFile::Seek ( int64_t  iFilePosition,
int  iWhence = SEEK_SET 
)
overridevirtual
Todo:
daap is gone. is this needed for something else?

Implements XFILE::IFile.

◆ Stat()

int CCurlFile::Stat ( const CURL url,
struct __stat64 *  buffer 
)
overridevirtual

Fills struct __stat64 with information about file specified by url.

For st_mode function will set correctly _S_IFDIR (directory) flag and may set _S_IREAD (read permission), _S_IWRITE (write permission) flags if such information is available. Function may set st_size (file size), st_atime, st_mtime, st_ctime (access, modification, creation times). Any other flags and members of __stat64 that didn't updated with actual file information will be set to zero (st_nlink can be set ether to 1 or zero).

Parameters
urlspecifies requested file
bufferpointer to __stat64 buffer to receive information about file
Returns
zero of success, -1 otherwise.

Implements XFILE::IFile.

◆ Write()

ssize_t CCurlFile::Write ( const void *  bufPtr,
size_t  bufSize 
)
overridevirtual

Attempt to write bufSize bytes from buffer bufPtr into currently opened file.

Parameters
bufPtrpointer to buffer
bufSizesize of the buffer
Returns
number of successfully written bytes if any bytes were written, zero if no bytes were written and no detectable error occur, -1 in case of any explicit error

Reimplemented from XFILE::IFile.


The documentation for this class was generated from the following files: