Skip to content

Commit 9c89d71

Browse files
kshukuwafujii
authored andcommitted
[Curl] Add missing error domain check to ResourceErrorCurl.
https://bugs.webkit.org/show_bug.cgi?id=248920 Reviewed by Fujii Hironori. Add missing error domain check to ResourceError::isSSLCertVerificationError. Also, we delete ResourceError::isSSLConnectError as it is not used. * Source/WebCore/platform/network/curl/ResourceError.h: * Source/WebCore/platform/network/curl/ResourceErrorCurl.cpp: (WebCore::curlErrorDomain): (WebCore::ResourceError::httpError): (WebCore::ResourceError::isSSLCertVerificationError const): (WebCore::ResourceError::isSSLConnectError const): Deleted. Canonical link: https://commits.webkit.org/257546@main
1 parent b647671 commit 9c89d71

File tree

2 files changed

+8
-12
lines changed

2 files changed

+8
-12
lines changed

Source/WebCore/platform/network/curl/ResourceError.h

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -31,8 +31,6 @@
3131
namespace WebCore {
3232

3333
class ResourceError : public ResourceErrorBase {
34-
friend class ResourceErrorBase;
35-
3634
public:
3735
ResourceError(Type type = Type::Null)
3836
: ResourceErrorBase(type)
@@ -46,15 +44,14 @@ class ResourceError : public ResourceErrorBase {
4644

4745
WEBCORE_EXPORT static ResourceError httpError(int errorCode, const URL& failingURL, Type = Type::General);
4846

49-
bool isSSLConnectError() const;
5047
WEBCORE_EXPORT bool isSSLCertVerificationError() const;
5148

5249
static bool platformCompare(const ResourceError& a, const ResourceError& b);
5350

5451
private:
55-
void doPlatformIsolatedCopy(const ResourceError&);
52+
friend class ResourceErrorBase;
5653

57-
static ASCIILiteral curlErrorDomain;
54+
void doPlatformIsolatedCopy(const ResourceError&);
5855
};
5956

6057
} // namespace WebCore

Source/WebCore/platform/network/curl/ResourceErrorCurl.cpp

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -32,21 +32,20 @@
3232

3333
namespace WebCore {
3434

35-
ASCIILiteral ResourceError::curlErrorDomain = "CurlErrorDomain"_s;
36-
37-
ResourceError ResourceError::httpError(int errorCode, const URL& failingURL, Type type)
35+
static const String& curlErrorDomain()
3836
{
39-
return ResourceError(curlErrorDomain, errorCode, failingURL, CurlHandle::errorDescription(static_cast<CURLcode>(errorCode)), type);
37+
static NeverDestroyed<const String> errorDomain(MAKE_STATIC_STRING_IMPL("CurlErrorDomain"));
38+
return errorDomain;
4039
}
4140

42-
bool ResourceError::isSSLConnectError() const
41+
ResourceError ResourceError::httpError(int errorCode, const URL& failingURL, Type type)
4342
{
44-
return errorCode() == CURLE_SSL_CONNECT_ERROR;
43+
return ResourceError(curlErrorDomain(), errorCode, failingURL, CurlHandle::errorDescription(static_cast<CURLcode>(errorCode)), type);
4544
}
4645

4746
bool ResourceError::isSSLCertVerificationError() const
4847
{
49-
return errorCode() == CURLE_PEER_FAILED_VERIFICATION;
48+
return domain() == curlErrorDomain() && errorCode() == CURLE_PEER_FAILED_VERIFICATION;
5049
}
5150

5251
void ResourceError::doPlatformIsolatedCopy(const ResourceError&)

0 commit comments

Comments
 (0)