| 1 | // For license of this file, see <project-root-folder>/LICENSE.md.cxx . . $ `<file>/src/librssguard/network-web/networkfactory.cpp`/ |
| 2 | |
| 3 | #include "network-web/networkfactory.h"cxx . . $ `<file>/src/librssguard/network-web/networkfactory.h`/ |
| 4 | |
| 5 | #include "definitions/definitions.h"cxx . . $ `<file>/src/librssguard/definitions/definitions.h`/ |
| 6 | #include "miscellaneous/textfactory.h"cxx . . $ `<file>/src/librssguard/miscellaneous/textfactory.h`/ |
| 7 | #include "network-web/downloader.h"cxx . . $ `<file>/src/librssguard/network-web/downloader.h`/ |
| 8 | |
| 9 | #include <QEventLoop> |
| 10 | #include <QIcon> |
| 11 | #include <QMetaEnum> |
| 12 | #include <QPixmap> |
| 13 | #include <QRegularExpression> |
| 14 | #include <QTextDocument> |
| 15 | #include <QTimer> |
| 16 | |
| 17 | #define SECS_WHEN_RETRYAFTER_MISSINGcxx . . $ `src/librssguard/network-web/networkfactory.cpp:17:9`! 120 |
| 18 | |
| 19 | QDateTimecxx . . $ QDateTime# NetworkFactorycxx . . $ NetworkFactory#::extractRetryAftercxx . . $ NetworkFactory#extractRetryAfter(d82b2249834d7665).(const QStringcxx . . $ QString#& retry_after_value) { |
| 20 | if (retry_after_value.simplifiedcxx . . $ QString#simplified(dca2c5857e9adf82).().isEmptycxx . . $ QString#isEmpty(3482b152b9333168).()) { |
| 21 | return QDateTimecxx . . $ QDateTime#::currentDateTimeUtccxx . . $ QDateTime#currentDateTimeUtc(bf5129c8228c71c0).().addSecscxx . . $ QDateTime#addSecs(95f9ba7c82d0c5e8).(SECS_WHEN_RETRYAFTER_MISSINGcxx . . $ `src/librssguard/network-web/networkfactory.cpp:17:9`!); |
| 22 | } |
| 23 | |
| 24 | bool is_int = false; |
| 25 | int seconds = retry_after_value.toIntcxx . . $ QString#toInt(d7972accae11ee1f).(&is_int, 10); |
| 26 | |
| 27 | if (is_int) { |
| 28 | // Some websites (Reddit) somehow return "0" Retry-After header value. |
| 29 | // In that case make it at least two minutes to wait. |
| 30 | return QDateTimecxx . . $ QDateTime#::currentDateTimeUtccxx . . $ QDateTime#currentDateTimeUtc(bf5129c8228c71c0).().addSecscxx . . $ QDateTime#addSecs(95f9ba7c82d0c5e8).(seconds <= 0 ? SECS_WHEN_RETRYAFTER_MISSINGcxx . . $ `src/librssguard/network-web/networkfactory.cpp:17:9`! : seconds); |
| 31 | } |
| 32 | |
| 33 | return QDateTimecxx . . $ QDateTime#::fromStringcxx . . $ QDateTime#fromString(a8b8e7782c8add4).(retry_after_value.simplifiedcxx . . $ QString#simplified(dca2c5857e9adf82).().replacecxx . . $ QString#replace(192e628656427d1c).(QSLcxx . . $ `src/librssguard/definitions/definitions.h:442:9`!("GMT"), QSLcxx . . $ `src/librssguard/definitions/definitions.h:442:9`!("+0000")), |
| 34 | QSLcxx . . $ `src/librssguard/definitions/definitions.h:442:9`!("ddd, dd MMM yyyy HH:mm:ss tt")); |
| 35 | } |
| 36 | |
| 37 | QStringListcxx . . $ QStringList# NetworkFactorycxx . . $ NetworkFactory#::extractFeedLinksFromHtmlPagecxx . . $ NetworkFactory#extractFeedLinksFromHtmlPage(c84171cdf977b6b4).(const QUrlcxx . . $ QUrl#& url, const QStringcxx . . $ QString#& html) { |
| 38 | QStringListcxx . . $ QStringList# feedscxx . . $ QList#QList(ced63f7c635d850d).; |
| 39 | QRegularExpressioncxx . . $ QRegularExpression# rxcxx . . $ QRegularExpression#QRegularExpression(4279d2539df7cd4a).(QSLcxx . . $ `src/librssguard/definitions/definitions.h:442:9`!(FEED_REGEX_MATCHERcxx . . $ `src/librssguard/definitions/definitions.h:211:9`!), QRegularExpressioncxx . . $ QFlags#QFlags(93d577a3e9528307).::PatternOptioncxx . . $ QRegularExpression#PatternOption#::CaseInsensitiveOptioncxx . . $ QRegularExpression#CaseInsensitiveOption.); |
| 40 | QRegularExpressioncxx . . $ QRegularExpression# rx_hrefcxx . . $ QRegularExpression#QRegularExpression(4279d2539df7cd4a).(QSLcxx . . $ `src/librssguard/definitions/definitions.h:442:9`!(FEED_HREF_REGEX_MATCHERcxx . . $ `src/librssguard/definitions/definitions.h:212:9`!), QRegularExpressioncxx . . $ QFlags#QFlags(93d577a3e9528307).::PatternOptioncxx . . $ QRegularExpression#PatternOption#::CaseInsensitiveOptioncxx . . $ QRegularExpression#CaseInsensitiveOption.); |
| 41 | |
| 42 | rx_href.optimizecxx . . $ QRegularExpression#optimize(83f5f38750778ac8).(); |
| 43 | |
| 44 | QRegularExpressionMatchIteratorcxx . . $ QRegularExpressionMatchIterator# it_rx = rx.globalMatchcxx . . $ QRegularExpression#globalMatch(27b5aa3d61ae1b2f).(html); |
| 45 | |
| 46 | while (it_rx.hasNextcxx . . $ QRegularExpressionMatchIterator#hasNext(50ce9a9e25b4a850).()) { |
| 47 | QRegularExpressionMatchcxx . . $ QRegularExpressionMatch# mat_tx = it_rx.nextcxx . . $ QRegularExpressionMatchIterator#next(5870644aafa115db).(); |
| 48 | QStringcxx . . $ QString# link_tag = mat_tx.capturedcxx . . $ QRegularExpressionMatch#captured(3f3c3d0e9c0eb37f).(); |
| 49 | QStringcxx . . $ QString# feed_link = rx_href.matchcxx . . $ QRegularExpression#match(d076266091fa4922).(link_tag).capturedcxx . . $ QRegularExpressionMatch#captured(3f3c3d0e9c0eb37f).(1); |
| 50 | |
| 51 | if (feed_link.startsWithcxx . . $ QString#startsWith(9b0c247ef39438e0).(QL1Scxx . . $ `src/librssguard/definitions/definitions.h:449:9`!("//"))) { |
| 52 | feed_link =cxx . . $ QString#`operator=`(4f35bf974e7f8568). QSLcxx . . $ `src/librssguard/definitions/definitions.h:442:9`!(URI_SCHEME_HTTPcxx . . $ `src/librssguard/definitions/definitions.h:35:9`!) + feed_link.midcxx . . $ QString#mid(5eea715ff28b9227).(2); |
| 53 | } |
| 54 | else if (feed_link.startsWithcxx . . $ QString#startsWith(7cf081d1b6a1defd).(QL1Ccxx . . $ `src/librssguard/definitions/definitions.h:455:9`!('/'))) { |
| 55 | feed_link =cxx . . $ QString#`operator=`(4f35bf974e7f8568). url.toStringcxx . . $ QUrl#toString(632475ebea3355f1).(QUrlcxx . . $ QUrl#::UrlFormattingOptioncxx . . $ QUrl#UrlFormattingOption#::RemovePathcxx . . $ QUrl#RemovePath. |cxx . . $ `operator|`(62016c0c8fcc1dd7). QUrlcxx . . $ QUrl#::UrlFormattingOptioncxx . . $ QUrl#UrlFormattingOption#::RemoveQuerycxx . . $ QUrl#RemoveQuery. |cxx . . $ QUrlTwoFlags#`operator|`(93b783eb06d1455a). |
| 56 | QUrlcxx . . $ QUrl#::UrlFormattingOptioncxx . . $ QUrl#UrlFormattingOption#::StripTrailingSlashcxx . . $ QUrl#StripTrailingSlash.) + |
| 57 | feed_link; |
| 58 | } |
| 59 | |
| 60 | feeds.appendcxx . . $ QList#append(200d2dc08238a4ed).(feed_link); |
| 61 | } |
| 62 | |
| 63 | return feeds; |
| 64 | } |
| 65 | |
| 66 | QPaircxx . . $ QPair#<QByteArraycxx . . $ QByteArray#, QByteArraycxx . . $ QByteArray#> NetworkFactorycxx . . $ NetworkFactory#::generateBasicAuthHeadercxx . . $ NetworkFactory#generateBasicAuthHeader(3d69ae3d4954f7a8).(NetworkAuthenticationcxx . . $ NetworkFactory#NetworkAuthentication# protection, |
| 67 | const QStringcxx . . $ QString#& username, |
| 68 | const QStringcxx . . $ QString#& password) { |
| 69 | switch (protection) { |
| 70 | case NetworkFactorycxx . . $ NetworkFactory#::NetworkAuthenticationcxx . . $ NetworkFactory#NetworkAuthentication#::Basiccxx . . $ NetworkFactory#NetworkAuthentication#Basic.: { |
| 71 | if (username.isEmptycxx . . $ QString#isEmpty(3482b152b9333168).()) { |
| 72 | return {cxx . . $ std/pair#pair(49f6e7a06ebc5aa8).}; |
| 73 | } |
| 74 | else { |
| 75 | QStringcxx . . $ QString# basic_value = username + QSLcxx . . $ `src/librssguard/definitions/definitions.h:442:9`!(":") + password; |
| 76 | QStringcxx . . $ QString# header_value = QSLcxx . . $ `src/librssguard/definitions/definitions.h:442:9`!("Basic ") + QStringcxx . . $ QString#QString(45672f3c6961a244).(basic_value.toUtf8cxx . . $ QString#toUtf8(ef52b713090bc85a).().toBase64cxx . . $ QByteArray#toBase64(8447c4bee9dd4a75).()); |
| 77 | |
| 78 | return QPaircxx . . $ std/pair#pair(14d64bafa7379ebc).<QByteArraycxx . . $ QByteArray#, QByteArraycxx . . $ QByteArray#>(HTTP_HEADERS_AUTHORIZATIONcxx . . $ `src/librssguard/definitions/definitions.h:164:9`!, header_value.toLocal8Bitcxx . . $ QString#toLocal8Bit(ef52b713090bc85a).()); |
| 79 | } |
| 80 | } |
| 81 | |
| 82 | case NetworkFactorycxx . . $ NetworkFactory#::NetworkAuthenticationcxx . . $ NetworkFactory#NetworkAuthentication#::Tokencxx . . $ NetworkFactory#NetworkAuthentication#Token.: { |
| 83 | QStringcxx . . $ QString# header_value = QSLcxx . . $ `src/librssguard/definitions/definitions.h:442:9`!("Bearer ") + username; |
| 84 | |
| 85 | return QPaircxx . . $ std/pair#pair(14d64bafa7379ebc).<QByteArraycxx . . $ QByteArray#, QByteArraycxx . . $ QByteArray#>(HTTP_HEADERS_AUTHORIZATIONcxx . . $ `src/librssguard/definitions/definitions.h:164:9`!, header_value.toLocal8Bitcxx . . $ QString#toLocal8Bit(ef52b713090bc85a).()); |
| 86 | } |
| 87 | |
| 88 | case NetworkFactorycxx . . $ NetworkFactory#::NetworkAuthenticationcxx . . $ NetworkFactory#NetworkAuthentication#::NoAuthenticationcxx . . $ NetworkFactory#NetworkAuthentication#NoAuthentication.: |
| 89 | default: |
| 90 | return {cxx . . $ std/pair#pair(49f6e7a06ebc5aa8).}; |
| 91 | } |
| 92 | } |
| 93 | |
| 94 | QStringcxx . . $ QString# NetworkFactorycxx . . $ NetworkFactory#::networkErrorTextcxx . . $ NetworkFactory#networkErrorText(76e9e349cca0e801).(QNetworkReplycxx . . $ QNetworkReply#::NetworkErrorcxx . . $ QNetworkReply#NetworkError# error_code) { |
| 95 | switch (error_code) { |
| 96 | case QNetworkReplycxx . . $ QNetworkReply#::ProtocolUnknownErrorcxx . . $ QNetworkReply#ProtocolUnknownError.: |
| 97 | case QNetworkReplycxx . . $ QNetworkReply#::ProtocolFailurecxx . . $ QNetworkReply#ProtocolFailure.: |
| 98 | |
| 99 | //: Network status. |
| 100 | return trcxx . . $ NetworkFactory#tr(75d9f1c324b4579d).("protocol error"); |
| 101 | |
| 102 | case QNetworkReplycxx . . $ QNetworkReply#::ContentAccessDeniedcxx . . $ QNetworkReply#ContentAccessDenied.: |
| 103 | return trcxx . . $ NetworkFactory#tr(75d9f1c324b4579d).("access to content was denied"); |
| 104 | |
| 105 | case QNetworkReplycxx . . $ QNetworkReply#::HostNotFoundErrorcxx . . $ QNetworkReply#HostNotFoundError.: |
| 106 | |
| 107 | //: Network status. |
| 108 | return trcxx . . $ NetworkFactory#tr(75d9f1c324b4579d).("host not found"); |
| 109 | |
| 110 | case QNetworkReplycxx . . $ QNetworkReply#::OperationCanceledErrorcxx . . $ QNetworkReply#OperationCanceledError.: |
| 111 | case QNetworkReplycxx . . $ QNetworkReply#::TimeoutErrorcxx . . $ QNetworkReply#TimeoutError.: |
| 112 | return trcxx . . $ NetworkFactory#tr(75d9f1c324b4579d).("connection timed out or was cancelled"); |
| 113 | |
| 114 | case QNetworkReplycxx . . $ QNetworkReply#::RemoteHostClosedErrorcxx . . $ QNetworkReply#RemoteHostClosedError.: |
| 115 | case QNetworkReplycxx . . $ QNetworkReply#::ConnectionRefusedErrorcxx . . $ QNetworkReply#ConnectionRefusedError.: |
| 116 | |
| 117 | //: Network status. |
| 118 | return trcxx . . $ NetworkFactory#tr(75d9f1c324b4579d).("connection refused"); |
| 119 | |
| 120 | case QNetworkReplycxx . . $ QNetworkReply#::ProxyTimeoutErrorcxx . . $ QNetworkReply#ProxyTimeoutError.: |
| 121 | |
| 122 | //: Network status. |
| 123 | return trcxx . . $ NetworkFactory#tr(75d9f1c324b4579d).("connection timed out"); |
| 124 | |
| 125 | case QNetworkReplycxx . . $ QNetworkReply#::SslHandshakeFailedErrorcxx . . $ QNetworkReply#SslHandshakeFailedError.: |
| 126 | |
| 127 | //: Network status. |
| 128 | return trcxx . . $ NetworkFactory#tr(75d9f1c324b4579d).("SSL handshake failed"); |
| 129 | |
| 130 | case QNetworkReplycxx . . $ QNetworkReply#::ProxyConnectionClosedErrorcxx . . $ QNetworkReply#ProxyConnectionClosedError.: |
| 131 | case QNetworkReplycxx . . $ QNetworkReply#::ProxyConnectionRefusedErrorcxx . . $ QNetworkReply#ProxyConnectionRefusedError.: |
| 132 | |
| 133 | //: Network status. |
| 134 | return trcxx . . $ NetworkFactory#tr(75d9f1c324b4579d).("proxy server connection refused"); |
| 135 | |
| 136 | case QNetworkReplycxx . . $ QNetworkReply#::TemporaryNetworkFailureErrorcxx . . $ QNetworkReply#TemporaryNetworkFailureError.: |
| 137 | |
| 138 | //: Network status. |
| 139 | return trcxx . . $ NetworkFactory#tr(75d9f1c324b4579d).("temporary failure"); |
| 140 | |
| 141 | case QNetworkReplycxx . . $ QNetworkReply#::AuthenticationRequiredErrorcxx . . $ QNetworkReply#AuthenticationRequiredError.: |
| 142 | |
| 143 | //: Network status. |
| 144 | return trcxx . . $ NetworkFactory#tr(75d9f1c324b4579d).("authentication failed"); |
| 145 | |
| 146 | case QNetworkReplycxx . . $ QNetworkReply#::ProxyAuthenticationRequiredErrorcxx . . $ QNetworkReply#ProxyAuthenticationRequiredError.: |
| 147 | |
| 148 | //: Network status. |
| 149 | return trcxx . . $ NetworkFactory#tr(75d9f1c324b4579d).("proxy authentication required"); |
| 150 | |
| 151 | case QNetworkReplycxx . . $ QNetworkReply#::ProxyNotFoundErrorcxx . . $ QNetworkReply#ProxyNotFoundError.: |
| 152 | |
| 153 | //: Network status. |
| 154 | return trcxx . . $ NetworkFactory#tr(75d9f1c324b4579d).("proxy server not found"); |
| 155 | |
| 156 | case QNetworkReplycxx . . $ QNetworkReply#::NoErrorcxx . . $ QNetworkReply#NoError.: |
| 157 | |
| 158 | //: Network status. |
| 159 | return trcxx . . $ NetworkFactory#tr(75d9f1c324b4579d).("no errors"); |
| 160 | |
| 161 | case QNetworkReplycxx . . $ QNetworkReply#::UnknownContentErrorcxx . . $ QNetworkReply#UnknownContentError.: |
| 162 | |
| 163 | //: Network status. |
| 164 | return trcxx . . $ NetworkFactory#tr(75d9f1c324b4579d).("unknown content"); |
| 165 | |
| 166 | case QNetworkReplycxx . . $ QNetworkReply#::ContentNotFoundErrorcxx . . $ QNetworkReply#ContentNotFoundError.: |
| 167 | |
| 168 | //: Network status. |
| 169 | return trcxx . . $ NetworkFactory#tr(75d9f1c324b4579d).("content not found"); |
| 170 | |
| 171 | default: { |
| 172 | QMetaEnumcxx . . $ QMetaEnum# enumer = QMetaEnumcxx . . $ QMetaEnum#::fromTypecxx . . $ QMetaEnum#fromType(4ccfc8a907eb718d).<QNetworkReplycxx . . $ QNetworkReply#::NetworkErrorcxx . . $ QNetworkReply#NetworkError#>(); |
| 173 | |
| 174 | //: Network status. |
| 175 | return trcxx . . $ NetworkFactory#tr(75d9f1c324b4579d).("unknown error (%1)").argcxx . . $ QString#arg(ad0bca07273edcc2).(enumer.valueToKeycxx . . $ QMetaEnum#valueToKey(5afb982068bc4a78).(error_code)); |
| 176 | } |
| 177 | } |
| 178 | } |
| 179 | |
| 180 | QStringcxx . . $ QString# NetworkFactorycxx . . $ NetworkFactory#::sanitizeUrlcxx . . $ NetworkFactory#sanitizeUrl(fd988a2ab94d906b).(const QStringcxx . . $ QString#& url) { |
| 181 | static QRegularExpressioncxx . . $ QRegularExpression# reg_non_urlcxx . . $ QRegularExpression#QRegularExpression(4279d2539df7cd4a).(QSLcxx . . $ `src/librssguard/definitions/definitions.h:442:9`!("[^\\w\\-.~:\\/?#\\[\\]@!$&'()*+,;=% \\|]"), |
| 182 | QRegularExpressioncxx . . $ QFlags#QFlags(93d577a3e9528307).::PatternOptioncxx . . $ QRegularExpression#PatternOption#::UseUnicodePropertiesOptioncxx . . $ QRegularExpression#UseUnicodePropertiesOption.); |
| 183 | |
| 184 | return QStringcxx . . $ QString#QString(132dd6869045752b).(url).replacecxx . . $ QString#replace(bb08417d5c5b4bb6).(reg_non_url, {cxx . . $ QString#QString(ced63f7c635d850d).}); |
| 185 | } |
| 186 | |
| 187 | QNetworkReplycxx . . $ QNetworkReply#::NetworkErrorcxx . . $ QNetworkReply#NetworkError# NetworkFactorycxx . . $ NetworkFactory#::downloadIconcxx . . $ NetworkFactory#downloadIcon(78f5e18766962eec).(const QListcxx . . $ QList#<IconLocationcxx . . $ IconLocation#>& urls, |
| 188 | int timeout, |
| 189 | QPixmapcxx . . $ QPixmap#& output, |
| 190 | const QListcxx . . $ QList#<QPaircxx . . $ QPair#<QByteArraycxx . . $ QByteArray#, QByteArraycxx . . $ QByteArray#>>& additional_headers, |
| 191 | const QNetworkProxycxx . . $ QNetworkProxy#& custom_proxy, |
| 192 | Http2Statuscxx . . $ NetworkFactory#Http2Status# http2_status) { |
| 193 | QNetworkReplycxx . . $ QNetworkReply#::NetworkErrorcxx . . $ QNetworkReply#NetworkError# network_result = QNetworkReplycxx . . $ QNetworkReply#::NetworkErrorcxx . . $ QNetworkReply#NetworkError#::UnknownNetworkErrorcxx . . $ QNetworkReply#UnknownNetworkError.; |
| 194 | |
| 195 | for (const auto& url : urls) { |
| 196 | if (url.m_urlcxx . . $ IconLocation#m_url..isEmptycxx . . $ QString#isEmpty(3482b152b9333168).()) { |
| 197 | continue; |
| 198 | } |
| 199 | |
| 200 | QByteArraycxx . . $ QByteArray# icon_datacxx . . $ QByteArray#QByteArray(ced63f7c635d850d).; |
| 201 | |
| 202 | if (url.m_isDirectcxx . . $ IconLocation#m_isDirect.) { |
| 203 | // Download directly. |
| 204 | network_result = performNetworkOperationcxx . . $ NetworkFactory#performNetworkOperation(98c2fa0f32201561).(url.m_urlcxx . . $ IconLocation#m_url., |
| 205 | timeout, |
| 206 | {cxx . . $ QByteArray#QByteArray(ced63f7c635d850d).}, |
| 207 | icon_data, |
| 208 | QNetworkAccessManagercxx . . $ QNetworkAccessManager#::Operationcxx . . $ QNetworkAccessManager#Operation#::GetOperationcxx . . $ QNetworkAccessManager#GetOperation., |
| 209 | additional_headers, |
| 210 | false, |
| 211 | {cxx . . $ QString#QString(ced63f7c635d850d).}, |
| 212 | {cxx . . $ QString#QString(ced63f7c635d850d).}, |
| 213 | custom_proxy, |
| 214 | http2_status) |
| 215 | .m_networkErrorcxx . . $ NetworkResult#m_networkError.; |
| 216 | |
| 217 | if (network_result == QNetworkReplycxx . . $ QNetworkReply#::NetworkErrorcxx . . $ QNetworkReply#NetworkError#::NoErrorcxx . . $ QNetworkReply#NoError.) { |
| 218 | QPixmapcxx . . $ QPixmap# icon_pixmapcxx . . $ QPixmap#QPixmap(49f6e7a06ebc5aa8).; |
| 219 | |
| 220 | icon_pixmap.loadFromDatacxx . . $ QPixmap#loadFromData(1d70edfb0c5061cf).(icon_data); |
| 221 | output =cxx . . $ QPixmap#`operator=`(49583b444411494d). icon_pixmap; |
| 222 | |
| 223 | if (!output.isNullcxx . . $ QPixmap#isNull(50ce9a9e25b4a850).()) { |
| 224 | if (output.widthcxx . . $ QPixmap#width(455f465bc33b4cdf).() > 128) { |
| 225 | output =cxx . . $ QPixmap#`operator=`(4972951fe8d596b5). output.scaledcxx . . $ QPixmap#scaled(53592210f0177908).(QSizecxx . . $ QSize#QSize(c0d38f4800714fae).(48, 48), |
| 226 | Qtcxx . . $ Qt/::AspectRatioModecxx . . $ Qt/AspectRatioMode#::KeepAspectRatiocxx . . $ Qt/KeepAspectRatio., |
| 227 | Qtcxx . . $ Qt/::TransformationModecxx . . $ Qt/TransformationMode#::SmoothTransformationcxx . . $ Qt/SmoothTransformation.); |
| 228 | } |
| 229 | |
| 230 | break; |
| 231 | } |
| 232 | } |
| 233 | } |
| 234 | else { |
| 235 | // Duck Duck Go. |
| 236 | QUrlcxx . . $ QUrl# url_full = QUrlcxx . . $ QUrl#QUrl(ea1f3831e370f1cb).(url.m_urlcxx . . $ IconLocation#m_url.); |
| 237 | QStringcxx . . $ QString# host = url_full.hostcxx . . $ QUrl#host(9d7420bec8bfe6c9).(); |
| 238 | |
| 239 | if (host.startsWithcxx . . $ QString#startsWith(8cce4688c16f48f3).(QSLcxx . . $ `src/librssguard/definitions/definitions.h:442:9`!("www."))) { |
| 240 | host =cxx . . $ QString#`operator=`(4f35bf974e7f8568). host.midcxx . . $ QString#mid(5eea715ff28b9227).(4); |
| 241 | } |
| 242 | |
| 243 | const QStringcxx . . $ QString# ddg_icon_service = QSLcxx . . $ `src/librssguard/definitions/definitions.h:442:9`!("https://external-content.duckduckgo.com/ip3/%1.ico").argcxx . . $ QString#arg(ad0bca07273edcc2).(host); |
| 244 | |
| 245 | // Google S2. |
| 246 | host =cxx . . $ QString#`operator=`(4f35bf974e7f8568). url_full.schemecxx . . $ QUrl#scheme(6ef7b6c27b00b43d).() + QSLcxx . . $ `src/librssguard/definitions/definitions.h:442:9`!("://") + url_full.hostcxx . . $ QUrl#host(9d7420bec8bfe6c9).(); |
| 247 | |
| 248 | const QStringcxx . . $ QString# gs2_icon_service = QSLcxx . . $ `src/librssguard/definitions/definitions.h:442:9`!("https://t2.gstatic.com/faviconV2?" |
| 249 | "client=SOCIAL&type=FAVICON&fallback_opts=TYPE,SIZE,URL&" |
| 250 | "url=%1") |
| 251 | .argcxx . . $ QString#arg(ad0bca07273edcc2).(host); |
| 252 | |
| 253 | for (const QStringcxx . . $ QString#& service : {ddg_icon_service, gs2_icon_service}) { |
| 254 | network_result = performNetworkOperationcxx . . $ NetworkFactory#performNetworkOperation(98c2fa0f32201561).(service, |
| 255 | timeout, |
| 256 | QByteArraycxx . . $ QByteArray#QByteArray(ced63f7c635d850d).(), |
| 257 | icon_data, |
| 258 | QNetworkAccessManagercxx . . $ QNetworkAccessManager#::Operationcxx . . $ QNetworkAccessManager#Operation#::GetOperationcxx . . $ QNetworkAccessManager#GetOperation., |
| 259 | {cxx . . $ QList#QList(ced63f7c635d850d).}, |
| 260 | false, |
| 261 | {cxx . . $ QString#QString(ced63f7c635d850d).}, |
| 262 | {cxx . . $ QString#QString(ced63f7c635d850d).}, |
| 263 | custom_proxy, |
| 264 | http2_status) |
| 265 | .m_networkErrorcxx . . $ NetworkResult#m_networkError.; |
| 266 | |
| 267 | if (network_result == QNetworkReplycxx . . $ QNetworkReply#::NetworkErrorcxx . . $ QNetworkReply#NetworkError#::NoErrorcxx . . $ QNetworkReply#NoError.) { |
| 268 | QPixmapcxx . . $ QPixmap# icon_pixmapcxx . . $ QPixmap#QPixmap(49f6e7a06ebc5aa8).; |
| 269 | |
| 270 | icon_pixmap.loadFromDatacxx . . $ QPixmap#loadFromData(1d70edfb0c5061cf).(icon_data); |
| 271 | output =cxx . . $ QPixmap#`operator=`(49583b444411494d). icon_pixmap; |
| 272 | |
| 273 | if (!output.isNullcxx . . $ QPixmap#isNull(50ce9a9e25b4a850).()) { |
| 274 | if (output.widthcxx . . $ QPixmap#width(455f465bc33b4cdf).() > 128) { |
| 275 | output =cxx . . $ QPixmap#`operator=`(4972951fe8d596b5). output.scaledcxx . . $ QPixmap#scaled(53592210f0177908).(QSizecxx . . $ QSize#QSize(c0d38f4800714fae).(48, 48), |
| 276 | Qtcxx . . $ Qt/::AspectRatioModecxx . . $ Qt/AspectRatioMode#::KeepAspectRatiocxx . . $ Qt/KeepAspectRatio., |
| 277 | Qtcxx . . $ Qt/::TransformationModecxx . . $ Qt/TransformationMode#::SmoothTransformationcxx . . $ Qt/SmoothTransformation.); |
| 278 | } |
| 279 | |
| 280 | break; |
| 281 | } |
| 282 | } |
| 283 | } |
| 284 | } |
| 285 | } |
| 286 | |
| 287 | return network_result; |
| 288 | } |
| 289 | |
| 290 | NetworkResultcxx . . $ NetworkResult# NetworkFactorycxx . . $ NetworkFactory#::performNetworkOperationcxx . . $ NetworkFactory#performNetworkOperation(98c2fa0f32201561).(const QStringcxx . . $ QString#& url, |
| 291 | int timeout, |
| 292 | const QByteArraycxx . . $ QByteArray#& input_data, |
| 293 | QByteArraycxx . . $ QByteArray#& output, |
| 294 | QNetworkAccessManagercxx . . $ QNetworkAccessManager#::Operationcxx . . $ QNetworkAccessManager#Operation# operation, |
| 295 | const QListcxx . . $ QList#<QPaircxx . . $ QPair#<QByteArraycxx . . $ QByteArray#, QByteArraycxx . . $ QByteArray#>>& additional_headers, |
| 296 | bool protected_contents, |
| 297 | const QStringcxx . . $ QString#& username, |
| 298 | const QStringcxx . . $ QString#& password, |
| 299 | const QNetworkProxycxx . . $ QNetworkProxy#& custom_proxy, |
| 300 | Http2Statuscxx . . $ NetworkFactory#Http2Status# http2_status) { |
| 301 | Downloadercxx . . $ Downloader# downloadercxx . . $ Downloader#Downloader(749de1b6ae65bddd).; |
| 302 | QEventLoopcxx . . $ QEventLoop# loopcxx . . $ QEventLoop#QEventLoop(749de1b6ae65bddd).; |
| 303 | NetworkResultcxx . . $ NetworkResult# resultcxx . . $ NetworkResult#NetworkResult(49f6e7a06ebc5aa8).; |
| 304 | |
| 305 | // We need to quit event loop when the download finishes. |
| 306 | QObjectcxx . . $ QObject#::connectcxx . . $ QObject#connect(dad3a9587f3dce3c).(&downloader, &Downloadercxx . . $ Downloader#::completedcxx . . $ Downloader#completed(2e59411b5306353b)., &loop, &QEventLoopcxx . . $ QEventLoop#::quitcxx . . $ QEventLoop#quit(49f6e7a06ebc5aa8).); |
| 307 | |
| 308 | for (const auto& header : additional_headers) { |
| 309 | if (!header.firstcxx . . $ std/pair#first..isEmptycxx . . $ QByteArray#isEmpty(3482b152b9333168).()) { |
| 310 | downloader.appendRawHeadercxx . . $ Downloader#appendRawHeader(a34492a60dbd2bdc).(header.firstcxx . . $ std/pair#first., header.secondcxx . . $ std/pair#second.); |
| 311 | } |
| 312 | } |
| 313 | |
| 314 | if (custom_proxy.typecxx . . $ QNetworkProxy#type(d216d110afa77711).() != QNetworkProxycxx . . $ QNetworkProxy#::ProxyTypecxx . . $ QNetworkProxy#ProxyType#::DefaultProxycxx . . $ QNetworkProxy#DefaultProxy.) { |
| 315 | downloader.setProxycxx . . $ Downloader#setProxy(efbe238af4b4e748).(custom_proxy); |
| 316 | } |
| 317 | |
| 318 | downloader.setHttp2Statuscxx . . $ Downloader#setHttp2Status(b6895be502365f2f).(http2_status); |
| 319 | downloader.manipulateDatacxx . . $ Downloader#manipulateData(6b89976b71ced0d1).(url, operation, input_data, timeout, protected_contents, username, password); |
| 320 | loop.execcxx . . $ QEventLoop#exec(f981dedee5b32481).(); |
| 321 | |
| 322 | output =cxx . . $ QByteArray#`operator=`(c3d647c78c52d790). downloader.lastOutputDatacxx . . $ Downloader#lastOutputData(a96750bfbcb1fbe9).(); |
| 323 | |
| 324 | result.m_networkErrorcxx . . $ NetworkResult#m_networkError. = downloader.lastOutputErrorcxx . . $ Downloader#lastOutputError(c916dcceceba1ae7).(); |
| 325 | result.m_contentTypecxx . . $ NetworkResult#m_contentType. =cxx . . $ QString#`operator=`(4f35bf974e7f8568). downloader.lastContentTypecxx . . $ Downloader#lastContentType(6ef7b6c27b00b43d).(); |
| 326 | result.m_cookiescxx . . $ NetworkResult#m_cookies. =cxx . . $ QList#`operator=`(c5a2fc44cf54fe3f). downloader.lastCookiescxx . . $ Downloader#lastCookies(d667f74267dd00c).(); |
| 327 | result.m_httpCodecxx . . $ NetworkResult#m_httpCode. = downloader.lastHttpStatusCodecxx . . $ Downloader#lastHttpStatusCode(455f465bc33b4cdf).(); |
| 328 | result.m_headerscxx . . $ NetworkResult#m_headers. =cxx . . $ QMap#`operator=`(bb520cca0bf51e2a). downloader.lastHeaderscxx . . $ Downloader#lastHeaders(d2c84686db60f716).(); |
| 329 | result.m_urlcxx . . $ NetworkResult#m_url. =cxx . . $ QUrl#`operator=`(590d023fc9cd4b2d). downloader.lastUrlcxx . . $ Downloader#lastUrl(36d9834fe7321282).(); |
| 330 | |
| 331 | qDebugNNcxx . . $ `src/librssguard/definitions/definitions.h:413:9`! <<cxx . . $ QDebug#`operator<<`(d8a917b173851aad). LOGSEC_NETWORKcxx . . $ `src/librssguard/definitions/definitions.h:168:9`! <<cxx . . $ QDebug#`operator<<`(d8a917b173851aad). "URLS\nRequest: " <<cxx . . $ QDebug#`operator<<`(4cf17434affdd8). url <<cxx . . $ QDebug#`operator<<`(d8a917b173851aad). "\nResponse: " <<cxx . . $ QDebug#`operator<<`(4cf17434affdd8). result.m_urlcxx . . $ NetworkResult#m_url..toStringcxx . . $ QUrl#toString(632475ebea3355f1).(); |
| 332 | |
| 333 | return result; |
| 334 | } |
| 335 | |
| 336 | NetworkResultcxx . . $ NetworkResult# NetworkFactorycxx . . $ NetworkFactory#::performNetworkOperationcxx . . $ NetworkFactory#performNetworkOperation(fd315dc1c02cba94).(const QStringcxx . . $ QString#& url, |
| 337 | int timeout, |
| 338 | QHttpMultiPartcxx . . $ QHttpMultiPart#* input_data, |
| 339 | QListcxx . . $ QList#<HttpResponsecxx . . $ HttpResponse#>& output, |
| 340 | QNetworkAccessManagercxx . . $ QNetworkAccessManager#::Operationcxx . . $ QNetworkAccessManager#Operation# operation, |
| 341 | const QListcxx . . $ QList#<QPaircxx . . $ QPair#<QByteArraycxx . . $ QByteArray#, QByteArraycxx . . $ QByteArray#>>& additional_headers, |
| 342 | bool protected_contents, |
| 343 | const QStringcxx . . $ QString#& username, |
| 344 | const QStringcxx . . $ QString#& password, |
| 345 | const QNetworkProxycxx . . $ QNetworkProxy#& custom_proxy, |
| 346 | Http2Statuscxx . . $ NetworkFactory#Http2Status# http2_status) { |
| 347 | Downloadercxx . . $ Downloader# downloadercxx . . $ Downloader#Downloader(749de1b6ae65bddd).; |
| 348 | QEventLoopcxx . . $ QEventLoop# loopcxx . . $ QEventLoop#QEventLoop(749de1b6ae65bddd).; |
| 349 | NetworkResultcxx . . $ NetworkResult# resultcxx . . $ NetworkResult#NetworkResult(49f6e7a06ebc5aa8).; |
| 350 | |
| 351 | // We need to quit event loop when the download finishes. |
| 352 | QObjectcxx . . $ QObject#::connectcxx . . $ QObject#connect(dad3a9587f3dce3c).(&downloader, &Downloadercxx . . $ Downloader#::completedcxx . . $ Downloader#completed(2e59411b5306353b)., &loop, &QEventLoopcxx . . $ QEventLoop#::quitcxx . . $ QEventLoop#quit(49f6e7a06ebc5aa8).); |
| 353 | |
| 354 | for (const auto& header : additional_headers) { |
| 355 | if (!header.firstcxx . . $ std/pair#first..isEmptycxx . . $ QByteArray#isEmpty(3482b152b9333168).()) { |
| 356 | downloader.appendRawHeadercxx . . $ Downloader#appendRawHeader(a34492a60dbd2bdc).(header.firstcxx . . $ std/pair#first., header.secondcxx . . $ std/pair#second.); |
| 357 | } |
| 358 | } |
| 359 | |
| 360 | if (custom_proxy.typecxx . . $ QNetworkProxy#type(d216d110afa77711).() != QNetworkProxycxx . . $ QNetworkProxy#::ProxyTypecxx . . $ QNetworkProxy#ProxyType#::DefaultProxycxx . . $ QNetworkProxy#DefaultProxy.) { |
| 361 | downloader.setProxycxx . . $ Downloader#setProxy(efbe238af4b4e748).(custom_proxy); |
| 362 | } |
| 363 | |
| 364 | downloader.setHttp2Statuscxx . . $ Downloader#setHttp2Status(b6895be502365f2f).(http2_status); |
| 365 | downloader.manipulateDatacxx . . $ Downloader#manipulateData(3688cabcec565115).(url, operation, input_data, timeout, protected_contents, username, password); |
| 366 | loop.execcxx . . $ QEventLoop#exec(f981dedee5b32481).(); |
| 367 | |
| 368 | output =cxx . . $ QList#`operator=`(649d7ac8216ee099). downloader.lastOutputMultipartDatacxx . . $ Downloader#lastOutputMultipartData(30a835898c73e47).(); |
| 369 | |
| 370 | result.m_networkErrorcxx . . $ NetworkResult#m_networkError. = downloader.lastOutputErrorcxx . . $ Downloader#lastOutputError(c916dcceceba1ae7).(); |
| 371 | result.m_contentTypecxx . . $ NetworkResult#m_contentType. =cxx . . $ QString#`operator=`(4f35bf974e7f8568). downloader.lastContentTypecxx . . $ Downloader#lastContentType(6ef7b6c27b00b43d).(); |
| 372 | result.m_cookiescxx . . $ NetworkResult#m_cookies. =cxx . . $ QList#`operator=`(c5a2fc44cf54fe3f). downloader.lastCookiescxx . . $ Downloader#lastCookies(d667f74267dd00c).(); |
| 373 | result.m_httpCodecxx . . $ NetworkResult#m_httpCode. = downloader.lastHttpStatusCodecxx . . $ Downloader#lastHttpStatusCode(455f465bc33b4cdf).(); |
| 374 | result.m_headerscxx . . $ NetworkResult#m_headers. =cxx . . $ QMap#`operator=`(bb520cca0bf51e2a). downloader.lastHeaderscxx . . $ Downloader#lastHeaders(d2c84686db60f716).(); |
| 375 | result.m_urlcxx . . $ NetworkResult#m_url. =cxx . . $ QUrl#`operator=`(590d023fc9cd4b2d). downloader.lastUrlcxx . . $ Downloader#lastUrl(36d9834fe7321282).(); |
| 376 | |
| 377 | qDebugNNcxx . . $ `src/librssguard/definitions/definitions.h:413:9`! <<cxx . . $ QDebug#`operator<<`(d8a917b173851aad). LOGSEC_NETWORKcxx . . $ `src/librssguard/definitions/definitions.h:168:9`! <<cxx . . $ QDebug#`operator<<`(d8a917b173851aad). "URLS\nRequest: " <<cxx . . $ QDebug#`operator<<`(4cf17434affdd8). url <<cxx . . $ QDebug#`operator<<`(d8a917b173851aad). "\nResponse: " <<cxx . . $ QDebug#`operator<<`(4cf17434affdd8). result.m_urlcxx . . $ NetworkResult#m_url..toStringcxx . . $ QUrl#toString(632475ebea3355f1).(); |
| 378 | |
| 379 | return result; |
| 380 | } |
| 381 | |
| 382 | NetworkResultcxx . . $ NetworkResult#::NetworkResultcxx . . $ NetworkResult#NetworkResult(49f6e7a06ebc5aa8).() |
| 383 | : m_networkErrorcxx . . $ NetworkResult#m_networkError.(QNetworkReplycxx . . $ QNetworkReply#::NetworkErrorcxx . . $ QNetworkReply#NetworkError#::NoErrorcxx . . $ QNetworkReply#NoError.), m_httpCodecxx . . $ NetworkResult#m_httpCode.(0), m_contentTypecxx . . $ NetworkResult#m_contentType.(QStringcxx . . $ QString#QString(ced63f7c635d850d).()), m_cookiescxx . . $ NetworkResult#m_cookies.({cxx . . $ std/initializer_list#initializer_list(ced63f7c635d850d).}), |
| 384 | m_headerscxx . . $ NetworkResult#m_headers.({cxx . . $ std/initializer_list#initializer_list(ced63f7c635d850d).}), m_urlcxx . . $ NetworkResult#m_url.(QUrlcxx . . $ QUrl#QUrl(49f6e7a06ebc5aa8).()) {} |
| 385 | |
| 386 | NetworkResultcxx . . $ NetworkResult#::NetworkResultcxx . . $ NetworkResult#NetworkResult(caab0cfefc35d2e1).(QNetworkReplycxx . . $ QNetworkReply#::NetworkErrorcxx . . $ QNetworkReply#NetworkError# err, |
| 387 | int http_code, |
| 388 | const QStringcxx . . $ QString#& ct, |
| 389 | const QListcxx . . $ QList#<QNetworkCookiecxx . . $ QNetworkCookie#>& cook) |
| 390 | : m_networkErrorcxx . . $ NetworkResult#m_networkError.(err), m_httpCodecxx . . $ NetworkResult#m_httpCode.(http_code), m_contentTypecxx . . $ NetworkResult#m_contentType.(ct), m_cookiescxx . . $ NetworkResult#m_cookies.(cook), m_urlcxx . . $ NetworkResult#m_url.(QUrlcxx . . $ QUrl#QUrl(49f6e7a06ebc5aa8).()) {} |