Add an option to skip a generic bearer engine if needed (by testing
environment variable QT_EXCLUDE_GENERIC_BEARER).
Task-number: QTBUG-41866
Change-Id: I1b53ed1d22a7b34de5c6f6d0386ed242b2ca5e00
Reviewed-by: Alex Blasche <alexander.blasche@theqtcompany.com>
Add note mentioning it to QTcpSocket::incomingConnection() and
update SSL socket server code snippet accordingly.
Change-Id: I9d228dabde76f9e9cd5140edf08be09a588066c8
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Introduce the methods setError(), setErrorAndEmit() to consistently
set the internal error state.
Change-Id: I4ff951d100cf5e9f9a7e27135bb52188cde99853
Reviewed-by: Alex Trotsenko <alex1973tr@gmail.com>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Since Windows Vista, the OS keeps an extra set of names for each
interface, which are identifier-like and more friendly than previously,
but not the user-description.
For example:
previous name: "{2B09D370-A032-4478-8444-495AD9301D67}"
new name: "wireless_6"
friendly name: "Local Area Connection* 12"
Change-Id: I7de033f80b0e4431b7f1ffff13f995f983689f06
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@theqtcompany.com>
The has been present since Windows 2000 and most functions we need have
been present since Windows XP and Windows CE 5.0. There's no need to do
runtime detection anymore.
This was necessary in Qt 4.2, when this code was introduced, because we
still supported Windows 98 and Me, including Windows platform SDKs that
lacked the necessary header definitions.
Change-Id: I076d1e8bbd53469a24fad72cf58b1905e737f52a
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@theqtcompany.com>
Internal write buffer may have multiple blocks of data which wait a
transmission. In this case, ensuring a single write() is not enough to
flush the buffer completely. Allow several attempts that aim to write
as much as possible data from the buffer to the underlying network
socket.
Change-Id: I34b5ec65abe42853906168cdb05f793bd51162ec
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
QAbstractSocket already prevents from the recursive readyRead()
emission in canReadNotification(). Follow this behavior in case the
socket receives a close notification.
Change-Id: Ifd916d60252832c19e0dcdeaa8dde8af75b45cf7
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
A buffered TCP socket might be open only for writing purpose. As a
possible use case of the API, this patch avoids accumulation of
unwanted data in the internal read buffer.
Change-Id: I2759c1e04968d24e2ae71f3eca05e7e560cd8a41
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Otherwise errorString() might not match error() in a
statusChanged handler.
Change-Id: If1250b4552412eabe88457dee031e4ef3f533838
Reviewed-by: Alex Trotsenko <alex1973tr@gmail.com>
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@theqtcompany.com>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Static linking hides the fact that these dependencies are necessary.
Change-Id: I0af58b840bc52dfd81b79c8ced5ee79def35895a
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@theqtcompany.com>
These checks are implemented in QIODevice::atEnd().
Change-Id: I056f05a59e2422ecbe7470557cb4ba03d98e5e45
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
We weren't using qt_sockaddr_storage, so it's not a problem. But since
we're not using it anyway, we don't really need it. The storage is only
needed if we needed to get a bigger socket address and that only happens
with Unix sockets (paths).
sockaddr_in6, however, was just wrong. Some systems derived from BSD,
like OS X, have a sXX_len field containing the length of the socket
address structure and our qt_sockaddr_in6 was missing sin6_len. As a
result, setting sin6_family was just plain wrong on little-endian
systems. Like all modern systems running BSDs and OS X...
Change-Id: I7de033f80b0e4431b7f1ffff13f900f004c55443
Reviewed-by: Richard J. Moore <rich@kde.org>
The IPv4+IPv6 dual stack code that has been in Qt since 5.0 has been
giving test failures for tst_qudpsocket: some binds that shouldn't
succeed do succeed. Instead, copy the core code from the Unix version so
the two OSes will behave the same way.
The one difference in behavior between Windows and Unix is that on Unix
you can bind an IPv4 address to a multicast IP and on Windows you can't.
So I left the "correction" that was in the original code, but I'm unsure
if it is the right thing to do. Are people expecting to join the
multicast group this way?
Change-Id: Iee8cbc07c4434ce9b560ffff13caa1c3d5a7e8fd
Reviewed-by: Richard J. Moore <rich@kde.org>
We have qt_sockaddr, which has enough storage for our needs and is a
union of all the types. We don't need them to be separate like that.
Change-Id: Iee8cbc07c4434ce9b560ffff13ca9cb960ccf1d7
Reviewed-by: Richard J. Moore <rich@kde.org>
Change-Id: Iee8cbc07c4434ce9b560ffff13ca466263abcb1b
Reviewed-by: Richard J. Moore <rich@kde.org>
Reviewed-by: Rafael Roquetto <rafael.roquetto@kdab.com>
Reviewed-by: Andrew Knight <andrew.knight@intopalo.com>
We'll need to use these functions instead of the ones we're currently
using in order to access the ancillary data.
Note that on Windows the two functions aren't globals, but must be
obtained via ioctl, which means they can fail. If they do, we fall back
to using WSARecvFrom/WSASendTo
Change-Id: Iee8cbc07c4434ce9b560ffff13ca4284acd24132
Reviewed-by: Richard J. Moore <rich@kde.org>
This commit changes the readDatagram() and writeDatagram() virtual
functions to take a QIpPacketHeader as meta data, instead of a
QHostAddress/quint16 pair. As previously, the header is an "out"
parameter for readDatagram() and an "in" parameter for writeDatagram().
The header pointer in readDatagram() is allowed to be null if the
PacketHeaderOptions indicates WantNone. Otherwise, it must not be null.
The extra options parameter is introduced because we may not always want
all the metadata upon reception. For sending, we know what to include or
not based on what's set in the incoming header parameter.
QIpPacketHeader splits sender and destination because we'll be able to
return both on datagram reception.
Change-Id: Iee8cbc07c4434ce9b560ffff13ca4213255008c7
Reviewed-by: Richard J. Moore <rich@kde.org>
The _q_readyRead can also be called from readMoreLater() because we implemented
it so that bandwidth limited reading can be implemented.
This can lead to a race condition if the socket is closing at the specific moment
and then deadlock the channel: It will stay unusable with a zombie request.
The fix in QHttpProtocolaHandler checks if there is actually bytes available to read
from the socket and only then continue.
The fix in the HTTP channel needs to be done to properly finish the reply in
cases of a server replying with HTTP/1.0 or "Connection: close".
The delayed incovation of _q_receiveReply will properly finish up the reply.
Change-Id: I19ce2ae595f91d56386cc7406ccacc9935672b6b
Reviewed-by: Richard J. Moore <rich@kde.org>
Mostly related to IPv6, because Q_IPV6ADDR is an array of char, so the
compilers were generating byte access to each value. Instead, force
access as 32- and 64-bit in most places that make sense (64-bit access
decays to 32-bit on 32-bit machines). In one isLoopback(), this is now a
128-bit access for best improvement.
Some smaller improvements relating to SpecialAddress by combining the
three IPv4 special addresses.
Change-Id: I7de033f80b0e4431b7f1ffff13f932b1cd7b5d21
Reviewed-by: Richard J. Moore <rich@kde.org>
Instead of constructing a temporary QByteArray, which could conceivably
fail, to hash those bits.
Change-Id: I7de033f80b0e4431b7f1ffff13fa376302d9720f
Reviewed-by: Richard J. Moore <rich@kde.org>
All versions we support have support for the WinXP-style functions we
need, so we don't need the Win2k fallback.
Change-Id: I7de033f80b0e4431b7f1ffff13f99175a507a2ed
Reviewed-by: Richard J. Moore <rich@kde.org>
That's how QHostAddress::scopeId() stores them, so we ought to look them
up the same way.
Change-Id: I7de033f80b0e4431b7f1ffff13f98cf87d45ebc6
Reviewed-by: Richard J. Moore <rich@kde.org>
The separation was accidental due to refactoring. It does not need to
exist.
Change-Id: I7de033f80b0e4431b7f1ffff13f988adc47d57d5
Reviewed-by: Richard J. Moore <rich@kde.org>
On Linux (on a bad system without getifaddrs), the ioctl for
SIOCGIFINDEX should be faster than if_nametoindex. The ioctl on the
already open socket will require one syscall, while if_nametoindex will
require at least one more (to open the socket), probably more.
Change-Id: I7de033f80b0e4431b7f1ffff13f9888bf2044105
Reviewed-by: Richard J. Moore <rich@kde.org>
This complements QHostAddress::isLoopback. The only missing check now is
for the "Any" address types, though operator== is quite fast nowadays.
Change-Id: Iee8cbc07c4434ce9b560ffff13cc2691e15014b6
Reviewed-by: Richard J. Moore <rich@kde.org>
Only happens on systems without getifaddrs, which we aren't usually
testing.
Change-Id: I7de033f80b0e4431b7f1ffff13f9889f5cfdea5b
Reviewed-by: Richard J. Moore <rich@kde.org>
It's called everywhere due to QT_ENSURE_PARSED and it's big. There's no
need to duplicate it everywhere.
Change-Id: I7de033f80b0e4431b7f1ffff13fa383f29114712
Reviewed-by: Richard J. Moore <rich@kde.org>
Contents of the QIODevice's buffer is handled in the base
implementation.
Change-Id: I5a3d68e4e8dcb16d7f5ad695ac43127b8047a061
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Site-local addresses were deprecated in RFC 3879 (September 2004) and
RFC 4193 (October 2005) replaced them with Unique Local Address. ULAs
are part of the global range but supposedly unique to an organization.
Change-Id: I7de033f80b0e4431b7f1ffff13f98d2124c5cffc
Reviewed-by: Martin Smith <martin.smith@digia.com>
Reviewed-by: Topi Reiniö <topi.reinio@digia.com>
This commit moves the functionality from QtNetwork's QHostInfo to
QtCore. Note that due to Windows ws2_32.dll's quirky behavior of
requiring WSAStartup before calling gethostname, this change required
moving the initialization to QtCore too.
On Linux systems, gethostname() gets the name from uname(), so we bypass
the middle man and save one memcpy.
Change-Id: I27eaacb532114dd188c4ffff13d32655a6301346
Reviewed-by: Erik Verbruggen <erik.verbruggen@theqtcompany.com>
Reviewed-by: Oliver Wolff <oliver.wolff@theqtcompany.com>
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@theqtcompany.com>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
The type is known (usually) right after createNewSocket, so let's just
set it. They may get overwritten later (in fetchConnectionParameters),
but this allows early use of setOption when we need to know the socket
type.
Change-Id: Iee8cbc07c4434ce9b560ffff13ca09fccb8e1662
Reviewed-by: Richard J. Moore <rich@kde.org>
Scanning and updating networks can cause transmission jitters
when scanning every 10 seconds.
setting QT_BEARER_POLL_TIMEOUT, in milliseconds will set
polling timer for those bearer backends that require
polling, such as generic and windows.
Task-number: QTBUG-46015
Change-Id: I0338cd34ad78488ebef250a0114d17ce190434e8
Reviewed-by: Alex Blasche <alexander.blasche@theqtcompany.com>
Adds basic support for QSslKey reading / writing Elliptic Curve keys on
backends other than OpenSSL (i.e. WinRT / SecureTransport for now).
Change-Id: I67012dbe6b844a3ed5b22b63e0cdbacf0497a74a
Reviewed-by: Richard J. Moore <rich@kde.org>
Since SslV3, SslV2 and UnknownProtocol do not support it we can
invert the IF clause here.
Change-Id: I42e942337d01f3a8c97885b268bffa568e40d335
Task-number: QTBUG-47528
Reviewed-by: Mikkel Krautz <mikkel@krautz.dk>
Reviewed-by: Richard J. Moore <rich@kde.org>
Fixes a typo which breaks the parsing of certificates with DSA public keys
when using a non-OpenSSL backend (WinRT, SecureTransport).
Change-Id: I250ba9948d5bd7739e281d7cd1b95cfbcb10e402
Reviewed-by: Timur Pocheptsov <Timur.Pocheptsov@digia.com>
This adds an OpenSSL-based implementation of the QSslKeyPrivate encrypt
and decrypt method. This puts both the OpenSSL-based and non-OpenSSL
backends (WinRT for now) on par.
Change-Id: I18a75ee5f1c223601e51ebf0933f4430e7c5c29b
Reviewed-by: Andrew Knight <andrew.knight@intopalo.com>
Reviewed-by: Richard J. Moore <rich@kde.org>
These all invoke the QFlags<>(Zero *) ctor, which is designed to
accept a 0, but no other int. But in doing so, it requires passing
a nullptr literal, and 0 is not a nullptr literal accepted under
-Wzero-as-null-pointer-constant or similar warnings.
Fix by using the QFlags::QFlags() ctor instead.
Task-number: QTBUG-45291
Change-Id: I73f9c9f4de11eeb1ba04ace6c7121d17510ea29f
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>