summaryrefslogtreecommitdiffstats
path: root/src/network/access
Commit message (Collapse)AuthorAgeFilesLines
* fix a mismatch of using QT_NO_NETWORKPROXYJing Bai2012-09-031-0/+3
| | | | | | | | To fix a compile error when QT_NO_NETWORKPROXY is defined. Change-Id: If0433387cff2e6574fe24721a0ce2bfc41b0eb47 Reviewed-by: Markus Goetz <markus@woboq.com> Reviewed-by: Olivier Goffart <ogoffart@woboq.com>
* QNetworkDiskCache: avoid a 31-bit truncationMarc Mutz2012-08-231-1/+1
| | | | | | | | | Network operations whose content size exceed 2G are not unheard of, and they probably shouldn't be cached, so use the correct toX() function, one that doesn't truncate the value in the header. Change-Id: Ie4e68a3120c85952dd2cc9feb73c5844e20b9aa3 Reviewed-by: Shane Kearns <shane.kearns@accenture.com>
* QtNetwork: declare some classes as sharedMarc Mutz2012-08-234-1/+8
| | | | | Change-Id: Ib3eaba59836529ad0cf8e4353b54dd0cd31fd1ad Reviewed-by: Shane Kearns <shane.kearns@accenture.com>
* A few more random documentation fixesShawn Rutledge2012-08-231-2/+2
| | | | | | | @p replaced by \a, \QD replaced by {Qt Designer}, couple of enums etc. Change-Id: I315510690bf52e42db519292b4122fa24c73bbc9 Reviewed-by: Frederik Gladhorn <frederik.gladhorn@nokia.com>
* Fix typo in QAbstractNetworkCache documentation.Mitch Curtis2012-08-211-1/+1
| | | | | | | | "used be" => "used by" Change-Id: Ibde738facab357d21604779f8b2145d32815ed66 Reviewed-by: Geir Vattekar <geir.vattekar@nokia.com> Reviewed-by: Marc Mutz <marc.mutz@kdab.com>
* Add missing #include <qmetatype.h>Thiago Macieira2012-08-201-0/+1
| | | | | | | There's a Q_DECLARE_METATYPE at the end of this file. Change-Id: Ib63aa4397ccba8740d46cf1ee7af712f75d05765 Reviewed-by: Shane Kearns <shane.kearns@accenture.com>
* Fix some documentation inconsistency in QtNetwork.Stephen Kelly2012-08-062-21/+21
| | | | | Change-Id: Id3e25480d4a8529813e02dc3d19f553a9263a363 Reviewed-by: Olivier Goffart <ogoffart@woboq.com>
* QtNetwork: use nullary version of qRegisterMetaType<T>("T")Marc Mutz2012-07-257-14/+16
| | | | | | | | | | | | | | | | | Using the nullary version has the advantage that multiple calls during a program run are much more efficient, since an inlined atomic is used to store the result. It also ensures that Q_DECLARE_METATYPE(T) has been used, whereas qRegisterMetaType<T>("T") will happily register anything. So I've added the macro where it was missing, or moved it to a central place when it existed hidden. In tst_qnetworkreply, this became a bit tricky, because a private header is conditionally included, so moved the Q_DECLARE_METATYPE() into a conditional section, too. Change-Id: I71484523e4277f4697b7d4b2ddc3505375162727 Reviewed-by: Stephen Kelly <stephen.kelly@kdab.com>
* Remove obsolete or commented use of Q_DECLARE_METATYPE.Stephen Kelly2012-07-243-5/+0
| | | | | Change-Id: I15bc845801b9f84a9252a0092fbd69f0e1b3f4ea Reviewed-by: Olivier Goffart <ogoffart@woboq.com>
* QtNetwork: normalize signals/slotsMarc Mutz2012-07-182-8/+8
| | | | | | | | | | This is the result of running util/normalize --modify from Qt 4.7 with manual review. Change-Id: I3f89d5138ea9905c42ed581991426e72c90d4069 Reviewed-by: Richard J. Moore <rich@kde.org> Reviewed-by: Marc Mutz <marc.mutz@kdab.com> Reviewed-by: Olivier Goffart <ogoffart@woboq.com>
* Fix some spelling errorsSergio Ahumada2012-07-113-5/+5
| | | | | | Change-Id: I19d3b2e9a5180b13deb828b55195404ef20be295 Reviewed-by: Daniel Teske <daniel.teske@nokia.com> Reviewed-by: Giuseppe D'Angelo <giuseppe.dangelo@kdab.com>
* QtNetwork: add member-swap to shared classesMarc Mutz2012-07-068-0/+44
| | | | | | | | Implemented as in other shared classes (e.g. QPen). Change-Id: Ib3d87ff99603e617cc8810489f9f5e9fe054cd2a Reviewed-by: Thiago Macieira <thiago.macieira@intel.com> Reviewed-by: Shane Kearns <shane.kearns@accenture.com>
* Add null httpReply checks to QHttpThreadDelegateShane Kearns2012-07-031-6/+25
| | | | | | | | | | | | | | | | | If a request is aborted while under load, the abort signal can be queued in front of a signal emitted from the httpReply. The abort slot is deleting the httpReply and setting it to null. So when the queued slot is processed the httpReply is null and caused an MMU fault. Removed qWarning from existing null checks, as these are expected if abort is called with precise timing so that it races with the reply finishing on the socket. Task-number: QTBUG-26245 Change-Id: I0a7e0223fda1bc01d117fe8a993c7f6e43fd72ff Reviewed-by: Jonas Gastal <jgastal@profusion.mobi> Reviewed-by: Richard J. Moore <rich@kde.org>
* Move the QDataStream operator<< for QPair to qdatastream.hThiago Macieira2012-06-282-0/+2
| | | | | | | | | | QPair is small and is no problem to include from qdatastream.h. However, including QDataStream from qpair.h means including QIODevice and QObject too. Change-Id: I344321e9f68438008ec329a165135c3a346c6058 Reviewed-by: Lars Knoll <lars.knoll@nokia.com> Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@nokia.com>
* Add const & to foreach 'iterators'Albert Astals Cid2012-06-271-2/+2
| | | | | | | Change-Id: I8c0600dfd919f45d14a0011f2da9b9fe0b9a0df3 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com> Reviewed-by: Marc Mutz <marc.mutz@kdab.com> Reviewed-by: Robin Burchell <robin+qt@viroteck.net>
* QNetworkCookie - ignore unparsable expires attributeShane Kearns2012-06-271-4/+3
| | | | | | | | | | As required by RFC6265, if the date can't be parsed then the attribute should be ignored but not the whole cookie. Task-number: QTBUG-15794 Task-number: QTBUG-16798 Change-Id: I2ed2fbbaf2d00b194995349c24b174032a599703 Reviewed-by: Richard J. Moore <rich@kde.org>
* Ignore empty domain attribute in cookiesShane Kearns2012-06-271-9/+18
| | | | | | | | | As recommended by RFC6265. This fixes the optional-domain0042 test case. Task-number: QTBUG-15794 Change-Id: I6dd459797afcb52fa2a78437f8481f5abc6f3105 Reviewed-by: Richard J. Moore <rich@kde.org>
* Use RFC6265 rules for cookie path & path matchingShane Kearns2012-06-272-8/+25
| | | | | | | | | | | | | | | Url encoding of paths is no longer used. This matches the current release behaviour of Firefox, Chrome and MSIE browsers. RFC6265 does not allow this type of encoding. This fixes remaining path test cases in the IETF test suite. Currently the path0027 test is passed by Firefox but failed by Chrome and MSIE, so there is a potential compatibility issue. However it is a corner case with a malformed cookie. Task-number: QTBUG-15794 Change-Id: I9b02bb5adc32d614f512d314d06f2c60894aa2b0 Reviewed-by: Richard J. Moore <rich@kde.org>
* QNetworkCookie: Use RFC6265 rules for parsing Set-CookieShane Kearns2012-06-271-87/+16
| | | | | | | | | | | | | | The ';' separator takes priority even inside a quoted string. Quotation marks have no special meaning, they are not parsed and regenerated anymore. This means it is not possible to include the ';' character inside a cookie value. Other characters are returned transparently, including [",\] Task-number: QTBUG-15794 Task-number: QTBUG-26002 Task-number: QTBUG-11641 Change-Id: I4eefef5c6ac7753d5a21c226169e264578521fe9 Reviewed-by: Richard J. Moore <rich@kde.org>
* QNetworkCookie - use RFC6265 rules for max-ageShane Kearns2012-06-271-3/+9
| | | | | | | | | | | | | | | | If unparsable, ignore the max-age attribute but process the rest of the cookie normally. If max age <= 0, set expiration time to "earliest representable time" To keep this a safe value for conversions, time_t of 0 is used. This fixes cases 0019 and comma0005 in the test suite. Due to this change, cookies may be sent after they should have expired in case the max-age was malformed. Previously they would have been discarded immediately, which is more likely to break web services. Task-number: QTBUG-15794 Change-Id: I7882af8eb37db156785e4e358ca639e90c94f8d0 Reviewed-by: Richard J. Moore <rich@kde.org>
* QNetworkCookie - ignore unknown attributesShane Kearns2012-06-271-9/+1
| | | | | | | | | | | | RFC6265 clarifies that unknown cookie attributes should be ignored, including the version attribute which was defined by RFC2109 but not used correctly in practice. This fixes case 0008 in the test suite with minimal risk. Task-number: QTBUG-15794 Change-Id: I6f15e8e5e2e5f1ed168fc733a5c84d606a452252 Reviewed-by: Richard J. Moore <rich@kde.org>
* Remove support for multiple cookies in one Set-Cookie header to follow RFC6265.Jocelyn Turcotte2012-06-271-13/+5
| | | | | | | | | | | | This also allows cookie values to contain commas to increase compatibility like most popular browsers do even though the RFC still reserves them for future uses. Reviewed-by: Peter Hartmann <peter.hartmann@nokia.com> Task-number: QTBUG-21456 (cherry-picked from 8ba781b01e900148fec2e9d26485369b3295487f) Change-Id: Ib09ab2411dddf7f99de1c0c31680428b7412fc7e Reviewed-by: Shane Kearns <shane.kearns@accenture.com>
* Ensure that Proxy-Connection: Keep-Alive is respected for HTTP 1.0Andy Shaw2012-06-221-1/+2
| | | | | | | | | | | | When doing a NTML authentication it would close the connection after the second phase before replying when the reply was a HTTP 1.0 version reply. Since the Proxy-Connection header is set to Keep-Alive in this case we want to ensure we do not close in this siutation. Task-number: QTBUG-26037 Change-Id: Icaaf2277efc0d05a946c52fb42b5191964e2e0fe Reviewed-by: Shane Kearns <shane.kearns@accenture.com>
* Change default Content-Type for http POST to match 4.7.4Shane Kearns2012-06-211-2/+5
| | | | | | | | | | | | | | | Qt 4.7.3 sent no Content-Type header by default. This was fixed independently on 4.8.0 and 4.7.4 branches, with different defaults. Since this is often used for web service logins, the 4.7.4 default of x-www-form-urlencoded seems more likely to work. The warning message is left in place, since not specifying the content type is still an application bug. Task-number: QTBUG-23350 Change-Id: I30bf50fd216ee9894d0168e904cea1ed4251ec68 Reviewed-by: Martin Petersson <Martin.Petersson@nokia.com>
* QNetworkAccessManager: delete the httpThreadMartin Petersson2012-06-202-4/+12
| | | | | | | | | | | | | The httpThread was using deleteLater the finished signal of the thread to call the deleteLater slot. If the QNetworkAccessManager is deleted when the application is closed then then fished is emitted but we never return to the eventloop so the deletion is never done. This will delete the httpThread directly instead of using deleteLater Task-number: QTBUG-25487 Change-Id: I1fdbd4eca01e8bd8b3a98936298e5c78217752b4 Reviewed-by: Shane Kearns <shane.kearns@accenture.com>
* Make qurlinfo private, now that QFtp is private.David Faure2012-06-144-4/+4
| | | | | | Change-Id: I0bb641b397b7087c89009f92d9973e0922dce653 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com> Reviewed-by: Shane Kearns <shane.kearns@accenture.com>
* choke uploadProgress signalsShane Kearns2012-06-143-3/+27
| | | | | | | | | | | | | | | | | | The QNetworkReply::uploadProgress signal is intended for updating UI elements such as a progress bar. Limit the signal emissions to 10 per second to prevent overloading the UI with updates. As with the downloadProgress choke, this is implemented by dropping signals that occur within 100ms of the previous emission. The 100% signal is always emitted (bytesSent == bytesTotal) When the upload size is initially unknown, this behaviour is still provided by the upload device emitting a suitable readProgress signal when EOF is reached. Task-number: QTBUG-20449 Change-Id: I77e03c8a49109106e1c375ee00380293fd326b63 Reviewed-by: Martin Petersson <Martin.Petersson@nokia.com>
* choke downloadProgress signalsShane Kearns2012-06-145-7/+40
| | | | | | | | | | | | | | | | | | | The QNetworkReply::downloadProgress signal is intended for updating user interface components (e.g. a progress bar). Limit signal emissions to 10 times per second, with an additional signal just before the finished() signal to provide the 100% progress. For the size of download where a progress bar is necessary, this update frequency seems sufficient. The implementation is done by dropping signals which would be emitted less than 100ms after the previous signal emission. Task-number: QTBUG-20449 Change-Id: I9c2dbe16c70f3270cbf98f3c74cf9d9a3f0ab900 Reviewed-by: David Faure <faure@kde.org> Reviewed-by: Markus Goetz <markus@woboq.com> Reviewed-by: Martin Petersson <Martin.Petersson@nokia.com>
* Namespace the bundled zlib symbols, to avoid clash with user zlibaavit2012-06-082-33/+50
| | | | | | | | | | | | | | | | | | | | | | | | | | | When Qt is being compiled and is using the bundled zlib, QtCore needs to export the zlib symbols, since zlib is needed in other Qt libraries as well. That gives a danger of a potentially disastrous symbol clash if the user later on links with both Qt and an external zlib (ref. e.g. QTBUG-15071). This commit enables a zlib compilation flag that causes all zlib symbols to be redefined with a prefix. Hence, they will not clash with a standard zlib. A minor drawback is that zlib.h will now have #defines for a few semi-normal identifiers. Hence, a couple of more changes are done: In the private qzip code, the identifer crc32 had to be renamed. QHttpNetworkReplyPrivate needed no change, but as a defensive measure the #include <zlib.h> is moved from the _p.h file to the .cpp file, to avoid surprising compilation errors later in code that include that header. This commit does not in itself solve the issue of how to let Qt libraries outside of qtbase use the same bundled zlib, but it is a prerequisite for that. Change-Id: If84105901a8c90d35009faffe660c85a6bd2fee5 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* QtNetwork: disconnect other channels when network layer detectedMartin Petersson2012-06-063-0/+11
| | | | | | | | | | | | | With Happy Eyeballs we will connect one IPv4 and one IPv6 channel and pick the network layer depending on which connects first. When the first channel is connected we can close the other one. Before this we let the other connection finish connecting and then closed it. This will close the other one as soon as the first one is connected. Change-Id: Ib2ab3f949704fd39dc0584bd31b9bcaf75ce35f7 Reviewed-by: Shane Kearns <shane.kearns@accenture.com>
* Use QPointer instead of QWeakPointer.Stephen Kelly2012-06-051-1/+2
| | | | | | | | The use of QWeakPointer for tracking QObject pointers is to be deprecated. Change-Id: If460ca7f515db77af24030152f4bd56e1a5fae7c Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* QtNetwork: handle raw deflate compressed data in Http.Martin Petersson2012-06-011-1/+20
| | | | | | | | | | | | | | For raw deflate compressed data with no zlib or gzip header we need to call initInflate2 with -MAX_WBITS. The first call to inflate will asume that the data has a header, but if that call fails with a Z_DATA_ERROR we can try once more with changed windowBits incase the data was raw compressed data without a header. Task-number: QTBUG-25513 Change-Id: Ib37c286c6da6d5395581717d0e76a0dbd5df289c Reviewed-by: Shane Kearns <shane.kearns@accenture.com>
* QNetworkReply: Change abort() function into a slotJonathan Liu2012-06-011-1/+1
| | | | | | | | | It is useful for abort() to be a slot for connecting cancel and timeout signals. Change-Id: Ib0146d66fffe3f57b683dfbce0863e378b8c076d Reviewed-by: Thiago Macieira <thiago.macieira@intel.com> Reviewed-by: Shane Kearns <shane.kearns@accenture.com>
* QNAM - maintain a weak reference to the QNetworkSessionShane Kearns2012-06-015-43/+61
| | | | | | | | | | | | | | | When handling signals from the session, a pointer is needed. Also the QNetworkReplyImpl needs to access the manager's session. So, the manager should have a strong and weak reference. The strong reference is held during connection establishment. The weak reference is held all the time, though it will become null when the session is destroyed in idle. The non static member function getNetworkSession() is used to create strong references from the weak reference where required. Task-number: ou1cimx#1004278 Change-Id: I4b5b36b1d996b98e659d993969006c61b4440c15 Reviewed-by: Martin Petersson <Martin.Petersson@nokia.com>
* Track active network replies without qFindChildrenShane Kearns2012-06-012-1/+7
| | | | | | | | | | | | | | | For bearer management to work correctly, we need to know when there are no network replies active. Previously this was implemented using qFindChildren, but that doesn't work when the user reparents QNetworkReply. QtWebkit does this (actually sets parent to 0). Also the qFindChildren implementation was racy if multiple requests were finished in parallel. Again, likely to be triggered by webkit loading page elements. Task-number: QTBUG-15812 Change-Id: I181a9ba6611c7c4b6fffa2d84fe4029d89e8f596 Reviewed-by: Martin Petersson <Martin.Petersson@nokia.com>
* QNetworkReplyHttpImpl: code cleanupMartin Petersson2012-05-242-26/+1
| | | | | | | | | | | When the QNetworkAccessHttpBackend was merged into the QNetworkReplyHttpImpl there was some code and comments comming from the backend that was left in the new class. This removes some of these leftovers from the QNetworkAccessHttpBackend. Change-Id: Ifa118160438e2740fb9bf52907066096d8de9ae7 Reviewed-by: Markus Goetz <markus@woboq.com> Reviewed-by: Shane Kearns <shane.kearns@accenture.com>
* Fix compile warnings with MSVCShane Kearns2012-05-231-0/+7
| | | | | | | | | | Calling a static function non statically causes an unused variable warning for the optimised away d pointer. sscanf causes an insecure functions warning. (Even though it was used safely in this case) Change-Id: I07700e2155284ef3ebbe7d604ed59b2e61ee7f95 Reviewed-by: Friedemann Kleint <Friedemann.Kleint@nokia.com>
* Prevent infinite loops by handling all ZLIB errorsShane Kearns2012-05-211-5/+4
| | | | | | | | | | | | In case the HTTP server returns more data after the end of the compressed data stream, inflate will return Z_STREAM_END, which is a normal informative error code. This was handled in 4.8, but lost in 5.0. Also catch all ZLIB negative error codes rather than only three. Task-number: QTBUG-25823 Change-Id: Ibdbbd3dd6fa81a0880c477cb080ad35f2d7116f0 Reviewed-by: Martin Petersson <Martin.Petersson@nokia.com>
* QNetworkReplyHttpImplPrivate::migrateBackendMartin Petersson2012-05-211-29/+2
| | | | | | | | | | | | | If the QNetworkSession change while we are handling a QNetworkRequest we should try to resume this request if possible. In that case we set the offset for where to continue the request. Abort the operation in the http thread. And then post the request again. The offset will then be set using the range header in postRequest() so that the operation is resumed. Task-number: QTBUG-25762 Change-Id: Ib7946905bcc633f8cc3dd7a7ad1ae74579e6bf56 Reviewed-by: Shane Kearns <shane.kearns@accenture.com>
* Fix QtNetwork compilation for -qconfig largeTasuku Suzuki2012-05-193-1/+6
| | | | | Change-Id: I231272e59101e9492a7a1edbacab165b96927877 Reviewed-by: Shane Kearns <shane.kearns@accenture.com>
* QHttpNetworkReply:readBodyFast return early if nothing to read.Martin Petersson2012-05-161-0/+2
| | | | | | | | | Incase there is no bytesAvailable on the socket there is no need to try to read. Change-Id: Ied9e4b8d86854b356a733fab4948739db206b6ad Reviewed-by: Prasanth Ullattil <prasanth.ullattil@nokia.com> Reviewed-by: Shane Kearns <shane.kearns@accenture.com>
* QNetworkAccessManager: Read all from socket on remote host closeMartin Petersson2012-05-161-0/+26
| | | | | | | | | | When we get a remoteHostClosed we should try to read everything from the socket before we close the channel. Change-Id: Iaa87d79ea16d69735f6ba3e8b3b4a0f86fbd5f73 Reviewed-by: Shane Kearns <shane.kearns@accenture.com> Reviewed-by: Prasanth Ullattil <prasanth.ullattil@nokia.com> Reviewed-by: Richard J. Moore <rich@kde.org>
* Properly handle unexpected EOF in QHttpThreadDelegateShane Kearns2012-05-151-6/+9
| | | | | | | | | This prevents http POST/PUT from hanging if the QIODevice being uploaded returns -1 from read. Task-number: QTBUG-24738 Change-Id: I76500cc4f0101cc8e5da5f1dc105508b3f519a3c Reviewed-by: Martin Petersson <Martin.Petersson@nokia.com>
* qhttpthreaddelegate: check that we have a reply set when reading.Martin Petersson2012-05-111-0/+3
| | | | | | | Make sure that we always have a reply set when we try to read. Change-Id: Ib3ce9063bffc9810fc2a4fb52ee1a65b7f8cdfa0 Reviewed-by: Prasanth Ullattil <prasanth.ullattil@nokia.com>
* QtNetwork: remove \link usagesGiuseppe D'Angelo2012-05-111-2/+2
| | | | | | Change-Id: I3f804a31eb9f623fb884052b4892fd45cdcdd126 Reviewed-by: Marius Storm-Olsen <marius.storm-olsen@nokia.com> Reviewed-by: Casper van Donderen <casper.vandonderen@nokia.com>
* QNetworkReply::setReadBufferSize fix for threaded httpMartin Petersson2012-05-116-7/+102
| | | | | | | | | | | | Added the setReadBufferSize functionallity again by limiting the amount that the delegate read from the channel. Each time that data is fetched from the reply buffer, we communicate back to the thread so that more data can be fetched. Task-number: QTBUG-25327 Change-Id: I2f9950196e64acd09bc8da50c1116f2c9deacad4 Reviewed-by: Shane Kearns <shane.kearns@accenture.com> Reviewed-by: Lars Knoll <lars.knoll@nokia.com>
* Merge branch 'docs-refactoring' into masterMarius Storm-Olsen2012-05-106-19/+19
|\ | | | | | | Change-Id: Iebd1966abace3cdf7f9428dcfc1ded5b124ab113
| * Doc: Modularize QtNetwork documentation.Casper van Donderen2012-05-096-19/+19
| | | | | | | | | | | | | | This change moves the snippets and imagesto the modularized directories. Change-Id: If14912692a7f72d7de345eaf88d9ec9752310fca Reviewed-by: Marius Storm-Olsen <marius.storm-olsen@nokia.com>
* | Avoid emitting finished() before user can connect the signalShane Kearns2012-05-091-1/+1
|/ | | | | | | | | | | QNetworkSession::open can synchronously emit an error, therefore we need to queue this. Otherwise QNetworkReply::finished is emitted before the user has had a chance to connect the signals. Task-number: QTBUG-18824 Change-Id: I703d5e31d2934afafabdf0a77ea3aaf5336e8dec Reviewed-by: Martin Petersson <Martin.Petersson@nokia.com>
* Various minor fixes for qdoc warnings.Richard Moore2012-05-061-25/+25
| | | | | Change-Id: I54c5ab6e1bfb1816bb510be9e2bfa1e3362faa36 Reviewed-by: Casper van Donderen <casper.vandonderen@nokia.com>