44 #include <qplatformdefs.h> 48 # include "private/qobject_p.h" 57 # include "private/qringbuffer_p.h" 100 : socket(0), reconnectAttempts(2),
101 deleteSocket(0), state(
QHttp::Unconnected),
103 toDevice(0), postDevice(0), bytesDone(0), chunkedSize(-1),
104 repost(false), pendingPost(false)
110 while (!pending.isEmpty())
111 delete pending.takeFirst();
118 void _q_startNextRequest();
119 void _q_slotReadyRead();
120 void _q_slotConnected();
122 void _q_slotClosed();
123 void _q_slotBytesWritten(
qint64 numBytes);
124 #ifndef QT_NO_OPENSSL 125 void _q_slotEncryptedBytesWritten(
qint64 numBytes);
127 void _q_slotDoFinished();
128 void _q_slotSendRequest();
129 void _q_continuePost();
133 void finishedWithSuccess();
134 void finishedWithError(
const QString &detail,
int errorCode);
172 #ifndef QT_NO_NETWORKPROXY 246 if (!http->d_func()->socket)
247 http->d_func()->setSock(0);
248 http->d_func()->header = header;
251 http->d_func()->buffer = *
data.ba;
252 if (http->d_func()->buffer.size() >= 0)
253 http->d_func()->header.setContentLength(http->d_func()->buffer.size());
255 http->d_func()->postDevice = 0;
260 http->d_func()->postDevice =
data.dev;
261 if (http->d_func()->postDevice->size() >= 0)
262 http->d_func()->header.setContentLength(http->d_func()->postDevice->size());
264 http->d_func()->postDevice = 0;
269 http->d_func()->toDevice = to;
271 http->d_func()->toDevice = 0;
273 http->d_func()->reconnectAttempts = 2;
274 http->d_func()->_q_slotSendRequest();
328 if (http->d_func()->port && http->d_func()->port != 80)
345 : hostName(h), port(p), mode(m)
363 http->d_func()->hostName = hostName;
364 http->d_func()->port = port;
365 http->d_func()->mode = mode;
376 http->d_func()->finishedWithSuccess();
389 user(userName), pass(password)
406 http->d_func()->authenticator.
setUser(user);
407 http->d_func()->authenticator.setPassword(pass);
408 http->d_func()->finishedWithSuccess();
411 #ifndef QT_NO_NETWORKPROXY 429 http->d_func()->proxy = proxy;
432 http->d_func()->proxyAuthenticator.
setUser(user);
435 http->d_func()->proxyAuthenticator.setPassword(password);
436 http->d_func()->finishedWithSuccess();
447 #endif // QT_NO_NETWORKPROXY 474 http->d_func()->setSock(socket);
475 http->d_func()->finishedWithSuccess();
499 http->d_func()->closeConn();
594 d->valid = header.d_func()->valid;
595 d->values = header.d_func()->
values;
634 d->valid = header.d_func()->valid;
635 d->values = header.d_func()->
values;
650 d->values = h.d_func()->
values;
651 d->valid = h.d_func()->valid;
694 for (; it != lst.
end(); ++
it) {
695 if (!(*it).isEmpty()) {
696 if ((*it)[0].isSpace()) {
709 for (; it != lines.
end(); ++
it) {
737 while (it !=
d->values.constEnd()) {
738 if ((*it).first.toLower() == lowercaseKey)
755 while (it !=
d->values.constEnd()) {
756 if ((*it).first.toLower() == lowercaseKey)
757 valueList.
append((*it).second);
774 while (it !=
d->values.constEnd()) {
777 if (!seenKeys.
contains(lowercaseKey)) {
779 seenKeys.
insert(lowercaseKey);
797 while (it !=
d->values.constEnd()) {
798 if ((*it).first.toLower() == lowercaseKey)
820 while (it !=
d->values.end()) {
821 if ((*it).first.toLower() == lowercaseKey) {
822 (*it).second =
value;
868 while (it !=
d->values.end()) {
869 if ((*it).first.toLower() == lowercaseKey) {
885 while (it !=
d->values.end()) {
886 if ((*it).first.toLower() == lowercaseKey) {
887 it =
d->values.erase(it);
932 while (it !=
d->values.constEnd()) {
1068 d->statCode = header.d_func()->statCode;
1069 d->reasonPhr = header.d_func()->reasonPhr;
1070 d->majVer = header.d_func()->majVer;
1071 d->minVer = header.d_func()->minVer;
1081 d->statCode = header.d_func()->statCode;
1082 d->reasonPhr = header.d_func()->reasonPhr;
1083 d->majVer = header.d_func()->majVer;
1084 d->minVer = header.d_func()->minVer;
1136 d->reasonPhr =
text;
1137 d->majVer = majorVer;
1138 d->minVer = minorVer;
1160 return d->reasonPhr;
1198 l[7].isDigit() && l[8] ==
QLatin1Char(
' ') && l[9].isDigit()) {
1204 d->reasonPhr = l.
mid(pos + 1);
1205 d->statCode = l.
mid(9, pos - 9).
toInt();
1208 d->reasonPhr.clear();
1297 d->majVer = majorVer;
1298 d->minVer = minorVer;
1308 d->m = header.d_func()->m;
1309 d->p = header.d_func()->p;
1310 d->majVer = header.d_func()->majVer;
1311 d->minVer = header.d_func()->minVer;
1321 d->m = header.d_func()->m;
1322 d->p = header.d_func()->p;
1323 d->majVer = header.d_func()->majVer;
1324 d->minVer = header.d_func()->minVer;
1355 d->majVer = majorVer;
1356 d->minVer = minorVer;
1412 if (lst.
count() > 0) {
1414 if (lst.
count() > 1) {
1416 if (lst.
count() > 2) {
1419 v[5].isDigit() && v[6] ==
QLatin1Char(
'.') && v[7].isDigit()) {
1580 d->hostName = hostName;
1602 d->hostName = hostName;
1829 #ifndef QT_NO_NETWORKPROXY 1897 if (
d->pending.isEmpty())
1900 d->finishedWithError(
tr(
"Request aborted"),
Aborted);
1916 #if defined(QHTTP_DEBUG) 1917 qDebug(
"QHttp::bytesAvailable(): %d bytes", (
int)
d->rba.size());
1936 if (data == 0 && maxlen != 0) {
1937 qWarning(
"QHttp::read: Null pointer error");
1940 if (maxlen >=
d->rba.size())
1941 maxlen =
d->rba.size();
1943 while (!
d->rba.isEmpty() && readSoFar < maxlen) {
1944 int nextBlockSize =
d->rba.nextDataBlockSize();
1945 int bytesToRead = qMin<qint64>(maxlen - readSoFar, nextBlockSize);
1946 memcpy(data + readSoFar,
d->rba.readPointer(), bytesToRead);
1947 d->rba.free(bytesToRead);
1948 readSoFar += bytesToRead;
1951 d->bytesDone += maxlen;
1952 #if defined(QHTTP_DEBUG) 1953 qDebug(
"QHttp::read(): read %lld bytes (%lld bytes done)", maxlen,
d->bytesDone);
1982 if (
d->pending.isEmpty())
1984 return d->pending.first()->id;
1998 if (!
d->pending.isEmpty()) {
2032 if (
d->pending.isEmpty())
2034 return d->pending.first()->sourceDevice();
2050 if (
d->pending.isEmpty())
2052 return d->pending.first()->destinationDevice();
2067 return d->pending.count() > 1;
2081 while (
d->pending.count() > 1)
2082 delete d->pending.takeLast();
2126 #ifdef QT_NO_OPENSSL 2128 qWarning(
"QHttp::setHost: HTTPS connection requested but SSL support not compiled in");
2182 #ifndef QT_NO_NETWORKPROXY 2445 qWarning(
"QHttp: empty path requested is invalid -- using '/'");
2451 return addRequest(static_cast<QHttpRequest *>(req));
2459 if (pending.
count() == 1) {
2476 if (q->bytesAvailable() != 0)
2478 emit q->requestStarted(r->
id);
2490 QString connectionHost = hostName;
2491 int connectionPort = port;
2492 bool sslInUse =
false;
2494 #ifndef QT_NO_OPENSSL 2500 #ifndef QT_NO_NETWORKPROXY 2501 bool cachingProxyInUse =
false;
2502 bool transparentProxyInUse =
false;
2510 cachingProxyInUse =
true;
2516 }
else if (sslInUse) {
2519 transparentProxyInUse =
true;
2522 cachingProxyInUse =
true;
2528 if (cachingProxyInUse) {
2532 if (port && port != 80)
2546 connectionPort = proxy.
port();
2549 if (transparentProxyInUse || sslInUse) {
2564 if (socket->
peerName() != connectionHost || socket->
peerPort() != connectionPort
2566 #ifndef QT_NO_OPENSSL 2575 #ifndef QT_NO_OPENSSL 2600 hasFinishedWithError =
false;
2602 emit q->requestFinished(r->
id,
false);
2603 if (hasFinishedWithError) {
2613 emit q->done(
false);
2615 _q_startNextRequest();
2625 hasFinishedWithError =
true;
2628 errorString = detail;
2633 emit q->requestFinished(r->
id,
true);
2638 emit q->done(hasFinishedWithError);
2648 if (bytesDone + q->bytesAvailable() != response.
contentLength()) {
2665 pendingPost =
false;
2667 _q_slotBytesWritten(0);
2679 bytesTotal = str.
length();
2681 #if defined(QHTTP_DEBUG) 2686 postDevice->
seek(0);
2687 bytesTotal += postDevice->
size();
2692 post100ContinueTimer.
start(2000);
2695 bytesTotal += buffer.
size();
2725 #ifndef QT_NO_NETWORKPROXY 2739 #ifndef QT_NO_OPENSSL 2750 bytesDone += written;
2751 emit q->dataSendProgress(bytesDone, bytesTotal);
2766 #ifndef QT_NO_OPENSSL 2773 int max = qMin<qint64>(4096, postDevice->
size() - postDevice->
pos());
2777 int n = postDevice->
read(arr.data(), max);
2779 qWarning(
"Could not read enough bytes from the device");
2783 if (postDevice->
atEnd()) {
2787 socket->
write(arr, n);
2804 while (readHeader) {
2820 #if defined(QHTTP_DEBUG) 2832 if (statusCode == 401 || statusCode == 407) {
2834 #ifndef QT_NO_NETWORKPROXY 2836 ? &proxyAuthenticator :
2845 #ifndef QT_NO_NETWORKPROXY 2846 if (statusCode == 407)
2847 emit q->proxyAuthenticationRequired(proxy, auth);
2850 emit q->authenticationRequired(hostName, port, auth);
2861 #ifndef QT_NO_NETWORKPROXY 2862 if (statusCode == 407)
2883 _q_slotSendRequest();
2893 if (response.
statusCode() == 100 && pendingPost) {
2895 post100ContinueTimer.
stop();
2904 post100ContinueTimer.
stop();
2905 pendingPost =
false;
2912 emit q->responseHeaderReceived(response);
2922 bool everythingRead =
false;
2924 if (q->currentRequest().method() ==
QLatin1String(
"HEAD") ||
2932 everythingRead =
true;
2936 if (chunkedSize != -1) {
2940 if (chunkedSize == 0) {
2948 chunkedSize = sizeString.
toInt(&ok, 16);
2956 if (chunkedSize == 0)
2961 while (chunkedSize == -2 && socket->
canReadLine()) {
2966 if (chunkedSize == -1) {
2967 everythingRead =
true;
2976 if (n == chunkedSize || n == chunkedSize+1) {
2977 n = chunkedSize - 1;
2983 qint64 toRead = chunkedSize < 0 ? n :
qMin(n, chunkedSize);
2987 arr->
resize(oldArrSize + toRead);
2989 arr->
resize(oldArrSize + read);
2991 chunkedSize -=
read;
2993 if (chunkedSize == 0 && n - read >= 2) {
2996 socket->
read(tmp, 2);
2997 if (tmp[0] !=
'\r' || tmp[1] !=
'\n') {
3019 if (bytesDone + q->bytesAvailable() + n == response.
contentLength())
3020 everythingRead =
true;
3027 if (arr && !repost) {
3031 bytesWritten = toDevice->
write(*arr, n);
3035 if (bytesWritten == -1 || bytesWritten < n) {
3038 bytesDone += bytesWritten;
3039 #if defined(QHTTP_DEBUG) 3040 qDebug(
"QHttp::_q_slotReadyRead(): read %lld bytes (%lld bytes done)", n, bytesDone);
3046 emit q->dataReadProgress(bytesDone, 0);
3049 memcpy(ptr, arr->
data(), arr->
size());
3052 #if defined(QHTTP_DEBUG) 3053 qDebug(
"QHttp::_q_slotReadyRead(): read %lld bytes (%lld bytes done)", n, bytesDone + q->bytesAvailable());
3056 emit q->dataReadProgress(bytesDone + q->bytesAvailable(), response.
contentLength());
3058 emit q->dataReadProgress(bytesDone + q->bytesAvailable(), 0);
3059 emit q->readyRead(response);
3066 if (everythingRead) {
3068 _q_slotSendRequest();
3086 finishedWithSuccess();
3089 finishedWithSuccess();
3128 return d->errorString;
3134 #if defined(QHTTP_DEBUG) 3138 emit q->stateChanged(s);
3152 if (!socket || !socket->
isOpen()) {
3171 deleteSocket = (sock == 0);
3174 #ifndef QT_NO_OPENSSL 3189 #ifndef QT_NO_NETWORKPROXY 3194 #ifndef QT_NO_OPENSSL 3195 if (qobject_cast<QSslSocket *>(socket)) {
3199 q,
SLOT(_q_slotEncryptedBytesWritten(
qint64)));
3213 #ifndef QT_NO_OPENSSL 3225 #include "moc_qhttp.cpp" static QString number(int, int base=10)
This is an overloaded member function, provided for convenience. It differs from the above function o...
QNetworkProxy::ProxyType type() const
Returns the proxy type for this instance.
QBool contains(QChar c, Qt::CaseSensitivity cs=Qt::CaseSensitive) const
QAuthenticator authenticator
QHttpPGHRequest(const QHttpRequestHeader &h, QByteArray *d, QIODevice *t)
void setSingleShot(bool singleShot)
int currentId() const
Returns the identifier of the HTTP request being executed or 0 if there is no request being executed ...
void _q_slotError(QAbstractSocket::SocketError)
QHttpSetSocketRequest(QTcpSocket *s)
void sslErrors(const QList< QSslError > &errors)
Forwards the sslErrors signal from the QSslSocket used in QHttp.
bool blockSignals(bool b)
If block is true, signals emitted by this object are blocked (i.e., emitting a signal will not invoke...
virtual qint64 size() const
For open random-access devices, this function returns the size of the device.
QString peerName() const
Returns the name of the peer as specified by connectToHost(), or an empty QString if connectToHost() ...
State
This enum is used to specify the state the client is in:
QHttpNormalRequest(const QHttpRequestHeader &h, QByteArray *d, QIODevice *t)
QIODevice * sourceDevice()
friend class QHttpSetUserRequest
QHttpResponseHeader response
ConnectionMode
This enum is used to specify the mode of connection to use:
Q_DECL_CONSTEXPR const T & qMin(const T &a, const T &b)
#define QT_END_NAMESPACE
This macro expands to.
static QString fromAscii(const char *, int size=-1)
Returns a QString initialized with the first size characters from the string str. ...
QHttpRequestHeader requestHeader()
char * data()
Returns a pointer to the data stored in the byte array.
const QChar at(int i) const
Returns the character at the given index position in the string.
QHttpSetUserRequest(const QString &userName, const QString &password)
qint64 bytesAvailable() const
Returns the number of incoming bytes that are waiting to be read.
qint64 bytesAvailable() const
Returns the number of bytes that can be read from the response content at the moment.
int toInt(bool *ok=0, int base=10) const
Returns the string converted to an int using base base, which is 10 by default and must be between 2 ...
void proxyAuthenticationRequired(const QNetworkProxy &proxy, QAuthenticator *)
#define it(className, varName)
QIODevice * destinationDevice()
virtual QHttpRequestHeader requestHeader()
qint64 encryptedBytesToWrite() const
Returns the number of encrypted bytes that are waiting to be written to the network.
void connectToHost(const QString &hostName, quint16 port, OpenMode mode=ReadWrite)
Attempts to make a connection to hostName on the given port.
void parseHttpResponse(const QHttpResponseHeader &, bool isProxy)
The QByteArray class provides an array of bytes.
bool hasFinishedWithError
QHttpSetHostRequest(const QString &h, quint16 p, QHttp::ConnectionMode m)
int length() const
Returns the number of characters in this string.
virtual QIODevice * destinationDevice()=0
void readyRead(const QHttpResponseHeader &resp)
This signal is emitted when there is new response data to read.
QString errorString() const
Returns a human-readable description of the last device error that occurred.
virtual qint64 pos() const
For random-access devices, this function returns the position that data is written to or read from...
The QSslSocket class provides an SSL encrypted socket for both clients and servers.
QIODevice * sourceDevice()
iterator begin()
Returns an STL-style iterator pointing to the first item in the list.
void _q_slotBytesWritten(qint64 numBytes)
quint16 peerPort() const
Returns the port of the connected peer if the socket is in ConnectedState; otherwise returns 0...
QHttp::ConnectionMode mode
#define QT_TRANSLATE_NOOP(scope, x)
Marks the string literal sourceText for dynamic translation in the given context; i...
static QString tr(const char *sourceText, const char *comment=0, int n=-1)
QLatin1String(DBUS_INTERFACE_DBUS))) Q_GLOBAL_STATIC_WITH_ARGS(QString
friend class QHttpSetSocketRequest
int count(const T &t) const
Returns the number of occurrences of value in the list.
QList< QHttpRequest * > pending
virtual QIODevice * sourceDevice()=0
void ignoreSslErrors(const QList< QSslError > &errors)
This method tells QSslSocket to ignore only the errors given in errors.
The QUrl class provides a convenient interface for working with URLs.
void abort()
Aborts the current connection and resets the socket.
The QString class provides a Unicode character string.
T * qobject_cast(QObject *object)
friend class QHttpNormalRequest
The QObject class is the base class of all Qt objects.
#define Q_BASIC_ATOMIC_INITIALIZER(a)
void setHost(const QString &host)
Sets the host of the URL to host.
QIODevice * destinationDevice()
virtual bool atEnd() const
Returns true if the current read and write position is at the end of the device (i.e.
static bool supportsSsl()
Returns true if this platform supports SSL; otherwise, returns false.
iterator Iterator
Qt-style synonym for QList::iterator.
bool isEmpty() const
Returns true if the list contains no items; otherwise returns false.
static QAuthenticatorPrivate * getPrivate(QAuthenticator &auth)
QIODevice * currentSourceDevice() const
Returns the QIODevice pointer that is used as the data source of the HTTP request being executed...
qint64 read(char *data, qint64 maxlen)
Reads at most maxSize bytes from the device into data, and returns the number of bytes read...
Q_CORE_EXPORT void qDebug(const char *,...)
QIODevice * currentDestinationDevice() const
Returns the QIODevice pointer that is used as to store the data of the HTTP request being executed...
static QNetworkProxy applicationProxy()
Returns the application level network proxying.
void _q_slotSendRequest()
int setProxy(const QString &host, int port, const QString &username=QString(), const QString &password=QString())
Enables HTTP proxy support, using the proxy server host on port port.
The QNetworkProxy class provides a network layer proxy.
void append(const T &t)
Inserts value at the end of the list.
char * reserve(int bytes)
QHttp(QObject *parent=0)
Constructs a QHttp object.
#define QT_BEGIN_NAMESPACE
This macro expands to.
static QIntfbScreen * connected
bool isOpen() const
Returns true if the device is open; otherwise returns false.
void truncate(int pos)
Truncates the string at the given position index.
friend class QHttpCloseRequest
QString left(int n) const Q_REQUIRED_RESULT
Returns a substring that contains the n leftmost characters of the string.
bool contains(const T &value) const
QString trimmed() const Q_REQUIRED_RESULT
Returns a string that has whitespace removed from the start and the end.
T takeFirst()
Removes the first item in the list and returns it.
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 rece...
bool isEmpty() const
Returns true if the string has no characters; otherwise returns false.
QHttp::ConnectionMode mode
QIODevice * destinationDevice()
iterator end()
Returns an STL-style iterator pointing to the imaginary item after the last item in the list...
QHttpSetProxyRequest(const QNetworkProxy &proxy)
QHttpRequestHeader currentRequest() const
Returns the request header of the HTTP request being executed.
QHttpResponseHeader lastResponse() const
Returns the received response header of the most recently finished HTTP request.
The QStringList class provides a list of strings.
SocketError
This enum describes the socket errors that can occur.
void connectToHostEncrypted(const QString &hostName, quint16 port, OpenMode mode=ReadWrite)
Starts an encrypted connection to the device hostName on port, using mode as the OpenMode ...
QHttpRequestHeader header
void setSock(QTcpSocket *sock)
void setRequestHeader(const QHttpRequestHeader &h)
Q_CORE_EXPORT void qWarning(const char *,...)
void finishedWithSuccess()
const_iterator insert(const T &value)
static const char * data(const QByteArray &arr)
int setSocket(QTcpSocket *socket)
Replaces the internal QTcpSocket that QHttp uses with socket.
int indexOf(QChar c, int from=0, Qt::CaseSensitivity cs=Qt::CaseSensitive) const
The QLatin1String class provides a thin wrapper around an US-ASCII/Latin-1 encoded string literal...
void removeFirst()
Removes the first item in the list.
int get(const QString &path, QIODevice *to=0)
Sends a get request for path to the server set by setHost() or as specified in the constructor...
static QBasicAtomicInt idCounter
The QTcpSocket class provides a TCP socket.
const T * ptr(const T &t)
virtual ~QHttp()
Destroys the QHttp object.
QByteArray toLatin1() const Q_REQUIRED_RESULT
Returns a Latin-1 representation of the string as a QByteArray.
Error error() const
Returns the last error that occurred.
friend class QHttpSetHostRequest
bool isEncrypted() const
Returns true if the socket is encrypted; otherwise, false is returned.
void close()
Closes the I/O device for the socket, disconnects the socket's connection with the host...
QIODevice * sourceDevice()
int setHost(const QString &hostname, quint16 port=80)
Sets the HTTP server that is used for requests to hostName on port port.
The QAuthenticator class provides an authentication object.
QIODevice * destinationDevice()
QIODevice * destinationDevice()
int setUser(const QString &username, const QString &password=QString())
This function sets the user name userName and password password for web pages that require authentica...
QByteArray toEncoded(FormattingOptions options=None) const
Returns the encoded representation of the URL if it's valid; otherwise an empty QByteArray is returne...
T & first()
Returns a reference to the first item in the list.
const char * constData() const
Returns a pointer to the data stored in the byte array.
bool isNull() const
Returns true if this string is null; otherwise returns false.
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.
virtual void start(QHttp *)=0
QString mid(int position, int n=-1) const Q_REQUIRED_RESULT
Returns a string that contains n characters of this string, starting at the specified position index...
void setProxy(const QNetworkProxy &networkProxy)
Sets the explicit network proxy for this socket to networkProxy.
QString arg(qlonglong a, int fieldwidth=0, int base=10, const QChar &fillChar=QLatin1Char(' ')) const Q_REQUIRED_RESULT
int head(const QString &path)
Sends a header request for path to the server set by setHost() or as specified in the constructor...
void finishedWithError(const QString &detail, int errorCode)
#define Q_DECLARE_PUBLIC(Class)
void setPort(int port)
Sets the port of the URL to port.
The QHttp class provides an implementation of the HTTP protocol.
qint64 readLine(char *data, qint64 maxlen)
This function reads a line of ASCII characters from the device, up to a maximum of maxSize - 1 bytes...
QString simplified() const Q_REQUIRED_RESULT
Returns a string that has whitespace removed from the start and the end, and that has each sequence o...
Error
This enum identifies the error that occurred.
static QString fromLatin1(const char *, int size=-1)
Returns a QString initialized with the first size characters of the Latin-1 string str...
bool isNull() const
Returns true if the authenticator is null.
int addRequest(QHttpNormalRequest *)
QObject * parent() const
Returns a pointer to the parent object.
QIODevice * sourceDevice()
friend class QHttpSetProxyRequest
QIODevice * sourceDevice()
friend class QHttpPGHRequest
Q_OUTOFLINE_TEMPLATE QPair< T1, T2 > qMakePair(const T1 &x, const T2 &y)
QString toLower() const Q_REQUIRED_RESULT
Returns a lowercase copy of the string.
T & last()
Returns a reference to the last item in the list.
void resize(int size)
Sets the size of the byte array to size bytes.
quint16 port() const
Returns the port of the proxy host.
void ignoreSslErrors()
Tells the QSslSocket used for the Http connection to ignore the errors reported in the sslErrors() si...
uint toUInt(bool *ok=0, int base=10) const
Returns the string converted to an unsigned int using base base, which is 10 by default and must be b...
int fetchAndAddRelaxed(int valueToAdd)
void setType(QNetworkProxy::ProxyType type)
Sets the proxy type for this instance to be type.
qint64 bytesToWrite() const
Returns the number of bytes that are waiting to be written.
QByteArray readAll()
Reads all available data from the device, and returns it as a QByteArray.
QByteArray calculateResponse(const QByteArray &method, const QByteArray &path)
void _q_slotEncryptedBytesWritten(qint64 numBytes)
int post(const QString &path, QIODevice *data, QIODevice *to=0)
Sends a post request for path to the server set by setHost() or as specified in the constructor...
int size() const
Returns the number of bytes in this byte array.
QHttpPGHRequest(const QHttpRequestHeader &h, QIODevice *d, QIODevice *t)
QTimer post100ContinueTimer
void setScheme(const QString &scheme)
Sets the scheme of the URL to scheme.
int request(const QHttpRequestHeader &header, QIODevice *device=0, QIODevice *to=0)
Sends a request to the server set by setHost() or as specified in the constructor.
QIODevice * sourceDevice()
QString password() const
Returns the password used for authentication.
int close()
Closes the connection; this is useful if you have a keep-alive connection and want to close it...
State state() const
Returns the current state of the object.
QStringList split(const QString &sep, SplitBehavior behavior=KeepEmptyParts, Qt::CaseSensitivity cs=Qt::CaseSensitive) const Q_REQUIRED_RESULT
Splits the string into substrings wherever sep occurs, and returns the list of those strings...
QHttpRequestHeader header
The QTimer class provides repetitive and single-shot timers.
virtual bool hasRequestHeader()
static QUrl fromEncoded(const QByteArray &url)
Parses input and returns the corresponding QUrl.
bool hasPendingRequests() const
Returns true if there are any requests scheduled that have not yet been executed; otherwise returns f...
qint64 write(const char *data, qint64 len)
Writes at most maxSize bytes of data from data to the device.
QString user() const
Returns the user name used for authentication.
QAuthenticator proxyAuthenticator
QString errorString() const
Returns a human-readable description of the last error that occurred.
QUrl resolved(const QUrl &relative) const
Returns the result of the merge of this URL with relative.
QIODevice * destinationDevice()
static const KeyPair *const end
The QIODevice class is the base interface class of all I/O devices in Qt.
void stop()
Stops the timer.
void start(int msec)
Starts or restarts the timer with a timeout interval of msec milliseconds.
bool canReadLine() const
Returns true if a line of data can be read from the socket; otherwise returns false.
#define Q_UNUSED(x)
Indicates to the compiler that the parameter with the specified name is not used in the body of a fun...
virtual bool seek(qint64 pos)
For random-access devices, this function sets the current position to pos, returning true on success...
int closeConnection()
Behaves the same as close().
void clearPendingRequests()
Deletes all pending requests from the list of scheduled requests.
void abort()
Aborts the current request and deletes all scheduled requests.
void _q_startNextRequest()
The QLatin1Char class provides an 8-bit ASCII/Latin-1 character.
QByteArray readAll()
Reads all the bytes from the response content and returns them.
void clear()
Clears the contents of the byte array and makes it empty.
SocketState state() const
Returns the state of the socket.
QHttpNormalRequest(const QHttpRequestHeader &h, QIODevice *d, QIODevice *t)
The QList class is a template class that provides lists.
qint64 read(char *data, qint64 maxlen)
Reads maxlen bytes from the response content into data and returns the number of bytes read...
int removeAll(const T &t)
Removes all occurrences of value in the list and returns the number of entries removed.
QString hostName() const
Returns the host name of the proxy host.