Qt 4.8
Signals | Public Functions | Friends | List of all members
QHttpNetworkReply Class Reference

#include <qhttpnetworkreply_p.h>

Inheritance diagram for QHttpNetworkReply:
QObject QHttpNetworkHeader

Signals

void authenticationRequired (const QHttpNetworkRequest &request, QAuthenticator *authenticator)
 
void cacheCredentials (const QHttpNetworkRequest &request, QAuthenticator *authenticator)
 
void dataReadProgress (int done, int total)
 
void dataSendProgress (qint64 done, qint64 total)
 
void finished ()
 
void finishedWithError (QNetworkReply::NetworkError errorCode, const QString &detail=QString())
 
void headerChanged ()
 
void proxyAuthenticationRequired (const QNetworkProxy &proxy, QAuthenticator *authenticator)
 
void readyRead ()
 
void sslErrors (const QList< QSslError > &errors)
 
- Signals inherited from QObject
void destroyed (QObject *=0)
 This signal is emitted immediately before the object obj is destroyed, and can not be blocked. More...
 

Public Functions

qint64 bytesAvailable () const
 
qint64 bytesAvailableNextBlock () const
 
QHttpNetworkConnectionconnection ()
 
qint64 contentLength () const
 
QString errorString () const
 
QList< QPair< QByteArray, QByteArray > > header () const
 
QByteArray headerField (const QByteArray &name, const QByteArray &defaultValue=QByteArray()) const
 
void ignoreSslErrors ()
 
void ignoreSslErrors (const QList< QSslError > &errors)
 
bool isFinished () const
 
bool isPipeliningUsed () const
 
int majorVersion () const
 
int minorVersion () const
 
void parseHeader (const QByteArray &header)
 
 QHttpNetworkReply (const QUrl &url=QUrl(), QObject *parent=0)
 
QByteArray read (qint64 amount)
 
QByteArray readAll ()
 
QByteArray readAny ()
 
bool readAnyAvailable () const
 
QString reasonPhrase () const
 
QHttpNetworkRequest request () const
 
void setContentLength (qint64 length)
 
void setDownstreamLimited (bool t)
 
void setErrorString (const QString &error)
 
void setHeaderField (const QByteArray &name, const QByteArray &data)
 
void setReadBufferSize (qint64 size)
 
void setRequest (const QHttpNetworkRequest &request)
 
void setSslConfiguration (const QSslConfiguration &config)
 
void setStatusCode (int code)
 
void setUrl (const QUrl &url)
 
void setUserProvidedDownloadBuffer (char *)
 
qint64 sizeNextBlock ()
 
QSslConfiguration sslConfiguration () const
 
int statusCode () const
 
bool supportsUserProvidedDownloadBuffer ()
 
QUrl url () const
 
char * userProvidedDownloadBuffer ()
 
virtual ~QHttpNetworkReply ()
 
- Public Functions inherited from QObject
bool blockSignals (bool b)
 If block is true, signals emitted by this object are blocked (i.e., emitting a signal will not invoke anything connected to it). More...
 
const QObjectListchildren () const
 Returns a list of child objects. More...
 
bool connect (const QObject *sender, const char *signal, const char *member, Qt::ConnectionType type=Qt::AutoConnection) const
 
bool disconnect (const char *signal=0, const QObject *receiver=0, const char *member=0)
 
bool disconnect (const QObject *receiver, const char *member=0)
 
void dumpObjectInfo ()
 Dumps information about signal connections, etc. More...
 
void dumpObjectTree ()
 Dumps a tree of children to the debug output. More...
 
QList< QByteArraydynamicPropertyNames () const
 Returns the names of all properties that were dynamically added to the object using setProperty(). More...
 
virtual bool event (QEvent *)
 This virtual function receives events to an object and should return true if the event e was recognized and processed. More...
 
virtual bool eventFilter (QObject *, QEvent *)
 Filters events if this object has been installed as an event filter for the watched object. More...
 
template<typename T >
findChild (const QString &aName=QString()) const
 Returns the child of this object that can be cast into type T and that is called name, or 0 if there is no such object. More...
 
template<typename T >
QList< T > findChildren (const QString &aName=QString()) const
 Returns all children of this object with the given name that can be cast to type T, or an empty list if there are no such objects. More...
 
template<typename T >
QList< T > findChildren (const QRegExp &re) const
 
bool inherits (const char *classname) const
 Returns true if this object is an instance of a class that inherits className or a QObject subclass that inherits className; otherwise returns false. More...
 
void installEventFilter (QObject *)
 Installs an event filter filterObj on this object. More...
 
bool isWidgetType () const
 Returns true if the object is a widget; otherwise returns false. More...
 
void killTimer (int id)
 Kills the timer with timer identifier, id. More...
 
virtual const QMetaObjectmetaObject () const
 Returns a pointer to the meta-object of this object. More...
 
void moveToThread (QThread *thread)
 Changes the thread affinity for this object and its children. More...
 
QString objectName () const
 
QObjectparent () const
 Returns a pointer to the parent object. More...
 
QVariant property (const char *name) const
 Returns the value of the object's name property. More...
 
Q_INVOKABLE QObject (QObject *parent=0)
 Constructs an object with parent object parent. More...
 
void removeEventFilter (QObject *)
 Removes an event filter object obj from this object. More...
 
void setObjectName (const QString &name)
 
void setParent (QObject *)
 Makes the object a child of parent. More...
 
bool setProperty (const char *name, const QVariant &value)
 Sets the value of the object's name property to value. More...
 
void setUserData (uint id, QObjectUserData *data)
 
bool signalsBlocked () const
 Returns true if signals are blocked; otherwise returns false. More...
 
int startTimer (int interval)
 Starts a timer and returns a timer identifier, or returns zero if it could not start a timer. More...
 
QThreadthread () const
 Returns the thread in which the object lives. More...
 
QObjectUserDatauserData (uint id) const
 
virtual ~QObject ()
 Destroys the object, deleting all its child objects. More...
 
- Public Functions inherited from QHttpNetworkHeader
virtual ~QHttpNetworkHeader ()
 

Friends

class QHttpNetworkConnection
 
class QHttpNetworkConnectionChannel
 
class QHttpNetworkConnectionPrivate
 

Additional Inherited Members

- Public Slots inherited from QObject
void deleteLater ()
 Schedules this object for deletion. More...
 
- Static Public Functions inherited from QObject
static bool connect (const QObject *sender, const char *signal, const QObject *receiver, const char *member, Qt::ConnectionType=Qt::AutoConnection)
 Creates a connection of the given type from the signal in the sender object to the method in the receiver object. More...
 
static bool connect (const QObject *sender, const QMetaMethod &signal, const QObject *receiver, const QMetaMethod &method, Qt::ConnectionType type=Qt::AutoConnection)
 
static bool disconnect (const QObject *sender, const char *signal, const QObject *receiver, const char *member)
 Disconnects signal in object sender from method in object receiver. More...
 
static bool disconnect (const QObject *sender, const QMetaMethod &signal, const QObject *receiver, const QMetaMethod &member)
 
static uint registerUserData ()
 
static QString tr (const char *sourceText, const char *comment=0, int n=-1)
 
static QString trUtf8 (const char *sourceText, const char *comment=0, int n=-1)
 
- Static Public Variables inherited from QObject
static const QMetaObject staticMetaObject
 This variable stores the meta-object for the class. More...
 
- Protected Functions inherited from QObject
virtual void childEvent (QChildEvent *)
 This event handler can be reimplemented in a subclass to receive child events. More...
 
virtual void connectNotify (const char *signal)
 This virtual function is called when something has been connected to signal in this object. More...
 
virtual void customEvent (QEvent *)
 This event handler can be reimplemented in a subclass to receive custom events. More...
 
virtual void disconnectNotify (const char *signal)
 This virtual function is called when something has been disconnected from signal in this object. More...
 
 QObject (QObjectPrivate &dd, QObject *parent=0)
 
int receivers (const char *signal) const
 Returns the number of receivers connected to the signal. More...
 
QObjectsender () const
 Returns a pointer to the object that sent the signal, if called in a slot activated by a signal; otherwise it returns 0. More...
 
int senderSignalIndex () const
 
virtual void timerEvent (QTimerEvent *)
 This event handler can be reimplemented in a subclass to receive timer events for the object. More...
 
- Protected Variables inherited from QObject
QScopedPointer< QObjectDatad_ptr
 
- Static Protected Variables inherited from QObject
static const QMetaObject staticQtMetaObject
 

Detailed Description

Definition at line 93 of file qhttpnetworkreply_p.h.

Constructors and Destructors

◆ QHttpNetworkReply()

QHttpNetworkReply::QHttpNetworkReply ( const QUrl url = QUrl(),
QObject parent = 0 
)
explicit

Definition at line 57 of file qhttpnetworkreply.cpp.

58  : QObject(*new QHttpNetworkReplyPrivate(url), parent)
59 {
60 }
Q_INVOKABLE QObject(QObject *parent=0)
Constructs an object with parent object parent.
Definition: qobject.cpp:753

◆ ~QHttpNetworkReply()

QHttpNetworkReply::~QHttpNetworkReply ( )
virtual

Definition at line 62 of file qhttpnetworkreply.cpp.

63 {
65  if (d->connection) {
66  d->connection->d_func()->removeReply(this);
67  }
68 }
double d
Definition: qnumeric_p.h:62
#define Q_D(Class)
Definition: qglobal.h:2482

Functions

◆ authenticationRequired

void QHttpNetworkReply::authenticationRequired ( const QHttpNetworkRequest request,
QAuthenticator authenticator 
)
signal

◆ bytesAvailable()

qint64 QHttpNetworkReply::bytesAvailable ( ) const

Definition at line 162 of file qhttpnetworkreply.cpp.

163 {
164  Q_D(const QHttpNetworkReply);
165  if (d->connection)
166  return d->connection->d_func()->uncompressedBytesAvailable(*this);
167  else
168  return -1;
169 }
double d
Definition: qnumeric_p.h:62
#define Q_D(Class)
Definition: qglobal.h:2482

◆ bytesAvailableNextBlock()

qint64 QHttpNetworkReply::bytesAvailableNextBlock ( ) const

Definition at line 171 of file qhttpnetworkreply.cpp.

172 {
173  Q_D(const QHttpNetworkReply);
174  if (d->connection)
175  return d->connection->d_func()->uncompressedBytesAvailableNextBlock(*this);
176  else
177  return -1;
178 }
double d
Definition: qnumeric_p.h:62
#define Q_D(Class)
Definition: qglobal.h:2482

◆ cacheCredentials

void QHttpNetworkReply::cacheCredentials ( const QHttpNetworkRequest request,
QAuthenticator authenticator 
)
signal

◆ connection()

QHttpNetworkConnection * QHttpNetworkReply::connection ( )

◆ contentLength()

qint64 QHttpNetworkReply::contentLength ( ) const
virtual

Implements QHttpNetworkHeader.

Definition at line 80 of file qhttpnetworkreply.cpp.

Referenced by QHttpNetworkConnectionChannel::_q_error(), QHttpThreadDelegate::headerChangedSlot(), and QHttpThreadDelegate::synchronousHeaderChangedSlot().

81 {
82  return d_func()->contentLength();
83 }

◆ dataReadProgress

void QHttpNetworkReply::dataReadProgress ( int  done,
int  total 
)
signal

◆ dataSendProgress

void QHttpNetworkReply::dataSendProgress ( qint64  done,
qint64  total 
)
signal

◆ errorString()

QString QHttpNetworkReply::errorString ( ) const

◆ finished

void QHttpNetworkReply::finished ( )
signal

◆ finishedWithError

void QHttpNetworkReply::finishedWithError ( QNetworkReply::NetworkError  errorCode,
const QString detail = QString() 
)
signal

◆ header()

QList< QPair< QByteArray, QByteArray > > QHttpNetworkReply::header ( ) const
virtual

◆ headerChanged

void QHttpNetworkReply::headerChanged ( )
signal

◆ headerField()

QByteArray QHttpNetworkReply::headerField ( const QByteArray name,
const QByteArray defaultValue = QByteArray() 
) const
virtual

Implements QHttpNetworkHeader.

Definition at line 96 of file qhttpnetworkreply.cpp.

Referenced by QHttpNetworkConnectionChannel::detectPipeliningSupport().

97 {
98  return d_func()->headerField(name, defaultValue);
99 }

◆ ignoreSslErrors() [1/2]

void QHttpNetworkReply::ignoreSslErrors ( )

Definition at line 983 of file qhttpnetworkreply.cpp.

Referenced by QHttpThreadDelegate::sslErrorsSlot().

984 {
986  if (d->connection)
987  d->connection->ignoreSslErrors();
988 }
double d
Definition: qnumeric_p.h:62
#define Q_D(Class)
Definition: qglobal.h:2482

◆ ignoreSslErrors() [2/2]

void QHttpNetworkReply::ignoreSslErrors ( const QList< QSslError > &  errors)

Definition at line 990 of file qhttpnetworkreply.cpp.

991 {
993  if (d->connection)
994  d->connection->ignoreSslErrors(errors);
995 }
double d
Definition: qnumeric_p.h:62
#define Q_D(Class)
Definition: qglobal.h:2482

◆ isFinished()

bool QHttpNetworkReply::isFinished ( ) const

◆ isPipeliningUsed()

bool QHttpNetworkReply::isPipeliningUsed ( ) const

Definition at line 253 of file qhttpnetworkreply.cpp.

Referenced by QHttpThreadDelegate::headerChangedSlot(), and QHttpThreadDelegate::synchronousHeaderChangedSlot().

254 {
255  return d_func()->pipeliningUsed;
256 }

◆ majorVersion()

int QHttpNetworkReply::majorVersion ( ) const
virtual

Implements QHttpNetworkHeader.

Definition at line 152 of file qhttpnetworkreply.cpp.

Referenced by QHttpNetworkConnectionChannel::detectPipeliningSupport().

153 {
154  return d_func()->majorVersion;
155 }

◆ minorVersion()

int QHttpNetworkReply::minorVersion ( ) const
virtual

Implements QHttpNetworkHeader.

Definition at line 157 of file qhttpnetworkreply.cpp.

Referenced by QHttpNetworkConnectionChannel::detectPipeliningSupport().

158 {
159  return d_func()->minorVersion;
160 }

◆ parseHeader()

void QHttpNetworkReply::parseHeader ( const QByteArray header)

Definition at line 107 of file qhttpnetworkreply.cpp.

108 {
110  d->parseHeader(header);
111 }
double d
Definition: qnumeric_p.h:62
#define Q_D(Class)
Definition: qglobal.h:2482

◆ proxyAuthenticationRequired

void QHttpNetworkReply::proxyAuthenticationRequired ( const QNetworkProxy proxy,
QAuthenticator authenticator 
)
signal

◆ read()

QByteArray QHttpNetworkReply::read ( qint64  amount)

Definition at line 204 of file qhttpnetworkreply.cpp.

Referenced by QHttpThreadDelegate::readyReadSlot().

205 {
207  return d->responseData.read(amount);
208 }
double d
Definition: qnumeric_p.h:62
#define Q_D(Class)
Definition: qglobal.h:2482

◆ readAll()

QByteArray QHttpNetworkReply::readAll ( )

Definition at line 198 of file qhttpnetworkreply.cpp.

Referenced by QHttpThreadDelegate::synchronousFinishedSlot().

199 {
201  return d->responseData.readAll();
202 }
double d
Definition: qnumeric_p.h:62
#define Q_D(Class)
Definition: qglobal.h:2482

◆ readAny()

QByteArray QHttpNetworkReply::readAny ( )

Definition at line 186 of file qhttpnetworkreply.cpp.

Referenced by QHttpThreadDelegate::finishedSlot(), and QHttpThreadDelegate::readyReadSlot().

187 {
189  if (d->responseData.bufferCount() == 0)
190  return QByteArray();
191 
192  // we'll take the last buffer, so schedule another read from http
193  if (d->downstreamLimited && d->responseData.bufferCount() == 1)
194  d->connection->d_func()->readMoreLater(this);
195  return d->responseData.read();
196 }
double d
Definition: qnumeric_p.h:62
The QByteArray class provides an array of bytes.
Definition: qbytearray.h:135
#define Q_D(Class)
Definition: qglobal.h:2482

◆ readAnyAvailable()

bool QHttpNetworkReply::readAnyAvailable ( ) const

Definition at line 180 of file qhttpnetworkreply.cpp.

Referenced by QHttpThreadDelegate::finishedSlot(), and QHttpThreadDelegate::readyReadSlot().

181 {
182  Q_D(const QHttpNetworkReply);
183  return (d->responseData.bufferCount() > 0);
184 }
double d
Definition: qnumeric_p.h:62
#define Q_D(Class)
Definition: qglobal.h:2482

◆ readyRead

void QHttpNetworkReply::readyRead ( )
signal

◆ reasonPhrase()

QString QHttpNetworkReply::reasonPhrase ( ) const

◆ request()

QHttpNetworkRequest QHttpNetworkReply::request ( ) const

Definition at line 113 of file qhttpnetworkreply.cpp.

Referenced by QHttpNetworkConnectionPrivate::handleAuthenticateChallenge(), and setRequest().

114 {
115  return d_func()->request;
116 }

◆ setContentLength()

void QHttpNetworkReply::setContentLength ( qint64  length)
virtual

Implements QHttpNetworkHeader.

Definition at line 85 of file qhttpnetworkreply.cpp.

86 {
88  d->setContentLength(length);
89 }
double d
Definition: qnumeric_p.h:62
#define Q_D(Class)
Definition: qglobal.h:2482

◆ setDownstreamLimited()

void QHttpNetworkReply::setDownstreamLimited ( bool  t)

Definition at line 216 of file qhttpnetworkreply.cpp.

Referenced by QHttpThreadDelegate::readBufferSizeChanged().

217 {
219  d->downstreamLimited = dsl;
220  d->connection->d_func()->readMoreLater(this);
221 }
double d
Definition: qnumeric_p.h:62
#define Q_D(Class)
Definition: qglobal.h:2482

◆ setErrorString()

void QHttpNetworkReply::setErrorString ( const QString error)

Definition at line 146 of file qhttpnetworkreply.cpp.

147 {
149  d->errorString = error;
150 }
double d
Definition: qnumeric_p.h:62
#define error(msg)
#define Q_D(Class)
Definition: qglobal.h:2482

◆ setHeaderField()

void QHttpNetworkReply::setHeaderField ( const QByteArray name,
const QByteArray data 
)
virtual

Implements QHttpNetworkHeader.

Definition at line 101 of file qhttpnetworkreply.cpp.

102 {
104  d->setHeaderField(name, data);
105 }
double d
Definition: qnumeric_p.h:62
#define Q_D(Class)
Definition: qglobal.h:2482

◆ setReadBufferSize()

void QHttpNetworkReply::setReadBufferSize ( qint64  size)

Definition at line 223 of file qhttpnetworkreply.cpp.

Referenced by QHttpNetworkConnectionChannel::_q_error(), and QHttpThreadDelegate::readBufferSizeChanged().

224 {
226  d->readBufferMaxSize = size;
227 }
double d
Definition: qnumeric_p.h:62
#define Q_D(Class)
Definition: qglobal.h:2482

◆ setRequest()

void QHttpNetworkReply::setRequest ( const QHttpNetworkRequest request)

Definition at line 118 of file qhttpnetworkreply.cpp.

Referenced by QHttpNetworkConnectionPrivate::queueRequest().

119 {
121  d->request = request;
122  d->ssl = request.isSsl();
123 }
double d
Definition: qnumeric_p.h:62
QHttpNetworkRequest request() const
#define Q_D(Class)
Definition: qglobal.h:2482

◆ setSslConfiguration()

void QHttpNetworkReply::setSslConfiguration ( const QSslConfiguration config)

Definition at line 976 of file qhttpnetworkreply.cpp.

977 {
979  if (d->connection)
980  d->connection->setSslConfiguration(config);
981 }
double d
Definition: qnumeric_p.h:62
#define Q_D(Class)
Definition: qglobal.h:2482

◆ setStatusCode()

void QHttpNetworkReply::setStatusCode ( int  code)

Definition at line 130 of file qhttpnetworkreply.cpp.

131 {
133  d->statusCode = code;
134 }
double d
Definition: qnumeric_p.h:62
#define Q_D(Class)
Definition: qglobal.h:2482

◆ setUrl()

void QHttpNetworkReply::setUrl ( const QUrl url)
virtual

Implements QHttpNetworkHeader.

Definition at line 74 of file qhttpnetworkreply.cpp.

75 {
77  d->url = url;
78 }
double d
Definition: qnumeric_p.h:62
#define Q_D(Class)
Definition: qglobal.h:2482

◆ setUserProvidedDownloadBuffer()

void QHttpNetworkReply::setUserProvidedDownloadBuffer ( char *  b)

Definition at line 235 of file qhttpnetworkreply.cpp.

Referenced by QHttpThreadDelegate::headerChangedSlot().

236 {
239  d->userProvidedDownloadBuffer = b;
240 }
double d
Definition: qnumeric_p.h:62
bool supportsUserProvidedDownloadBuffer()
#define Q_D(Class)
Definition: qglobal.h:2482

◆ sizeNextBlock()

qint64 QHttpNetworkReply::sizeNextBlock ( )

Definition at line 210 of file qhttpnetworkreply.cpp.

Referenced by QHttpThreadDelegate::readyReadSlot(), and QHttpNetworkConnectionPrivate::uncompressedBytesAvailableNextBlock().

211 {
213  return d->responseData.sizeNextBlock();
214 }
double d
Definition: qnumeric_p.h:62
#define Q_D(Class)
Definition: qglobal.h:2482

◆ sslConfiguration()

QSslConfiguration QHttpNetworkReply::sslConfiguration ( ) const

Definition at line 962 of file qhttpnetworkreply.cpp.

Referenced by QHttpThreadDelegate::finishedSlot(), QHttpThreadDelegate::finishedWithErrorSlot(), QHttpThreadDelegate::headerChangedSlot(), and QHttpThreadDelegate::sslErrorsSlot().

963 {
964  Q_D(const QHttpNetworkReply);
965 
966  if (!d->connectionChannel)
967  return QSslConfiguration();
968 
969  QSslSocket *sslSocket = qobject_cast<QSslSocket*>(d->connectionChannel->socket);
970  if (!sslSocket)
971  return QSslConfiguration();
972 
973  return sslSocket->sslConfiguration();
974 }
double d
Definition: qnumeric_p.h:62
QSslConfiguration sslConfiguration() const
Returns the socket&#39;s SSL configuration state.
Definition: qsslsocket.cpp:920
The QSslSocket class provides an SSL encrypted socket for both clients and servers.
Definition: qsslsocket.h:67
T * qobject_cast(QObject *object)
Definition: qobject.h:375
#define Q_D(Class)
Definition: qglobal.h:2482
The QSslConfiguration class holds the configuration and state of an SSL connection.

◆ sslErrors

void QHttpNetworkReply::sslErrors ( const QList< QSslError > &  errors)
signal

◆ statusCode()

int QHttpNetworkReply::statusCode ( ) const

◆ supportsUserProvidedDownloadBuffer()

bool QHttpNetworkReply::supportsUserProvidedDownloadBuffer ( )

Definition at line 229 of file qhttpnetworkreply.cpp.

Referenced by QHttpThreadDelegate::headerChangedSlot(), and setUserProvidedDownloadBuffer().

230 {
232  return (!d->isChunked() && !d->autoDecompress && d->bodyLength > 0);
233 }
double d
Definition: qnumeric_p.h:62
#define Q_D(Class)
Definition: qglobal.h:2482

◆ url()

QUrl QHttpNetworkReply::url ( ) const
virtual

Implements QHttpNetworkHeader.

Definition at line 70 of file qhttpnetworkreply.cpp.

Referenced by setUrl().

71 {
72  return d_func()->url;
73 }

◆ userProvidedDownloadBuffer()

char * QHttpNetworkReply::userProvidedDownloadBuffer ( )

Definition at line 242 of file qhttpnetworkreply.cpp.

243 {
245  return d->userProvidedDownloadBuffer;
246 }
double d
Definition: qnumeric_p.h:62
#define Q_D(Class)
Definition: qglobal.h:2482

Friends and Related Functions

◆ QHttpNetworkConnection

Definition at line 171 of file qhttpnetworkreply_p.h.

◆ QHttpNetworkConnectionChannel

Definition at line 173 of file qhttpnetworkreply_p.h.

◆ QHttpNetworkConnectionPrivate

Definition at line 172 of file qhttpnetworkreply_p.h.


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