QtBase  v6.3.1
Public Member Functions | List of all members
QNetworkReplyImpl Class Reference

#include <qnetworkreplyimpl_p.h>

Inheritance diagram for QNetworkReplyImpl:
Inheritance graph
[legend]
Collaboration diagram for QNetworkReplyImpl:
Collaboration graph
[legend]

Public Member Functions

 QNetworkReplyImpl (QObject *parent=nullptr)
 
 ~QNetworkReplyImpl ()
 
virtual void abort () override
 
virtual void close () override
 
virtual qint64 bytesAvailable () const override
 
virtual void setReadBufferSize (qint64 size) override
 
virtual qint64 readData (char *data, qint64 maxlen) override
 
virtual bool event (QEvent *) override
 
 Q_PRIVATE_SLOT (d_func(), void _q_startOperation()) Q_PRIVATE_SLOT(d_func()
 
void _q_copyReadyRead ()) Q_PRIVATE_SLOT(d_func()
 
void void _q_copyReadChannelFinished ()) Q_PRIVATE_SLOT(d_func()
 
void void void _q_bufferOutgoingData ()) Q_PRIVATE_SLOT(d_func()
 
void void void void _q_bufferOutgoingDataFinished()) protected void setSslConfigurationImplementation (const QSslConfiguration &configuration) override
 
virtual void ignoreSslErrors () override
 
virtual void ignoreSslErrorsImplementation (const QList< QSslError > &errors) override
 
- Public Member Functions inherited from QNetworkReply
 ~QNetworkReply ()
 
virtual bool isSequential () const override
 
qint64 readBufferSize () const
 
QNetworkAccessManagermanager () const
 
QNetworkAccessManager::Operation operation () const
 
QNetworkRequest request () const
 
NetworkError error () const
 
bool isFinished () const
 
bool isRunning () const
 
QUrl url () const
 
QVariant header (QNetworkRequest::KnownHeaders header) const
 
bool hasRawHeader (const QByteArray &headerName) const
 
QList< QByteArrayrawHeaderList () const
 
QByteArray rawHeader (const QByteArray &headerName) const
 
const QList< RawHeaderPair > & rawHeaderPairs () const
 
QVariant attribute (QNetworkRequest::Attribute code) const
 
- Public Member Functions inherited from QIODevice
 QIODevice ()
 
 QIODevice (QObject *parent)
 
virtual ~QIODevice ()
 
QIODeviceBase::OpenMode openMode () const
 
void setTextModeEnabled (bool enabled)
 
bool isTextModeEnabled () const
 
bool isOpen () const
 
bool isReadable () const
 
bool isWritable () const
 
int readChannelCount () const
 
int writeChannelCount () const
 
int currentReadChannel () const
 
void setCurrentReadChannel (int channel)
 
int currentWriteChannel () const
 
void setCurrentWriteChannel (int channel)
 
virtual bool open (QIODeviceBase::OpenMode mode)
 
virtual qint64 pos () const
 
virtual qint64 size () const
 
virtual bool seek (qint64 pos)
 
virtual bool atEnd () const
 
virtual bool reset ()
 
virtual qint64 bytesToWrite () const
 
qint64 read (char *data, qint64 maxlen)
 
QByteArray read (qint64 maxlen)
 
QByteArray readAll ()
 
qint64 readLine (char *data, qint64 maxlen)
 
QByteArray readLine (qint64 maxlen=0)
 
virtual bool canReadLine () const
 
void startTransaction ()
 
void commitTransaction ()
 
void rollbackTransaction ()
 
bool isTransactionStarted () const
 
qint64 write (const char *data, qint64 len)
 
qint64 write (const char *data)
 
qint64 write (const QByteArray &data)
 
qint64 peek (char *data, qint64 maxlen)
 
QByteArray peek (qint64 maxlen)
 
qint64 skip (qint64 maxSize)
 
virtual bool waitForReadyRead (int msecs)
 
virtual bool waitForBytesWritten (int msecs)
 
void ungetChar (char c)
 
bool putChar (char c)
 
bool getChar (char *c)
 
QString errorString () const
 
- Public Member Functions inherited from QObject
Q_INVOKABLE QObject (QObject *parent=nullptr)
 
virtual ~QObject ()
 
virtual bool eventFilter (QObject *watched, QEvent *event)
 
QString objectName () const
 
void setObjectName (const QString &name)
 
QBindable< QStringbindableObjectName ()
 
bool isWidgetType () const
 
bool isWindowType () const
 
bool signalsBlocked () const noexcept
 
bool blockSignals (bool b) noexcept
 
QThreadthread () const
 
void moveToThread (QThread *thread)
 
int startTimer (int interval, Qt::TimerType timerType=Qt::CoarseTimer)
 
void killTimer (int id)
 
template<typename T >
T findChild (const QString &aName=QString(), Qt::FindChildOptions options=Qt::FindChildrenRecursively) const
 
template<typename T >
QList< TfindChildren (const QString &aName, Qt::FindChildOptions options=Qt::FindChildrenRecursively) const
 
template<typename T >
QList< TfindChildren (Qt::FindChildOptions options=Qt::FindChildrenRecursively) const
 
const QObjectListchildren () const
 
void setParent (QObject *parent)
 
void installEventFilter (QObject *filterObj)
 
void removeEventFilter (QObject *obj)
 
QMetaObject::Connection connect (const QObject *sender, const char *signal, const char *member, Qt::ConnectionType type=Qt::AutoConnection) const
 
bool disconnect (const char *signal=nullptr, const QObject *receiver=nullptr, const char *member=nullptr) const
 
bool disconnect (const QObject *receiver, const char *member=nullptr) const
 
void dumpObjectTree () const
 
void dumpObjectInfo () const
 
bool setProperty (const char *name, const QVariant &value)
 
QVariant property (const char *name) const
 
QList< QByteArraydynamicPropertyNames () const
 
QBindingStoragebindingStorage ()
 
const QBindingStoragebindingStorage () const
 
QObjectparent () const
 
bool inherits (const char *classname) const
 

Additional Inherited Members

- Public Types inherited from QNetworkReply
enum  NetworkError {
  NoError = 0 , ConnectionRefusedError = 1 , RemoteHostClosedError , HostNotFoundError ,
  TimeoutError , OperationCanceledError , SslHandshakeFailedError , TemporaryNetworkFailureError ,
  NetworkSessionFailedError , BackgroundRequestNotAllowedError , TooManyRedirectsError , InsecureRedirectError ,
  UnknownNetworkError = 99 , ProxyConnectionRefusedError = 101 , ProxyConnectionClosedError , ProxyNotFoundError ,
  ProxyTimeoutError , ProxyAuthenticationRequiredError , UnknownProxyError = 199 , ContentAccessDenied = 201 ,
  ContentOperationNotPermittedError , ContentNotFoundError , AuthenticationRequiredError , ContentReSendError ,
  ContentConflictError , ContentGoneError , UnknownContentError = 299 , ProtocolUnknownError = 301 ,
  ProtocolInvalidOperationError , ProtocolFailure = 399 , InternalServerError = 401 , OperationNotImplementedError ,
  ServiceUnavailableError , UnknownServerError = 499
}
 
typedef QPair< QByteArray, QByteArrayRawHeaderPair
 
- Public Types inherited from QIODeviceBase
enum  OpenModeFlag {
  NotOpen = 0x0000 , ReadOnly = 0x0001 , WriteOnly = 0x0002 , ReadWrite = ReadOnly | WriteOnly ,
  Append = 0x0004 , Truncate = 0x0008 , Text = 0x0010 , Unbuffered = 0x0020 ,
  NewOnly = 0x0040 , ExistingOnly = 0x0080
}
 
- Public Slots inherited from QNetworkReply
- Public Slots inherited from QObject
void deleteLater ()
 
- Signals inherited from QNetworkReply
void socketStartedConnecting ()
 
void requestSent ()
 
void metaDataChanged ()
 
void finished ()
 
void errorOccurred (QNetworkReply::NetworkError)
 
void redirected (const QUrl &url)
 
void redirectAllowed ()
 
void uploadProgress (qint64 bytesSent, qint64 bytesTotal)
 
void downloadProgress (qint64 bytesReceived, qint64 bytesTotal)
 
- Signals inherited from QIODevice
void readyRead ()
 
void channelReadyRead (int channel)
 
void bytesWritten (qint64 bytes)
 
void channelBytesWritten (int channel, qint64 bytes)
 
void aboutToClose ()
 
void readChannelFinished ()
 
- Signals inherited from QObject
void destroyed (QObject *=nullptr)
 
void objectNameChanged (const QString &objectName, QPrivateSignal)
 
- Static Public Member Functions inherited from QObject
static QMetaObject::Connection connect (const QObject *sender, const char *signal, const QObject *receiver, const char *member, Qt::ConnectionType=Qt::AutoConnection)
 
static QMetaObject::Connection connect (const QObject *sender, const QMetaMethod &signal, const QObject *receiver, const QMetaMethod &method, Qt::ConnectionType type=Qt::AutoConnection)
 
template<typename Func1 , typename Func2 >
static QMetaObject::Connection connect (const typename QtPrivate::FunctionPointer< Func1 >::Object *sender, Func1 signal, const typename QtPrivate::FunctionPointer< Func2 >::Object *receiver, Func2 slot, Qt::ConnectionType type=Qt::AutoConnection)
 
static QMetaObject::Connection ::type connect (const typename QtPrivate::FunctionPointer< Func1 >::Object *sender, Func1 signal, Func2 slot)
 
static QMetaObject::Connection ::type connect (const typename QtPrivate::FunctionPointer< Func1 >::Object *sender, Func1 signal, const QObject *context, Func2 slot, Qt::ConnectionType type=Qt::AutoConnection)
 
template<typename Func1 , typename Func2 >
static std::enable_if< QtPrivate::FunctionPointer< Func2 >::ArgumentCount==-1 &&!std::is_convertible_v< Func2, const char * >, QMetaObject::Connection >::type connect (const typename QtPrivate::FunctionPointer< Func1 >::Object *sender, Func1 signal, Func2 slot)
 
template<typename Func1 , typename Func2 >
static std::enable_if< QtPrivate::FunctionPointer< Func2 >::ArgumentCount==-1 &&!std::is_convertible_v< Func2, const char * >, QMetaObject::Connection >::type connect (const typename QtPrivate::FunctionPointer< Func1 >::Object *sender, Func1 signal, const QObject *context, Func2 slot, Qt::ConnectionType type=Qt::AutoConnection)
 
static bool disconnect (const QObject *sender, const char *signal, const QObject *receiver, const char *member)
 
static bool disconnect (const QObject *sender, const QMetaMethod &signal, const QObject *receiver, const QMetaMethod &member)
 
static bool disconnect (const QMetaObject::Connection &)
 
template<typename Func1 , typename Func2 >
static bool disconnect (const typename QtPrivate::FunctionPointer< Func1 >::Object *sender, Func1 signal, const typename QtPrivate::FunctionPointer< Func2 >::Object *receiver, Func2 slot)
 
template<typename Func1 >
static bool disconnect (const typename QtPrivate::FunctionPointer< Func1 >::Object *sender, Func1 signal, const QObject *receiver, void **zero)
 
- Protected Member Functions inherited from QNetworkReply
 QNetworkReply (QObject *parent=nullptr)
 
 QNetworkReply (QNetworkReplyPrivate &dd, QObject *parent)
 
virtual qint64 writeData (const char *data, qint64 len) override
 
void setOperation (QNetworkAccessManager::Operation operation)
 
void setRequest (const QNetworkRequest &request)
 
void setError (NetworkError errorCode, const QString &errorString)
 
void setFinished (bool)
 
void setUrl (const QUrl &url)
 
void setHeader (QNetworkRequest::KnownHeaders header, const QVariant &value)
 
void setRawHeader (const QByteArray &headerName, const QByteArray &value)
 
void setAttribute (QNetworkRequest::Attribute code, const QVariant &value)
 
- Protected Member Functions inherited from QIODevice
 QIODevice (QIODevicePrivate &dd, QObject *parent=nullptr)
 
virtual qint64 readLineData (char *data, qint64 maxlen)
 
virtual qint64 skipData (qint64 maxSize)
 
void setOpenMode (QIODeviceBase::OpenMode openMode)
 
void setErrorString (const QString &errorString)
 
- Protected Member Functions inherited from QObject
QObjectsender () const
 
int senderSignalIndex () const
 
int receivers (const char *signal) const
 
bool isSignalConnected (const QMetaMethod &signal) const
 
virtual void timerEvent (QTimerEvent *event)
 
virtual void childEvent (QChildEvent *event)
 
virtual void customEvent (QEvent *event)
 
virtual void connectNotify (const QMetaMethod &signal)
 
virtual void disconnectNotify (const QMetaMethod &signal)
 
 QObject (QObjectPrivate &dd, QObject *parent=nullptr)
 
- Protected Member Functions inherited from QIODeviceBase
 ~QIODeviceBase ()=default
 
- Protected Attributes inherited from QObject
QScopedPointer< QObjectDatad_ptr
 
- Properties inherited from QObject
QString objectName
 the name of this object More...
 

Detailed Description

Definition at line 74 of file qnetworkreplyimpl_p.h.

Constructor & Destructor Documentation

◆ QNetworkReplyImpl()

QNetworkReplyImpl::QNetworkReplyImpl ( QObject parent = nullptr)

Definition at line 756 of file qnetworkreplyimpl.cpp.

◆ ~QNetworkReplyImpl()

QNetworkReplyImpl::~QNetworkReplyImpl ( )

Definition at line 761 of file qnetworkreplyimpl.cpp.

Here is the call graph for this function:

Member Function Documentation

◆ _q_bufferOutgoingData()

void void void QNetworkReplyImpl::_q_bufferOutgoingData ( )

◆ _q_copyReadChannelFinished()

void void QNetworkReplyImpl::_q_copyReadChannelFinished ( )

◆ _q_copyReadyRead()

void QNetworkReplyImpl::_q_copyReadyRead ( )

◆ abort()

void QNetworkReplyImpl::abort ( )
overridevirtual

Aborts the operation immediately and close down any network connections still open. Uploads still in progress are also aborted.

The finished() signal will also be emitted.

See also
close(), finished()

Implements QNetworkReply.

Definition at line 772 of file qnetworkreplyimpl.cpp.

Here is the call graph for this function:

◆ bytesAvailable()

qint64 QNetworkReplyImpl::bytesAvailable ( ) const
overridevirtual

Returns the number of bytes available for reading with QIODevice::read(). The number of bytes available may grow until the finished() signal is emitted.

Reimplemented from QIODevice.

Definition at line 823 of file qnetworkreplyimpl.cpp.

Here is the call graph for this function:

◆ close()

void QNetworkReplyImpl::close ( )
overridevirtual

Closes this device for reading. Unread data is discarded, but the network resources are not discarded until they are finished. In particular, if any upload is in progress, it will continue until it is done.

The finished() signal is emitted when all operations are over and the network resources are freed.

See also
abort(), finished()

Reimplemented from QNetworkReply.

Definition at line 798 of file qnetworkreplyimpl.cpp.

Here is the call graph for this function:

◆ event()

bool QNetworkReplyImpl::event ( QEvent e)
overridevirtual

This virtual function receives events to an object and should return true if the event e was recognized and processed.

The event() function can be reimplemented to customize the behavior of an object.

Make sure you call the parent event class implementation for all the events you did not handle.

Example:

See also
installEventFilter(), timerEvent(), QCoreApplication::sendEvent(), QCoreApplication::postEvent()

Reimplemented from QObject.

Definition at line 932 of file qnetworkreplyimpl.cpp.

Here is the call graph for this function:

◆ ignoreSslErrors()

void QNetworkReplyImpl::ignoreSslErrors ( )
overridevirtual

If this function is called, SSL errors related to network connection will be ignored, including certificate validation errors.

Warning
Be sure to always let the user inspect the errors reported by the sslErrors() signal, and only call this method upon confirmation from the user that proceeding is ok. If there are unexpected errors, the reply should be aborted. Calling this method without inspecting the actual errors will most likely pose a security risk for your application. Use it with great care!

This function can be called from the slot connected to the sslErrors() signal, which indicates which errors were found.

Note
If HTTP Strict Transport Security is enabled for QNetworkAccessManager, this function has no effect.
See also
sslConfiguration(), sslErrors(), QSslSocket::ignoreSslErrors()

Reimplemented from QNetworkReply.

Definition at line 858 of file qnetworkreplyimpl.cpp.

◆ ignoreSslErrorsImplementation()

void QNetworkReplyImpl::ignoreSslErrorsImplementation ( const QList< QSslError > &  errors)
overridevirtual

Definition at line 865 of file qnetworkreplyimpl.cpp.

◆ Q_PRIVATE_SLOT()

QNetworkReplyImpl::Q_PRIVATE_SLOT ( d_func()  ,
void   _q_startOperation() 
)

◆ readData()

qint64 QNetworkReplyImpl::readData ( char *  data,
qint64  maxSize 
)
overridevirtual

Reads up to maxSize bytes from the device into data, and returns the number of bytes read or -1 if an error occurred.

If there are no bytes to be read and there can never be more bytes available (examples include socket closed, pipe closed, sub-process finished), this function returns -1.

This function is called by QIODevice. Reimplement this function when creating a subclass of QIODevice.

When reimplementing this function it is important that this function reads all the required data before returning. This is required in order for QDataStream to be able to operate on the class. QDataStream assumes all the requested information was read and therefore does not retry reading if there was a problem.

This function might be called with a maxSize of 0, which can be used to perform post-reading operations.

See also
read(), readLine(), writeData()

Implements QIODevice.

Definition at line 876 of file qnetworkreplyimpl.cpp.

Here is the call graph for this function:

◆ setReadBufferSize()

void QNetworkReplyImpl::setReadBufferSize ( qint64  size)
overridevirtual

Sets the size of the read buffer to be size bytes. The read buffer is the buffer that holds data that is being downloaded off the network, before it is read with QIODevice::read(). Setting the buffer size to 0 will make the buffer unlimited in size.

QNetworkReply will try to stop reading from the network once this buffer is full (i.e., bytesAvailable() returns size or more), thus causing the download to throttle down as well. If the buffer is not limited in size, QNetworkReply will try to download as fast as possible from the network.

Unlike QAbstractSocket::setReadBufferSize(), QNetworkReply cannot guarantee precision in the read buffer size. That is, bytesAvailable() can return more than size.

See also
readBufferSize()

Reimplemented from QNetworkReply.

Definition at line 834 of file qnetworkreplyimpl.cpp.

Here is the call graph for this function:

◆ setSslConfigurationImplementation()

void QNetworkReplyImpl::setSslConfigurationImplementation ( const QSslConfiguration configuration)
override

Definition at line 851 of file qnetworkreplyimpl.cpp.


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