5#include <private/qhttpprotocolhandler_p.h>
6#include <private/qnoncontiguousbytedevice_p.h>
7#include <private/qhttpnetworkconnectionchannel_p.h>
24 qWarning() <<
"QAbstractProtocolHandler::_q_receiveReply() called without QHttpNetworkReply,"
33 if (!qobject_cast<QHttpNetworkConnection*>(
m_connection)) {
70 if (statusBytes == -1) {
82 if (headerBytes == -1) {
140 }
else if (haveRead == 0) {
142 }
else if (haveRead < 0) {
169 }
else if (haveRead == -1) {
190 }
while (bytes != lastBytes &&
m_reply);
229 qWarning(
"QAbstractProtocolHandler::sendRequest() called without QHttpNetworkReply");
242 if (scheme ==
"preconnect-http"_L1 || scheme ==
"preconnect-https"_L1) {
255 replyPrivate->
clear();
281#ifndef QT_NO_NETWORKPROXY
291 if (uploadByteDevice) {
318 if (uploadByteDevice)
327 const qint64 socketBufferFill = 32*1024;
328 const qint64 socketWriteMaxSize = 16*1024;
333 const auto encryptedBytesToWrite = [sslSocket]() ->
qint64
338 const auto encryptedBytesToWrite = [](){
return qint64(0); };
348 qint64 currentReadSize = 0;
350 const char *readPointer = uploadByteDevice->
readPointer(desiredReadSize, currentReadSize);
352 if (currentReadSize == -1) {
356 }
else if (readPointer ==
nullptr || currentReadSize == 0) {
362 qWarning() <<
"QHttpProtocolHandler: Internal error in sendRequest. Expected to write at position" <<
m_channel->
written <<
"but read device is at" << uploadByteDevice->
pos();
369 currentWriteSize =
m_socket->
write(readPointer, currentReadSize);
373 m_header.
append(readPointer, currentReadSize);
374 currentWriteSize =
m_socket->
write(std::exchange(m_header, {}));
375 if (currentWriteSize != -1)
379 if (currentWriteSize == -1 || currentWriteSize != currentReadSize) {
404 if (uploadByteDevice) {
IOBluetoothL2CAPChannel * channel
QAbstractSocket * m_socket
QHttpNetworkReply * m_reply
QHttpNetworkConnectionChannel * m_channel
QHttpNetworkConnection * m_connection
SocketState
This enum describes the different states in which a socket can be.
qint64 bytesToWrite() const override
Returns the number of bytes that are waiting to be written.
qint64 bytesAvailable() const override
Returns the number of incoming bytes that are waiting to be read.
SocketState state() const
Returns the state of the socket.
SocketError error() const
Returns the type of error that last occurred.
The QAuthenticator class provides an authentication object.
QString user() const
Returns the user used for authentication.
void setPassword(const QString &password)
Sets the password used for authentication.
QString password() const
Returns the password used for authentication.
void setUser(const QString &user)
Sets the user used for authentication.
qsizetype size() const noexcept
Returns the number of bytes in this byte array.
bool isEmpty() const noexcept
Returns true if the byte array has size 0; otherwise returns false.
QByteArray & append(char c)
This is an overloaded member function, provided for convenience. It differs from the above function o...
bool isSocketReading() const
bool isSocketWaiting() const
void handleUnexpectedEOF()
QHttpNetworkReply * reply
QHttpNetworkRequest request
void _q_error(QAbstractSocket::SocketError)
QAuthenticator authenticator
void preConnectFinished()
QPointer< QHttpNetworkConnection > connection
qint64 readBodyVeryFast(QAbstractSocket *socket, char *b)
enum QHttpNetworkReplyPrivate::ReplyState state
char * userProvidedDownloadBuffer
QPointer< QHttpNetworkConnectionChannel > connectionChannel
qint64 readBodyFast(QAbstractSocket *socket, QByteDataBuffer *rb)
qint64 readBody(QAbstractSocket *socket, QByteDataBuffer *out)
void removeAutoDecompressHeader()
qint64 readHeader(QAbstractSocket *socket)
void clearHttpLayerInformation()
bool isCompressed() const
QByteDataBuffer responseData
void dataSendProgress(qint64 done, qint64 total)
void dataReadProgress(qint64 done, qint64 total)
static QByteArray header(const QHttpNetworkRequest &request, bool throughProxy)
void setUrl(const QUrl &url) override
bool withCredentials() const
QUrl url() const override
QNonContiguousByteDevice * uploadByteDevice() const
qint64 contentLength() const override
QHttpProtocolHandler(QHttpNetworkConnectionChannel *channel)
virtual bool sendRequest() override
virtual void _q_receiveReply() override
virtual void _q_readyRead() override
qint64 write(const char *data, qint64 len)
Writes at most maxSize bytes of data from data to the device.
qint64 peek(char *data, qint64 maxlen)
virtual const char * readPointer(qint64 maximumLength, qint64 &len)=0
Return a byte pointer for at most maximumLength bytes of that device.
virtual qint64 pos() const
virtual bool advanceReadPointer(qint64 amount)=0
will advance the internal read pointer by amount bytes.
static QMetaObject::Connection connect(const QObject *sender, const char *signal, const QObject *receiver, const char *member, Qt::ConnectionType=Qt::AutoConnection)
\threadsafe
static bool disconnect(const QObject *sender, const char *signal, const QObject *receiver, const char *member)
\threadsafe
The QSslSocket class provides an SSL encrypted socket for both clients and servers.
qint64 encryptedBytesToWrite() const
\macro QT_RESTRICTED_CAST_FROM_ASCII
bool isEmpty() const
Returns true if the string has no characters; otherwise returns false.
QString userInfo(ComponentFormattingOptions options=PrettyDecoded) const
Returns the user info of the URL, or an empty string if the user info is undefined.
QString userName(ComponentFormattingOptions options=FullyDecoded) const
Returns the user name of the URL if it is defined; otherwise an empty string is returned.
QString password(ComponentFormattingOptions=FullyDecoded) const
Returns the password of the URL if it is defined; otherwise an empty string is returned.
QString scheme() const
Returns the scheme of the URL.
void setUserInfo(const QString &userInfo, ParsingMode mode=TolerantMode)
Sets the user info of the URL to userInfo.
Combined button and popup list for selecting options.
static const qint64 headerSize
constexpr const T & qMin(const T &a, const T &b)
QUrl url("example.com")
[constructor-url-reference]