summaryrefslogtreecommitdiffstats
path: root/src/network
diff options
context:
space:
mode:
authorBradley T. Hughes <bradley.hughes@nokia.com>2009-06-15 09:57:36 (GMT)
committerBradley T. Hughes <bradley.hughes@nokia.com>2009-06-15 09:57:36 (GMT)
commit336dfcef05cb63df0a6d550b59a4badc7a0f01c1 (patch)
treea218ec97413e0c8ebc9600ac5db9b2adea485b32 /src/network
parente44d64510e019e5d3b379b704cfb824e0d7ccc9d (diff)
downloadQt-336dfcef05cb63df0a6d550b59a4badc7a0f01c1.zip
Qt-336dfcef05cb63df0a6d550b59a4badc7a0f01c1.tar.gz
Qt-336dfcef05cb63df0a6d550b59a4badc7a0f01c1.tar.bz2
Merge of master
Diffstat (limited to 'src/network')
-rw-r--r--src/network/access/qhttp.cpp8
-rw-r--r--src/network/access/qhttpnetworkconnection.cpp37
-rw-r--r--src/network/access/qhttpnetworkconnection_p.h2
-rw-r--r--src/network/ssl/qsslcertificate.cpp4
-rw-r--r--src/network/ssl/qsslsocket.cpp2
-rw-r--r--src/network/ssl/qsslsocket_openssl.cpp7
-rw-r--r--src/network/ssl/qsslsocket_openssl_p.h4
-rw-r--r--src/network/ssl/qsslsocket_openssl_symbols.cpp23
-rw-r--r--src/network/ssl/qsslsocket_openssl_symbols_p.h23
9 files changed, 86 insertions, 24 deletions
diff --git a/src/network/access/qhttp.cpp b/src/network/access/qhttp.cpp
index 49ce5a3..711de24 100644
--- a/src/network/access/qhttp.cpp
+++ b/src/network/access/qhttp.cpp
@@ -1413,6 +1413,7 @@ QString QHttpRequestHeader::toString() const
****************************************************/
/*!
\class QHttp
+ \obsolete
\reentrant
\brief The QHttp class provides an implementation of the HTTP protocol.
@@ -1422,10 +1423,11 @@ QString QHttpRequestHeader::toString() const
\mainclass
This class provides a direct interface to HTTP that allows you to
- have more control over the requests and that allows you to access
- the response header fields. However, for new applications, it is
+ download and upload data with the HTTP protocol.
+ However, for new applications, it is
recommended to use QNetworkAccessManager and QNetworkReply, as
- those classes possess a simpler, yet more powerful API.
+ those classes possess a simpler, yet more powerful API
+ and a more modern protocol implementation.
The class works asynchronously, so there are no blocking
functions. If an operation cannot be executed immediately, the
diff --git a/src/network/access/qhttpnetworkconnection.cpp b/src/network/access/qhttpnetworkconnection.cpp
index abaa7fb..b40b4c8 100644
--- a/src/network/access/qhttpnetworkconnection.cpp
+++ b/src/network/access/qhttpnetworkconnection.cpp
@@ -64,7 +64,7 @@
QT_BEGIN_NAMESPACE
-const int QHttpNetworkConnectionPrivate::channelCount = 2;
+const int QHttpNetworkConnectionPrivate::channelCount = 6;
QHttpNetworkConnectionPrivate::QHttpNetworkConnectionPrivate(const QString &hostName, quint16 port, bool encrypt)
: hostName(hostName), port(port), encrypt(encrypt),
@@ -74,6 +74,7 @@ QHttpNetworkConnectionPrivate::QHttpNetworkConnectionPrivate(const QString &host
#endif
{
+ channels = new Channel[channelCount];
}
QHttpNetworkConnectionPrivate::~QHttpNetworkConnectionPrivate()
@@ -82,6 +83,7 @@ QHttpNetworkConnectionPrivate::~QHttpNetworkConnectionPrivate()
channels[i].socket->close();
delete channels[i].socket;
}
+ delete []channels;
}
void QHttpNetworkConnectionPrivate::connectSignals(QAbstractSocket *socket)
@@ -1090,25 +1092,26 @@ void QHttpNetworkConnectionPrivate::_q_disconnected()
void QHttpNetworkConnectionPrivate::_q_startNextRequest()
{
- // send the current request again
- if (channels[0].resendCurrent || channels[1].resendCurrent) {
- int i = channels[0].resendCurrent ? 0:1;
- QAbstractSocket *socket = channels[i].socket;
- channels[i].resendCurrent = false;
- channels[i].state = IdleState;
- if (channels[i].reply)
- sendRequest(socket);
- return;
+ //resend the necessary ones.
+ for (int i = 0; i < channelCount; ++i) {
+ if (channels[i].resendCurrent) {
+ channels[i].resendCurrent = false;
+ channels[i].state = IdleState;
+ if (channels[i].reply)
+ sendRequest(channels[i].socket);
+ }
}
- // send the request using the idle socket
- QAbstractSocket *socket = channels[0].socket;
- if (isSocketBusy(socket)) {
- socket = (isSocketBusy(channels[1].socket) ? 0 :channels[1].socket);
+ QAbstractSocket *socket = 0;
+ for (int i = 0; i < channelCount; ++i) {
+ QAbstractSocket *chSocket = channels[i].socket;
+ // send the request using the idle socket
+ if (!isSocketBusy(chSocket)) {
+ socket = chSocket;
+ break;
+ }
}
-
- if (!socket) {
+ if (!socket)
return; // this will be called after finishing current request.
- }
unqueueAndSendRequest(socket);
}
diff --git a/src/network/access/qhttpnetworkconnection_p.h b/src/network/access/qhttpnetworkconnection_p.h
index 4603a55..b5f3593 100644
--- a/src/network/access/qhttpnetworkconnection_p.h
+++ b/src/network/access/qhttpnetworkconnection_p.h
@@ -250,7 +250,7 @@ public:
{}
};
static const int channelCount;
- Channel channels[2]; // maximum of 2 socket connections to the server
+ Channel *channels; // parallel connections to the server
bool pendingAuthSignal; // there is an incomplete authentication signal
bool pendingProxyAuthSignal; // there is an incomplete proxy authentication signal
diff --git a/src/network/ssl/qsslcertificate.cpp b/src/network/ssl/qsslcertificate.cpp
index 7ee0f07..1403b26 100644
--- a/src/network/ssl/qsslcertificate.cpp
+++ b/src/network/ssl/qsslcertificate.cpp
@@ -362,7 +362,7 @@ QMultiMap<QSsl::AlternateNameEntryType, QString> QSslCertificate::alternateSubje
if (!d->x509)
return result;
- STACK *altNames = (STACK *)q_X509_get_ext_d2i(d->x509, NID_subject_alt_name, 0, 0);
+ STACK_OF(GENERAL_NAME) *altNames = (STACK_OF(GENERAL_NAME)*)q_X509_get_ext_d2i(d->x509, NID_subject_alt_name, 0, 0);
if (altNames) {
for (int i = 0; i < q_sk_GENERAL_NAME_num(altNames); ++i) {
@@ -383,7 +383,7 @@ QMultiMap<QSsl::AlternateNameEntryType, QString> QSslCertificate::alternateSubje
else if (genName->type == GEN_EMAIL)
result.insert(QSsl::EmailEntry, altName);
}
- q_sk_free(altNames);
+ q_sk_free((STACK*)altNames);
}
return result;
diff --git a/src/network/ssl/qsslsocket.cpp b/src/network/ssl/qsslsocket.cpp
index 0a049b8..4a50c5b 100644
--- a/src/network/ssl/qsslsocket.cpp
+++ b/src/network/ssl/qsslsocket.cpp
@@ -1557,7 +1557,7 @@ void QSslSocket::startServerEncryption()
{
Q_D(QSslSocket);
if (d->mode != UnencryptedMode) {
- qWarning("QSslSocket::startClientEncryption: cannot start handshake on non-plain connection");
+ qWarning("QSslSocket::startServerEncryption: cannot start handshake on non-plain connection");
return;
}
#ifdef QSSLSOCKET_DEBUG
diff --git a/src/network/ssl/qsslsocket_openssl.cpp b/src/network/ssl/qsslsocket_openssl.cpp
index 4017c4d..d71682a 100644
--- a/src/network/ssl/qsslsocket_openssl.cpp
+++ b/src/network/ssl/qsslsocket_openssl.cpp
@@ -888,7 +888,14 @@ QSslCipher QSslSocketBackendPrivate::sessionCipher() const
{
if (!ssl || !ctx)
return QSslCipher();
+#if OPENSSL_VERSION_NUMBER >= 0x10000000L
+ // FIXME This is fairly evil, but needed to keep source level compatibility
+ // with the OpenSSL 0.9.x implementation at maximum -- some other functions
+ // don't take a const SSL_CIPHER* when they should
+ SSL_CIPHER *sessionCipher = const_cast<SSL_CIPHER *>(q_SSL_get_current_cipher(ssl));
+#else
SSL_CIPHER *sessionCipher = q_SSL_get_current_cipher(ssl);
+#endif
return sessionCipher ? QSslCipher_from_SSL_CIPHER(sessionCipher) : QSslCipher();
}
diff --git a/src/network/ssl/qsslsocket_openssl_p.h b/src/network/ssl/qsslsocket_openssl_p.h
index f53d4e8..dc649e3 100644
--- a/src/network/ssl/qsslsocket_openssl_p.h
+++ b/src/network/ssl/qsslsocket_openssl_p.h
@@ -78,6 +78,10 @@
#include <openssl/x509v3.h>
#include <openssl/x509_vfy.h>
+#if OPENSSL_VERSION_NUMBER >= 0x10000000L
+typedef _STACK STACK;
+#endif
+
QT_BEGIN_NAMESPACE
class QSslSocketBackendPrivate : public QSslSocketPrivate
diff --git a/src/network/ssl/qsslsocket_openssl_symbols.cpp b/src/network/ssl/qsslsocket_openssl_symbols.cpp
index 42c09f5..feec0a7 100644
--- a/src/network/ssl/qsslsocket_openssl_symbols.cpp
+++ b/src/network/ssl/qsslsocket_openssl_symbols.cpp
@@ -144,7 +144,11 @@ DEFINEFUNC(int, RAND_status, void, DUMMYARG, return -1, return)
DEFINEFUNC(void, RSA_free, RSA *a, a, return, DUMMYARG)
DEFINEFUNC(void, sk_free, STACK *a, a, return, DUMMYARG)
DEFINEFUNC(int, sk_num, STACK *a, a, return -1, return)
+#if OPENSSL_VERSION_NUMBER >= 0x10000000L
+DEFINEFUNC2(void *, sk_value, STACK *a, a, int b, b, return 0, return)
+#else
DEFINEFUNC2(char *, sk_value, STACK *a, a, int b, b, return 0, return)
+#endif
DEFINEFUNC(int, SSL_accept, SSL *a, a, return -1, return)
DEFINEFUNC(int, SSL_clear, SSL *a, a, return -1, return)
DEFINEFUNC3(char *, SSL_CIPHER_description, SSL_CIPHER *a, a, char *b, b, int c, c, return 0, return)
@@ -157,7 +161,11 @@ DEFINEFUNC(int, SSL_CTX_check_private_key, SSL_CTX *a, a, return -1, return)
#endif
DEFINEFUNC4(long, SSL_CTX_ctrl, SSL_CTX *a, a, int b, b, long c, c, void *d, d, return -1, return)
DEFINEFUNC(void, SSL_CTX_free, SSL_CTX *a, a, return, DUMMYARG)
+#if OPENSSL_VERSION_NUMBER >= 0x10000000L
+DEFINEFUNC(SSL_CTX *, SSL_CTX_new, const SSL_METHOD *a, a, return 0, return)
+#else
DEFINEFUNC(SSL_CTX *, SSL_CTX_new, SSL_METHOD *a, a, return 0, return)
+#endif
DEFINEFUNC2(int, SSL_CTX_set_cipher_list, SSL_CTX *a, a, const char *b, b, return -1, return)
DEFINEFUNC(int, SSL_CTX_set_default_verify_paths, SSL_CTX *a, a, return -1, return)
DEFINEFUNC3(void, SSL_CTX_set_verify, SSL_CTX *a, a, int b, b, int (*c)(int, X509_STORE_CTX *), c, return, DUMMYARG)
@@ -174,7 +182,11 @@ DEFINEFUNC(STACK_OF(SSL_CIPHER) *, SSL_get_ciphers, const SSL *a, a, return 0, r
#else
DEFINEFUNC(STACK_OF(SSL_CIPHER) *, SSL_get_ciphers, SSL *a, a, return 0, return)
#endif
+#if OPENSSL_VERSION_NUMBER >= 0x10000000L
+DEFINEFUNC(const SSL_CIPHER *, SSL_get_current_cipher, SSL *a, a, return 0, return)
+#else
DEFINEFUNC(SSL_CIPHER *, SSL_get_current_cipher, SSL *a, a, return 0, return)
+#endif
DEFINEFUNC2(int, SSL_get_error, SSL *a, a, int b, b, return -1, return)
DEFINEFUNC(STACK_OF(X509) *, SSL_get_peer_cert_chain, SSL *a, a, return 0, return)
DEFINEFUNC(X509 *, SSL_get_peer_certificate, SSL *a, a, return 0, return)
@@ -192,6 +204,16 @@ DEFINEFUNC3(void, SSL_set_bio, SSL *a, a, BIO *b, b, BIO *c, c, return, DUMMYARG
DEFINEFUNC(void, SSL_set_accept_state, SSL *a, a, return, DUMMYARG)
DEFINEFUNC(void, SSL_set_connect_state, SSL *a, a, return, DUMMYARG)
DEFINEFUNC(int, SSL_shutdown, SSL *a, a, return -1, return)
+#if OPENSSL_VERSION_NUMBER >= 0x10000000L
+DEFINEFUNC(const SSL_METHOD *, SSLv2_client_method, DUMMYARG, DUMMYARG, return 0, return)
+DEFINEFUNC(const SSL_METHOD *, SSLv3_client_method, DUMMYARG, DUMMYARG, return 0, return)
+DEFINEFUNC(const SSL_METHOD *, SSLv23_client_method, DUMMYARG, DUMMYARG, return 0, return)
+DEFINEFUNC(const SSL_METHOD *, TLSv1_client_method, DUMMYARG, DUMMYARG, return 0, return)
+DEFINEFUNC(const SSL_METHOD *, SSLv2_server_method, DUMMYARG, DUMMYARG, return 0, return)
+DEFINEFUNC(const SSL_METHOD *, SSLv3_server_method, DUMMYARG, DUMMYARG, return 0, return)
+DEFINEFUNC(const SSL_METHOD *, SSLv23_server_method, DUMMYARG, DUMMYARG, return 0, return)
+DEFINEFUNC(const SSL_METHOD *, TLSv1_server_method, DUMMYARG, DUMMYARG, return 0, return)
+#else
DEFINEFUNC(SSL_METHOD *, SSLv2_client_method, DUMMYARG, DUMMYARG, return 0, return)
DEFINEFUNC(SSL_METHOD *, SSLv3_client_method, DUMMYARG, DUMMYARG, return 0, return)
DEFINEFUNC(SSL_METHOD *, SSLv23_client_method, DUMMYARG, DUMMYARG, return 0, return)
@@ -200,6 +222,7 @@ DEFINEFUNC(SSL_METHOD *, SSLv2_server_method, DUMMYARG, DUMMYARG, return 0, retu
DEFINEFUNC(SSL_METHOD *, SSLv3_server_method, DUMMYARG, DUMMYARG, return 0, return)
DEFINEFUNC(SSL_METHOD *, SSLv23_server_method, DUMMYARG, DUMMYARG, return 0, return)
DEFINEFUNC(SSL_METHOD *, TLSv1_server_method, DUMMYARG, DUMMYARG, return 0, return)
+#endif
DEFINEFUNC3(int, SSL_write, SSL *a, a, const void *b, b, int c, c, return -1, return)
DEFINEFUNC2(int, X509_cmp, X509 *a, a, X509 *b, b, return -1, return)
#ifndef SSLEAY_MACROS
diff --git a/src/network/ssl/qsslsocket_openssl_symbols_p.h b/src/network/ssl/qsslsocket_openssl_symbols_p.h
index c6ae91e..bf5cfbb 100644
--- a/src/network/ssl/qsslsocket_openssl_symbols_p.h
+++ b/src/network/ssl/qsslsocket_openssl_symbols_p.h
@@ -256,7 +256,11 @@ int q_RAND_status();
void q_RSA_free(RSA *a);
void q_sk_free(STACK *a);
int q_sk_num(STACK *a);
+#if OPENSSL_VERSION_NUMBER >= 0x10000000L
+void * q_sk_value(STACK *a, int b);
+#else
char * q_sk_value(STACK *a, int b);
+#endif
int q_SSL_accept(SSL *a);
int q_SSL_clear(SSL *a);
char *q_SSL_CIPHER_description(SSL_CIPHER *a, char *b, int c);
@@ -269,7 +273,11 @@ int q_SSL_CTX_check_private_key(SSL_CTX *a);
#endif
long q_SSL_CTX_ctrl(SSL_CTX *a, int b, long c, void *d);
void q_SSL_CTX_free(SSL_CTX *a);
+#if OPENSSL_VERSION_NUMBER >= 0x10000000L
+SSL_CTX *q_SSL_CTX_new(const SSL_METHOD *a);
+#else
SSL_CTX *q_SSL_CTX_new(SSL_METHOD *a);
+#endif
int q_SSL_CTX_set_cipher_list(SSL_CTX *a, const char *b);
int q_SSL_CTX_set_default_verify_paths(SSL_CTX *a);
void q_SSL_CTX_set_verify(SSL_CTX *a, int b, int (*c)(int, X509_STORE_CTX *));
@@ -286,7 +294,11 @@ STACK_OF(SSL_CIPHER) *q_SSL_get_ciphers(const SSL *a);
#else
STACK_OF(SSL_CIPHER) *q_SSL_get_ciphers(SSL *a);
#endif
+#if OPENSSL_VERSION_NUMBER >= 0x10000000L
+const SSL_CIPHER *q_SSL_get_current_cipher(SSL *a);
+#else
SSL_CIPHER *q_SSL_get_current_cipher(SSL *a);
+#endif
int q_SSL_get_error(SSL *a, int b);
STACK_OF(X509) *q_SSL_get_peer_cert_chain(SSL *a);
X509 *q_SSL_get_peer_certificate(SSL *a);
@@ -304,6 +316,16 @@ void q_SSL_set_bio(SSL *a, BIO *b, BIO *c);
void q_SSL_set_accept_state(SSL *a);
void q_SSL_set_connect_state(SSL *a);
int q_SSL_shutdown(SSL *a);
+#if OPENSSL_VERSION_NUMBER >= 0x10000000L
+const SSL_METHOD *q_SSLv2_client_method();
+const SSL_METHOD *q_SSLv3_client_method();
+const SSL_METHOD *q_SSLv23_client_method();
+const SSL_METHOD *q_TLSv1_client_method();
+const SSL_METHOD *q_SSLv2_server_method();
+const SSL_METHOD *q_SSLv3_server_method();
+const SSL_METHOD *q_SSLv23_server_method();
+const SSL_METHOD *q_TLSv1_server_method();
+#else
SSL_METHOD *q_SSLv2_client_method();
SSL_METHOD *q_SSLv3_client_method();
SSL_METHOD *q_SSLv23_client_method();
@@ -312,6 +334,7 @@ SSL_METHOD *q_SSLv2_server_method();
SSL_METHOD *q_SSLv3_server_method();
SSL_METHOD *q_SSLv23_server_method();
SSL_METHOD *q_TLSv1_server_method();
+#endif
int q_SSL_write(SSL *a, const void *b, int c);
int q_X509_cmp(X509 *a, X509 *b);
#ifdef SSLEAY_MACROS