HttpComms Class Reference

#include <httpcomms.h>

List of all members.


Detailed Description

Definition at line 11 of file httpcomms.h.


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)
int getProgress (void)
int getTotal (void)
int getStatusCode (void)
QString getResponseReason (void)
QString getData (void)
QByteArray getRawData (void)
QString getRedirectedURL (void)
void stop ()
bool isTimedout (void)
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)
 Static function for performing an http post request to a url.

Protected Member Functions

void init ()
void calculateDigestResponse (DigestAuthInfo &info, QCString &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

Classes

class  Credentials
struct  DigestAuthInfo

Member Enumeration Documentation

Enumerator:
CRED_WEB 
CRED_PROXY 

Definition at line 44 of file httpcomms.h.


Constructor & Destructor Documentation

HttpComms::HttpComms (  ) 

Definition at line 14 of file httpcomms.cpp.

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   )  [inline]

Definition at line 20 of file httpcomms.h.

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

int HttpComms::getProgress ( void   )  [inline]

Definition at line 21 of file httpcomms.h.

Referenced by MythNews::updateInfoView().

int HttpComms::getTotal ( void   )  [inline]

Definition at line 22 of file httpcomms.h.

Referenced by MythNews::updateInfoView().

int HttpComms::getStatusCode ( void   )  [inline]

Definition at line 24 of file httpcomms.h.

Referenced by getHttpFile().

QString HttpComms::getResponseReason ( void   )  [inline]

Definition at line 25 of file httpcomms.h.

QString HttpComms::getData ( void   )  [inline]

Definition at line 27 of file httpcomms.h.

Referenced by getHttp(), and postHttp().

QByteArray HttpComms::getRawData ( void   )  [inline]

Definition at line 28 of file httpcomms.h.

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

QString HttpComms::getRedirectedURL ( void   )  [inline]

Definition at line 30 of file httpcomms.h.

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

void HttpComms::stop (  ) 

Definition at line 117 of file httpcomms.cpp.

bool HttpComms::isTimedout ( void   )  [inline]

Definition at line 34 of file httpcomms.h.

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

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

Definition at line 46 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 279 of file httpcomms.cpp.

Referenced by IPTVChannelFetcher::DownloadPlaylist(), CdDecoder::lookupCDDB(), UPnpDeviceDesc::Retrieve(), and MythNews::slotViewArticle().

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 
) [static]

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

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

Definition at line 497 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 63 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 80 of file httpcomms.cpp.

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

Definition at line 78 of file httpcomms.h.

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

Definition at line 79 of file httpcomms.h.

void HttpComms::init (  )  [protected]

Definition at line 42 of file httpcomms.cpp.

Referenced by HttpComms().

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

Definition at line 804 of file httpcomms.cpp.

Referenced by createDigestAuth().

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

Definition at line 607 of file httpcomms.cpp.

Referenced by headerReceived().

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

Definition at line 259 of file httpcomms.cpp.

Referenced by request().

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

Definition at line 126 of file httpcomms.cpp.

Referenced by init().

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

Definition at line 155 of file httpcomms.cpp.

Referenced by init().

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

Definition at line 267 of file httpcomms.cpp.

Referenced by init().

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

Definition at line 176 of file httpcomms.cpp.

Referenced by init().


Member Data Documentation

int HttpComms::m_statusCode [private]

Definition at line 110 of file httpcomms.h.

Referenced by headerReceived(), and init().

QString HttpComms::m_redirectedURL [private]

Definition at line 111 of file httpcomms.h.

Referenced by headerReceived(), and init().

QString HttpComms::m_responseReason [private]

Definition at line 112 of file httpcomms.h.

Referenced by headerReceived(), and init().

Definition at line 113 of file httpcomms.h.

Referenced by createDigestAuth(), and headerReceived().

Definition at line 114 of file httpcomms.h.

Referenced by createDigestAuth().

QHttp* HttpComms::http [private]

Definition at line 115 of file httpcomms.h.

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

Definition at line 116 of file httpcomms.h.

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

QByteArray HttpComms::m_data [private]

Definition at line 117 of file httpcomms.h.

Referenced by done().

QUrl HttpComms::m_url [private]

Definition at line 118 of file httpcomms.h.

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

QTimer* HttpComms::m_timer [private]

Definition at line 119 of file httpcomms.h.

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

Definition at line 120 of file httpcomms.h.

Referenced by init(), and timeout().

Definition at line 121 of file httpcomms.h.

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

Definition at line 122 of file httpcomms.h.

Referenced by headerReceived(), and request().

QString HttpComms::m_cookie [private]

Definition at line 123 of file httpcomms.h.

Referenced by headerReceived(), and request().

int HttpComms::m_progress [private]

Definition at line 124 of file httpcomms.h.

Referenced by dataReadProgress().

int HttpComms::m_total [private]

Definition at line 125 of file httpcomms.h.

Referenced by dataReadProgress().

QHttpRequestHeader HttpComms::m_curRequest [private]

Definition at line 127 of file httpcomms.h.

Referenced by headerReceived(), and request().


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

Generated on Sat Dec 18 05:16:03 2010 for MythTV by  doxygen 1.5.5