MythTV  0.25-pre
Classes | Public Types | Public Member Functions | Static Public Member Functions | Protected Member Functions | Private Slots | Private Attributes
HttpComms Class Reference

#include <httpcomms.h>

List of all members.

Classes

class  Credentials
struct  DigestAuthInfo

Public Types

enum  CredentialTypes { CRED_WEB, CRED_PROXY }

Public Member Functions

 HttpComms ()
 HttpComms (QUrl &url, int timeoutms=-1)
 HttpComms (QUrl &url, QHttpRequestHeader &header, int timeoutms=-1)
virtual ~HttpComms ()
bool isDone (void) const
int getProgress (void) const
int getTotal (void) const
int getStatusCode (void) const
QString getResponseReason (void) const
QString getData (void) const
QByteArray getRawData (void) const
QString getRedirectedURL (void) const
void stop ()
bool isTimedout (void) const
void setCredentials (const Credentials &cred, int credType)
void request (QUrl &url, int timeoutms=-1, bool allowGzip=false)
void request (QUrl &url, QHttpRequestHeader &header, int timeoutms=-1, QIODevice *pData=NULL)
void setCookie (const QString &cookie)
const QString & getCookie () const

Static Public Member Functions

static QString getHttp (QString &url, int timeoutMS=10000, int maxRetries=3, int maxRedirects=3, bool allowGzip=false, Credentials *webCred=NULL, bool isInQtEventThread=true)
 Static function for grabbing http data for a url.
static bool getHttpFile (const QString &file, QString &url, int timeoutMS=10000, int maxRetries=3, int maxRedirects=3, bool allowGzip=false, Credentials *webCred=NULL)
static QString postHttp (QUrl &url, QHttpRequestHeader *pAddlHdr=NULL, QIODevice *pData=NULL, int timeoutMS=10000, int maxRetries=3, int maxRedirects=3, bool allowGzip=false, Credentials *webCred=NULL, bool isInQtEventThread=true, QString userAgent="<default>")
 Static function for performing a http post request to a url.

Protected Member Functions

void init ()
void calculateDigestResponse (DigestAuthInfo &info, QByteArray &Response)
bool createDigestAuth (bool isForProxy, const QString &authStr, QHttpRequestHeader *request)

Private Slots

void timeout ()
void done (bool error)
void stateChanged (int state)
void dataReadProgress (int done, int total)
void headerReceived (const QHttpResponseHeader &resp)

Private Attributes

int m_statusCode
QString m_redirectedURL
QString m_responseReason
Credentials m_webCredentials
Credentials m_proxyCredentials
QHttp * http
bool m_done
QByteArray m_data
QUrl m_url
QTimer * m_timer
bool m_timeout
bool m_authNeeded
int m_timeoutInterval
QString m_cookie
int m_progress
int m_total
QHttpRequestHeader m_curRequest

Detailed Description

Definition at line 13 of file httpcomms.h.


Member Enumeration Documentation

Enumerator:
CRED_WEB 
CRED_PROXY 

Definition at line 49 of file httpcomms.h.


Constructor & Destructor Documentation

Definition at line 14 of file httpcomms.cpp.

Referenced by getHttp(), getHttpFile(), and postHttp().

HttpComms::HttpComms ( QUrl &  url,
int  timeoutms = -1 
)

Definition at line 21 of file httpcomms.cpp.

HttpComms::HttpComms ( QUrl &  url,
QHttpRequestHeader &  header,
int  timeoutms = -1 
)

Definition at line 28 of file httpcomms.cpp.

HttpComms::~HttpComms ( ) [virtual]

Definition at line 34 of file httpcomms.cpp.


Member Function Documentation

bool HttpComms::isDone ( void  ) const [inline]

Definition at line 22 of file httpcomms.h.

Referenced by getHttp(), MythNews::getHttpFile(), getHttpFile(), and postHttp().

int HttpComms::getProgress ( void  ) const [inline]

Definition at line 23 of file httpcomms.h.

Referenced by MythNews::getHttpFile(), and MythNews::updateInfoView().

int HttpComms::getTotal ( void  ) const [inline]

Definition at line 24 of file httpcomms.h.

Referenced by MythNews::getHttpFile(), and MythNews::updateInfoView().

int HttpComms::getStatusCode ( void  ) const [inline]

Definition at line 26 of file httpcomms.h.

Referenced by MythNews::getHttpFile(), and getHttpFile().

QString HttpComms::getResponseReason ( void  ) const [inline]

Definition at line 27 of file httpcomms.h.

QString HttpComms::getData ( void  ) const [inline]

Definition at line 29 of file httpcomms.h.

Referenced by getHttp(), and postHttp().

QByteArray HttpComms::getRawData ( void  ) const [inline]

Definition at line 30 of file httpcomms.h.

Referenced by MythNews::getHttpFile(), and getHttpFile().

QString HttpComms::getRedirectedURL ( void  ) const [inline]

Definition at line 32 of file httpcomms.h.

Referenced by getHttp(), MythNews::getHttpFile(), getHttpFile(), and postHttp().

Definition at line 126 of file httpcomms.cpp.

bool HttpComms::isTimedout ( void  ) const [inline]

Definition at line 36 of file httpcomms.h.

Referenced by getHttp(), getHttpFile(), and postHttp().

void HttpComms::setCredentials ( const Credentials cred,
int  credType 
) [inline]

Definition at line 51 of file httpcomms.h.

Referenced by getHttp(), getHttpFile(), and postHttp().

QString HttpComms::getHttp ( QString &  url,
int  timeoutMS = 10000,
int  maxRetries = 3,
int  maxRedirects = 3,
bool  allowGzip = false,
Credentials webCred = NULL,
bool  isInQtEventThread = true 
) [static]

Static function for grabbing http data for a url.

This is a synchronous function, it will block according to the vars.

Definition at line 289 of file httpcomms.cpp.

Referenced by IPTVChannelFetcher::DownloadPlaylist(), Cddb::Query(), Cddb::Read(), and UPnpDeviceDesc::Retrieve().

bool HttpComms::getHttpFile ( const QString &  file,
QString &  url,
int  timeoutMS = 10000,
int  maxRetries = 3,
int  maxRedirects = 3,
bool  allowGzip = false,
Credentials webCred = NULL 
) [static]
QString HttpComms::postHttp ( QUrl &  url,
QHttpRequestHeader *  pAddlHdr = NULL,
QIODevice *  pData = NULL,
int  timeoutMS = 10000,
int  maxRetries = 3,
int  maxRedirects = 3,
bool  allowGzip = false,
Credentials webCred = NULL,
bool  isInQtEventThread = true,
QString  userAgent = "<default>" 
) [static]

Static function for performing a http post request to a url.

This is a synchronous function, it will block according to the vars.

Definition at line 528 of file httpcomms.cpp.

Referenced by SOAPClient::SendSOAPRequest(), and ImportIconsWizard::wget().

void HttpComms::request ( QUrl &  url,
int  timeoutms = -1,
bool  allowGzip = false 
)

Definition at line 66 of file httpcomms.cpp.

Referenced by getHttp(), MythNews::getHttpFile(), getHttpFile(), HttpComms(), and postHttp().

void HttpComms::request ( QUrl &  url,
QHttpRequestHeader &  header,
int  timeoutms = -1,
QIODevice *  pData = NULL 
)

Definition at line 88 of file httpcomms.cpp.

void HttpComms::setCookie ( const QString &  cookie) [inline]

Definition at line 85 of file httpcomms.h.

const QString& HttpComms::getCookie ( ) const [inline]

Definition at line 86 of file httpcomms.h.

void HttpComms::init ( ) [protected]

Definition at line 46 of file httpcomms.cpp.

Referenced by HttpComms().

void HttpComms::calculateDigestResponse ( DigestAuthInfo info,
QByteArray &  Response 
) [protected]

Definition at line 860 of file httpcomms.cpp.

Referenced by createDigestAuth().

bool HttpComms::createDigestAuth ( bool  isForProxy,
const QString &  authStr,
QHttpRequestHeader *  request 
) [protected]

Definition at line 662 of file httpcomms.cpp.

Referenced by headerReceived().

void HttpComms::timeout ( void  ) [private, slot]

Definition at line 269 of file httpcomms.cpp.

Referenced by request().

void HttpComms::done ( bool  error) [private, slot]

Definition at line 135 of file httpcomms.cpp.

Referenced by dataReadProgress(), and init().

void HttpComms::stateChanged ( int  state) [private, slot]

Definition at line 163 of file httpcomms.cpp.

Referenced by init().

void HttpComms::dataReadProgress ( int  done,
int  total 
) [private, slot]

Definition at line 277 of file httpcomms.cpp.

Referenced by init().

void HttpComms::headerReceived ( const QHttpResponseHeader &  resp) [private, slot]

Definition at line 184 of file httpcomms.cpp.

Referenced by init().


Member Data Documentation

Definition at line 117 of file httpcomms.h.

Referenced by headerReceived(), and init().

QString HttpComms::m_redirectedURL [private]

Definition at line 118 of file httpcomms.h.

Referenced by headerReceived().

QString HttpComms::m_responseReason [private]

Definition at line 119 of file httpcomms.h.

Referenced by headerReceived().

Definition at line 120 of file httpcomms.h.

Referenced by createDigestAuth(), and headerReceived().

Definition at line 121 of file httpcomms.h.

Referenced by createDigestAuth().

QHttp* HttpComms::http [private]

Definition at line 122 of file httpcomms.h.

Referenced by done(), headerReceived(), init(), request(), stop(), and ~HttpComms().

Definition at line 123 of file httpcomms.h.

Referenced by done(), init(), and timeout().

QByteArray HttpComms::m_data [private]

Definition at line 124 of file httpcomms.h.

Referenced by done().

QUrl HttpComms::m_url [private]

Definition at line 125 of file httpcomms.h.

Referenced by calculateDigestResponse(), createDigestAuth(), done(), request(), and timeout().

QTimer* HttpComms::m_timer [private]

Definition at line 126 of file httpcomms.h.

Referenced by done(), headerReceived(), init(), request(), stop(), and ~HttpComms().

Definition at line 127 of file httpcomms.h.

Referenced by init(), and timeout().

Definition at line 128 of file httpcomms.h.

Referenced by done(), headerReceived(), and init().

Definition at line 129 of file httpcomms.h.

Referenced by headerReceived(), and request().

QString HttpComms::m_cookie [private]

Definition at line 130 of file httpcomms.h.

Referenced by headerReceived(), and request().

Definition at line 131 of file httpcomms.h.

Referenced by dataReadProgress(), and init().

Definition at line 132 of file httpcomms.h.

Referenced by dataReadProgress(), and init().

QHttpRequestHeader HttpComms::m_curRequest [private]

Definition at line 134 of file httpcomms.h.

Referenced by headerReceived(), and request().


The documentation for this class was generated from the following files:
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends