summaryrefslogtreecommitdiffstats
path: root/src/network/socket
Commit message (Collapse)AuthorAgeFilesLines
* Fix waitForBytesWritten() -> readyRead() -> write from user codeAndreas Hartmetz2025-12-032-1/+15
| | | | | | | | | | | | | | | | | | | | | | waitForBytesWritten() can emit signals, most importantly readyRead(), *before* even writing data. Anything can happen in slots connected to these signals - which includes writing out some data, which can make a subsequent attempt to write data in waitForBytesWritten() fail(*), so waitForBytesWritten() fails. Recognize when anything invoked from the current call wrote out some data and return success instead. It is not possible to deal correctly with all shenanigans in signal handlers, but this seems quite reasonable. Also fix QAbstractSocket build with QABSTRACTSOCKET_DEBUG defined. (*) for at least two reasons: nothing to write anymore or OS write buffer full Pick-to: 6.10 6.9 6.8 6.5 Change-Id: Ibf4de93d5e7dc2f88b675de410b216674faa20ad Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Add missing forwarding for channel signals in QLocalSocket / UnixAndreas Hartmetz2025-11-301-0/+4
| | | | | | | | | | | | | | QLocalSocket internally uses a QTcpSocket that actually operates on a local socket file descriptor. The forwarding of what that socket does was missing for the channelReadyRead() and channelBytesWritten() signals. [ChangeLog][QtNetwork][QLocalSocket][Unix] Fixed QLocalSocket not emitting channelReadyRead() and channelBytesWritten() signals Pick-to: 6.10 6.9 6.8 6.5 Change-Id: Iacf736374e026ddb475522d4a8e8fd8c5b5564bb Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Add TCP Keepalive options to QAbstractSocketMate Barany2025-11-255-1/+87
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | TCP Keepalive is turned on for QNAM but it is using the default system values. On Linux this means that it takes 131 minutes to tear down the connection. This can be customized with the values of TCP_KEEPIDLE - how long do we wait before we send probes TCP_KEEPINTVL - the time interval between two probes TCP_KEEPCNT - the number of probes sent So extend Qabstractsocket with the following socketoptions: KeepAliveIdleOption (TCP_KEEPIDLE) KeepAliveIntervalOption (TCP_KEEPINTVL) KeepAliveCountOption (TCP_KEEPCNT) Not all platforms provide the same support for these parameters. What we know: On Linux, all of the above is supported. On Windows, these are supported since Windows 10, 1709. On Mac all of the above is supported but TCP_KEEPIDLE is called TCP_KEEPALIVE. On QNX 7.1 only TCP_KEEPIDLE is supported and it is called as TCP_KEEPALIVE. On QNX 8.0 all of the above is supported and TCP_KEEPIDLE is called TCP_KEEPIDLE. MinGW also supports all of the above from version 12, but it seems that we have an older version in the CI so we need some ifdefs. VxWorks also supports TCP_KEEPIDLE, TCP_KEEPCNT and TCP_KEEPINTVL. [ChangeLog][QtNetwork][QAbstractSocket] Added new socketoptions to QAbstractSocket: KeepAliveIdleOption, KeepAliveIntervalOption and KeepAliveCountOption. Task-number: QTBUG-136625 Change-Id: I89d1788a19719da10ce740b52b2a6570680e0f5d Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* QNativeSocketEngine/VxWorks: also handle ENOTSUPKarim Pinter2025-11-251-1/+3
| | | | | | | | | | VxWorks doesn't return standard error types, so there is a need to extend the error handling for this OS. Task-number: QTBUG-138759 Pick-to: 6.8 6.10 Change-Id: I01de0f759c732ae840711949c769a4710aad306f Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
* Make QAbstractSocketEngineReceiver pure virtualIvan Solovev2025-11-242-2/+4
| | | | | | Change-Id: If24d06061506e2a511bbe70535be3763ae2e57eb Reviewed-by: Thiago Macieira <thiago.macieira@intel.com> Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
* Move QAbstractSocketEngineReceiver into its own headerIvan Solovev2025-11-245-14/+49
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | Commit 4ce110c50c7c2511626e79ad2d2270537c5ac279 exported QAbstractSocketPrivate so that it could be used in QtCoap. The class itself is derived from QAbstractSocketEngineReceiver, which was previously declared in the same file as QAbstractSocketEngine. As a result, the now-exported QAbstractSocketPrivate class included the definition of the non-exported QAbstractSocketEngine. This caused linking errors when using the QAbstractSocketPrivate in QtCoap: qcoapqudpconnection.cpp.obj : error LNK2001: unresolved external symbol "public: static struct QMetaObject const QAbstractSocketEngine::staticMetaObject" (?staticMetaObject@QAbstractSocketEngine@@2UQMetaObject@@B) To fix it, move QAbstractSocketEngineReceiver into its own header, and only include this new header in QAbstractSocketPrivate. This also requires to adjust a couple of places that were relying on the previous includes. Task-number: QTBUG-139697 Task-number: QTBUG-80704 Change-Id: Icb01399fe0d8941f7b91583cb3687419cb15cc02 Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Fix some punctuation and awkward wording in QLocalServer docsAndreas Hartmetz2025-11-201-10/+10
| | | | | Change-Id: Ifa7a0f4b32b4ef163221167454e82d858b002036 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Remove unused header time.h from qabstractsocket.cppMate Barany2025-11-131-2/+0
| | | | | | | | | QtCreator is warning about it and it indeed seems that it compiles just fine without it. Pick-to: 6.10 Change-Id: I85f84c3ebd8a786db9ddfc30e9e23b456093a909 Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
* QNativeSocketEngine/Unix: detect sockaddr_dl with AF_LINKThiago Macieira2025-10-211-3/+3
| | | | | | | | | | | | Instead of by proxy trying to guess that BSD systems have it and others don't. That's an incorrect assumption because QNX has this and IP_RECVIF, but isn't marked a Q_OS_BSD4. FreeBSD says sockaddr_dl should have .sdl_family = AF_LINK: http://fxr.watson.org/fxr/source/net/if_dl.h Change-Id: Ibe2777515c0f71285783fffd5c0094f622de34a9 Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
* QNativeSocketEngine/Unix: implement IP_RECVIF in setOption()Thiago Macieira2025-10-211-4/+12
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This amends and complements abe269bb72233b360bccbc8f54d3f13e8dc10b5a, which added QNativeSocketEngine::ReceivePacketInformation and actually did implement the heretofore-dead code to handle the IP_RECVIF ancilary data in nativeReceiveDatagram(), but we never asked the OS for the information via setsockopt(). Similar to what e9778dfe6ead0c4d704570816a56aead084a0263 did for Windows. Tested on FreeBSD. dtruss says: socket(PF_INET,SOCK_DGRAM|SOCK_CLOEXEC|SOCK_NONBLOCK,0) = 7 (0x7) setsockopt(7,SOL_SOCKET,SO_BROADCAST,0xb1cf40aece4,4) = 0 (0x0) setsockopt(7,IPPROTO_IP,IP_RECVDSTADDR,0xb1cf40aece4,4) = 0 (0x0) setsockopt(7,IPPROTO_IP,IP_RECVIF,0xb1cf40aece4,4) = 0 (0x0) setsockopt(7,IPPROTO_IP,IP_RECVTTL,0xb1cf40aece4,4) = 0 (0x0) bind(7,{ AF_INET 127.0.0.1:0 },16) = 0 (0x0) ... ppoll({ 7/POLLIN },1,{ 8.999999439 },0x0) = 1 (0x1) recvfrom(7,"@",1,MSG_PEEK,NULL,0x0) = 1 (0x1) recvmsg(7,{{ AF_INET 127.0.0.1:55621 },16,[{"@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@"...,1200}],1, { {level=IPPROTO_IP,type=IP_RECVDSTADDR,data={0x7f,0x00,0x00,0x01}}, {level=IPPROTO_IP,type=IP_RECVTTL,data={0x40}}, {level=IPPROTO_IP,type=IP_RECVIF,data={0x38,0x12,0x02,0x00,0x18,0x03,0x00,0x00,0x6c,0x6f,0x30,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00}} },120,0},0) = 600 (0x258) lldb decodes the sockaddr_dl as: (lldb) p *sdl (sockaddr_dl) { sdl_len = '8' sdl_family = '\x12' sdl_index = 2 sdl_type = '\x18' sdl_nlen = '\x03' sdl_alen = '\0' sdl_slen = '\0' sdl_data = "lo0" } And interface index 2 is lo0: lo0: flags=1008049<UP,LOOPBACK,RUNNING,MULTICAST,LOWER_UP> metric 0 mtu 16384 options=680003<RXCSUM,TXCSUM,LINKSTATE,RXCSUM_IPV6,TXCSUM_IPV6> inet 127.0.0.1 netmask 0xff000000 inet6 ::1 prefixlen 128 inet6 fe80::1%lo0 prefixlen 64 scopeid 0x2 groups: lo nd6 options=21<PERFORMNUD,AUTO_LINKLOCAL> Change-Id: I37b88bfce40421117d99fffd1110eced5d102430 Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
* QNativeSocketEnginePrivate::setOption: simplify ugly perror() handlingThiago Macieira2025-10-171-13/+10
| | | | | | | | | | | With a macro. Drive-by clean up the VxWorks implementation of NonBlockingSocketOption, as we know v == 1 on input. Pick-to: 6.10 6.9 6.8 Change-Id: I917f5f39ded2fa338803fffd91002fca28d7faaa Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
* Teach QNativeSocketEnginePrivate::fetchConnectionParameters() about ↵Gleb Popov2025-10-101-8/+15
| | | | | | | | SOCK_SEQPACKET Pick-to: 6.10 Change-Id: I4136ef3b4c198e3bd155884bde53171bd34959e4 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* QNativeSocketEngine::read: Only treat readBytes==0 as a EOF condition with ↵Gleb Popov2025-10-101-6/+5
| | | | | | | | | | | | stream sockets This change also covers SOCK_SEQPACKET type of sockets, which isn't great, but allows to avoid an endless polling loop when waiting for read on a disconnected socket. Pick-to: 6.10 Change-Id: I6117b97c2c9b775e9e6fe9757bf4374365e3227d Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* QAbstractSocketPrivate::readFromSocket: Simplify the code a little bitGleb Popov2025-10-101-2/+1
| | | | | Change-Id: If61a50a9596c55832bf0c06a30ac349c3d0f2ba7 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Allow binding a socket to a specific QNetworkInterfaceIvan Solovev2025-10-094-4/+93
| | | | | | | | | | | | | | | | | | | | | For now, via a private API. Provide a new socket engine option - BindInterfaceIndex, and use it if a valid interface is passed to QAbstractSocketPrivate::bind(). Note that this feature is not fully functional on macOS: both SO_BINDTODEVICE and IP{V6}_BOUND_IF only work for limiting outgoing datagrams. The patch uses IP{V6}_BOUND_IF, because it allows to avoid number -> string -> number conversion. As of now, extra filtering of incoming data should be done on the user side. Task-number: QTBUG-80704 Task-number: QTBUG-139697 Pick-to: 6.10 6.8 Change-Id: Ic207908313d9d25f96c23ecc363181ff0ae8232a Reviewed-by: Thiago Macieira <thiago.macieira@intel.com> Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
* Properly set ReceivePacketInformation socket option for dual-stackIvan Solovev2025-10-091-7/+23
| | | | | | | | | | | | | | | | | | | | | | On Windows if IPV6_V6ONLY == 0, we need to set both IPV6_PKTINFO and IP_PKTINFO options in order to correctly receive the information from IPv4 packets. Instead of explicitly checking the IPv6_V6ONLY option via getsockopt, this patch simply tries to unconditionally set the IPv4 option, and ignores the potential error if the protocol is not IPv4-only. Unix implementation is not touched by this patch, because there enabling packet info for IPv6 also enables it for IPv4. Also, an attempt to set IP_PKTINFO for AF_INET6 socket fails there even if IPV6_V6ONLY == 0. Task-number: QTBUG-80704 Task-number: QTBUG-139697 Pick-to: 6.10 6.8 Change-Id: I662ecc7de6ea29174b00b02f1f3a774b45104dc0 Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* QNativeSocketEngine: enable dual-stack as early as possibleIvan Solovev2025-10-092-0/+21
| | | | | | | | | | | | | | | | | | | | Try to disable the IPV6_V6ONLY socket option right after creating the socket. This is important, because it can affect how setting other options works. For example, on Windows we could not properly set the ReceivePacketInformation option before calling bind()/connectToHost(). If we're actually binding/connecting to an IPv6 address, then the pre-existing code in nativeBind()/nativeConnect() would take care of adjusting the option again. Task-number: QTBUG-80704 Task-number: QTBUG-139697 Pick-to: 6.10 6.8 Change-Id: I6d504d354f63f441c90df21f933fd800fafa655f Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* QAbstractSocketPrivate: add QNetworkInterface parameter to bind()Ivan Solovev2025-10-092-3/+9
| | | | | | | | | | | | | | | And also export the class, so that it could be accessed from other modules. For now, the parameter is unused. This change is factored out into a separate commit because it touches SSL-related classes. Task-number: QTBUG-139697 Task-number: QTBUG-80704 Pick-to: 6.10 6.8 Change-Id: I840b2fb57f52779311f9eb09c87a3d6d06c4ef9c Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
* Doc: Mark internal classes as internalDavid Boddie2025-10-062-0/+10
| | | | | | | | This suppresses warnings from QDoc about documentation related to these internal classes. Change-Id: I1096222acc7822034a8270e545172e68307cb20f Reviewed-by: Topi Reiniö <topi.reinio@qt.io>
* QAbstractSocket/QHostAddress: ensure definition of static constexprsThiago Macieira2025-10-031-7/+15
| | | | | | | | | | | | | | | Amends commit 969337bcfd6af6d91b988e4b412703274a0b5877, which introduced these constants. We've since learned that those either need an out-of-line definition or need to be in a non-exported base[1]. This commit uses both strategies: an out-of-line definition for the symbols that are used in Qt 6 and thus have an ABI requirement to stay the same, and moving to a base class for the Qt 7 ones, which don't yet. [1] https://lists.qt-project.org/pipermail/development/2024-January/044888.html Pick-to: 6.10 6.8 Change-Id: Id6fb9fd431ee59534769fffd916b9db68c4e18a9 Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
* Do #include <QtNetwork/qhostaddress.h> from qabstractsocket.h in Qt 7Thiago Macieira2025-10-031-4/+1
| | | | | | | | | | | Amends commit 969337bcfd6af6d91b988e4b412703274a0b5877, which clearly added the wrong header. Including qabstractsocket.h from qabstractsocket.h would do nothing because the include guard was already set. But in Qt 7 we will need QHostAddress. Pick-to: 6.10 6.8 Change-Id: If6c977a6fba674b2a7edfffd26f672d251018f66 Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
* Fix broadcasts with dual-socket IPv6 in setSocketDescriptorThiago Macieira2025-09-161-0/+1
| | | | | | | | | | | | | | | | | | | | Amends and complements 28619f1ddd4a4b21d8489476d18927564ee0839d, which had identified this could be a problem, but since there was no test, we couldn't confirm it. Now that there is, we can see that it fails with VxWorks, where I guess the two stacks are wholly separate. Note fetchConnectionParameters() only sets AnyIPProtocol if the socket is bound to :: or ::ffff:0.0.0.0. Binding to other addresses is technically possible, but broadcasting would only work if bound to another v4-mapped address. Changing fetchConnectionParameters() to, for example, use toIPv4Address() and check for success is left as an exercise for the reader. Task-number: QTBUG-139586 Task-number: QTBUG-130070 Pick-to: 6.10 6.9 6.8 6.5 Change-Id: I44daa5ec27877abc2e09fffd875d4be6dfc86446 Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
* Fix broadcasts with dual-stack IPv6André Klitzing2025-08-301-1/+1
| | | | | | | | | | This amends 55d58e1d5a936ef3daa970665423a50a4f80118b. Fixes: QTBUG-139586 Task-number: QTBUG-130070 Pick-to: 6.10 6.9 6.8 6.5 Change-Id: I4ddb9327e066415e5922aeaa7add7655ca2b17ff Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Remove unused define from qabstractsocket.cppMate Barany2025-08-291-1/+0
| | | | | | Pick-to: 6.10 Change-Id: Iec61bb2f0f5d4373ccadb4059ab296672ef7f76f Reviewed-by: Giuseppe D'Angelo <giuseppe.dangelo@kdab.com>
* CRA[network/socket]: Mark the rest significantMårten Nordheim2025-07-2839-0/+39
| | | | | | | | | The rest was handled separately. Fixes: QTBUG-135585 Pick-to: 6.10 6.9 6.8 Change-Id: I7fe912dc0742b4eedcdd001387de7f3fb85b7fe2 Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
* CRA[network/socket]: Mark proxy engines criticalMårten Nordheim2025-07-282-0/+2
| | | | | | | | | They directly parse data from or make decisions based on data received from the proxy server. Task-number: QTBUG-135585 Pick-to: 6.10 6.9 6.8 Change-Id: I66b812f5f1308fcc8f78fe35aac6b1608365980f Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
* QLocalSocket[unix]: emit stateChanged when setting socket descriptorMårten Nordheim2025-07-211-2/+8
| | | | | | | | | | | | | Windows already does this and it seems reasonable enough. For Unix the underlying socket may also update the state, but since we had already set 'Connected' by the time it does so we don't emit anything for that. Fixes: QTBUG-138372 Pick-to: 6.10 6.9 6.8 Change-Id: I2261747a4cf264fbf8ead72ba85cd7fd82a0ed09 Reviewed-by: Edward Welbourne <edward.welbourne@qt.io> Reviewed-by: Mate Barany <mate.barany@qt.io>
* Skip SO_BROADCAST for IPv6 socketsJacek Poplawski2025-07-081-5/+8
| | | | | | | | | | | Ensure that BroadcastSocketOption is only set for IPv4 UDP sockets, as IPv6 does not support broadcasting. According to RFC 4291, broadcasting is replaced by multicasting in IPv6. Pick-to: 6.5 6.8 6.9 6.10 Task-number: QTBUG-130070 Change-Id: Ia3a98d276f659e8f2676743404370b8a15a0f179 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* VxWorks-specific implementation of nativePendingDatagramSize()Jacek Poplawski2025-07-071-0/+6
| | | | | | | | | | | | | Previously, VxWorks was using the generic fallback code path, which attempts to peek UDP datagrams using recvmsg() and checks for MSG_TRUNC to infer size. However, on VxWorks, MSG_TRUNC is not reliably reported, causing incorrect or truncated datagram size detection, and in some cases infinite buffer growth or bad_alloc crashes. Task-number: QTBUG-130078 Pick-to: 6.10 6.9 6.8 6.5 Change-Id: I1ee3704a64c3579142b74198bbc55575355617bb Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* QNativeSocketEngine: React on POLLHUP too when selecting for writingGleb Popov2025-06-121-1/+1
| | | | | | | | FreeBSD may return a single POLLHUP revent not coupled with any of POLLOUT nor POLLERR. This causes a busy-loop, so put POLLHUP into write_flags. Change-Id: Ief62138eeb6de8e2caf1d6937507bfd828adfb81 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* QSocks5SocketEngine: don't depend on zero-initialization of QBasicAtomicMarc Mutz2025-06-121-1/+1
| | | | | | | | | | | | | | | | | | | It's unclear¹ whether static zero-initialization of a static QBasicAtomic actually initializes the object with a zero value, or whether it remains default-constructed (without a value until a following call to std::atomic_init gives it one). Play it safe and use Q_BASIC_ATOMIC_INITIALIZER(0) to dodge any issues the old code may have had. ¹ see ongoing discussion on the Jira ticket Amends 04d6495bf773a6bb0d4fa6980df22d3b81a605b0. Task-number: QTBUG-137465 Pick-to: 6.10 6.9 6.8 6.5 Change-Id: Iee0d75ce10a589390afdd9069b7040a1c9c608e1 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* QLocalServer: use std::unique_ptr instead of QScopedPointerAhmad Samir2025-05-261-10/+16
| | | | | | | Task-number: QTBUG-132213 Change-Id: I6a18e787efa9a2ecfe89339569a9724467ac3e6a Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
* Add POSIX Pipe feature to VxWorksKarim Pinter2025-05-121-1/+1
| | | | | | | | | | | | | | VxWorks has POSIX pipe2 functions, but doesn't pass threadsafe-cloexec because it doesn't have threadsafe-cloexec dup3. By default on VxWorks POSIX pipes are used, but now it's possible to switch to PipeDrv pipes using "configure -feature-vxpipedrv ...". dup3 and accept4 test are now separated from threadsafe-cloexec test. Task-number: QTBUG-132889 Pick-to: 6.8 6.9 Change-Id: I9e4514e2795917e8f3685a1760ea82a0022e9ca2 Reviewed-by: Alexey Edelev <alexey.edelev@qt.io> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* QSocks5SocketEngine: avoid interface as parameter nameTim Blechmann2025-05-041-2/+2
| | | | | | | | | `interface` is used by win32 headers. avoiding it fixes unity builds on windows. Pick-to: 6.8 6.9 Change-Id: I85c05e70f4986f2f384850458f7a460baacf6baf Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Network: avoid interface as parameter nameTim Blechmann2025-04-291-2/+2
| | | | | | | | | `interface` is used by win32 headers. avoiding it fixes unity builds on windows. Pick-to: 6.8 6.9 Change-Id: I1d3f89a201f44f6e4eed5977d1b80f675078d430 Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
* wasm: fix QTcpSocket error code when url doesn't existLorn Potter2025-03-182-0/+6
| | | | | | | | | | | | ::connect on wasm seems to be returning 0 in the instance that the server url does not exist. So we ignore that and look at errno, which returns ENOENT which makes no sense here. Fixes: QTBUG-132191 Pick-to: 6.9 Change-Id: I2ff6642dd836324e1af6c288c53880de028ce158 Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io>
* QObjectPrivate: extend the QObjectPrivateVersion to a few more classesThiago Macieira2025-02-202-2/+3
| | | | | | | | | | | To QtNetwork and QtGui too. This isn't about their loading of QtCore, but about other libraries loading of them. Change-Id: I94ef6a59c321271f939efffdde360657417ae35e Reviewed-by: Marc Mutz <marc.mutz@qt.io> Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
* Use 0/nullptr to indicate invalid Windows event handle in QLocalServerJøger Hansegård2025-01-233-3/+4
| | | | | | | | The CreateEvent function returns NULL/nullptr if it failed, not INVALID_HANDLE_VALUE(-1). Change-Id: I7fb94061f4e14c014bf63acb53d3eee8f295eb66 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Replace qdebug.h includes in public headers with forward-declarationsAhmad Samir2025-01-154-7/+5
| | | | | | | | | | | | | | | | | | | qdebug.h includes many Qt and STL headers, so if you include a Qt header you get all those transitive includes, which may affect build time. - Where appropriate use the printf-like syntax of qDebug() and co., these don't need the QDebug streaming operators - qfloat16 is used in an inline member function, so include it explicitly [ChangeLog][Potentially Source Incompatible Changes] Various Qt public headers don't include QDebug any more; if you need QDebug's streaming you'll have to include it in your code. Task-number: QTBUG-132439 Pick-to: 6.9 Change-Id: I750587e17a3b38fa226cd3af8eaccc8da580f436 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Doc: Fix links to QIODeviceBase:: flagsKai Köhne2024-12-131-1/+1
| | | | | | | Pick-to: 6.8 6.9 Task-number: QTBUG-131484 Change-Id: Iee545986d4fb4765086fecce6532092d4b691ae8 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Fix GCC -Wextra-semi after member function definitionsAhmad Samir2024-12-121-2/+2
| | | | | | | | Fixes: QTBUG-132101 Pick-to: 6.9 6.8 Change-Id: Ia2e13bdaf11c639c5590639717b5d31140352c44 Reviewed-by: Giuseppe D'Angelo <giuseppe.dangelo@kdab.com> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* QSocks5BindStore: use QBasicTimer instead of manipulating the timer idAhmad Samir2024-08-311-8/+7
| | | | | Change-Id: Iefd8dba4fa9193f197ffbdb960fabae9b18bf952 Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
* Fix users of static max_size()Thiago Macieira2024-08-301-1/+1
| | | | | | | | | | | Container::max_size() is a _non-static_ member function in the STL, so we can't call it as C::max_size(). Instead, use the newly-added, Qt-style camel-case maxSize(), which we will keep static constexpr. Pick-to: 6.8 Task-number: QTBUG-128450 Change-Id: I839df90a91cced85f000c7d2744ba547f629ed98 Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
* Initialize some member variables in qsocks5socketengine.cppMate Barany2024-07-241-5/+5
| | | | | | | | | | | | | Axivion warning: "Compiler-generated constructor leaves some fields uninitialized." Initialize the ports as 0 and the udpSocket as nullptr. Task-number: QTBUG-125026 Pick-to: 6.8 6.7 6.5 Change-Id: Ifa021aceea35e7c5e8c62cd2d6f651d422d629a2 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com> Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
* Doc: Qt Network: Fix linking issuesTopi Reinio2024-06-101-2/+2
| | | | | | | | | | | | | src/network/kernel/qdnslookup.cpp:1300: (qdoc) warning: Can't link to 'certificateUsage()' src/network/kernel/qdnslookup.cpp:1388: (qdoc) warning: Can't link to 'matchingType()' src/network/socket/qlocalserver.cpp:273: (qdoc) warning: Can't link to 'pendingConnectionAvailable()' Pick-to: 6.8 Change-Id: I8ba7e674de6aa548990099e24327f15168fde88e Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
* Use QHttpHeaders: Update internal users of QNRequest, QNReply, QNProxyLena Biliaieva2024-05-071-4/+7
| | | | | | | | | | | | | Replace QNetworkHeadersPrivate's main headers storage, which was RawHeadersList, with QHttpHeaders. Replace internal usage of raw and cooked header methods with the QHttpHeaders API. [ChangeLog][QtNetwork][QNetworkRequest] Header value added by QNetworkRequest::setRawHeader() method is trimmed now. Task-number: QTBUG-107751 Change-Id: I8882978afa430651e6c798a4fed00beef6c4cfd2 Reviewed-by: Juha Vuolle <juha.vuolle@qt.io>
* SOCKS5: remove '###' from the error messageThiago Macieira2024-05-021-1/+1
| | | | | | | | There's no reason for it to be there. Pick-to: 6.5 6.7 Change-Id: I262c3499666e4f4fbcfbfffd17cbbcfcd798b100 Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
* Network: cleanlinessMårten Nordheim2024-04-051-1/+1
| | | | | | | | | QT_NO_CAST_TO_ASCII QT_NO_CAST_FROM_BYTEARRAY QT_NO_URL_CAST_FROM_STRING Change-Id: Ic77ed8ccbdb146b7e7b26123923795f9748d3a38 Reviewed-by: Mate Barany <mate.barany@qt.io>
* UDP: Protect call to UDP API based on featureMårten Nordheim2024-03-211-1/+5
| | | | | | | | | Fails to compile in some qtlite setup Pick-to: 6.7 6.6 6.5 Change-Id: If04c1ca3f1b4eb59517902b8caab167f4627391b Reviewed-by: Jari Helaakoski <jari.helaakoski@qt.io> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* QLocalServer: add protected addPendingConnection functionØystein Heskestad2024-03-052-1/+20
| | | | | | | | | | Add addPendingConnection for subclasses to add socket to queue of incoming connection for use with newConnection, hasPendingConnection, and nextPendingConnection. Task-number: QTBUG-75081 Change-Id: Id242a0c3573ee511b403d18af25864add9a3b684 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>