You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Sep 15, 2025. It is now read-only.
Copy file name to clipboardExpand all lines: WordPressKit/WordPressOrgXMLRPCValidator.swift
+13-2Lines changed: 13 additions & 2 deletions
Original file line number
Diff line number
Diff line change
@@ -11,6 +11,7 @@ import CocoaLumberjack
11
11
case forbidden =403 // Server returned a 403 error while reading xmlrpc file
12
12
case blocked =405 // Server returned a 405 error while reading xmlrpc file
13
13
case invalid // Doesn't look to be valid XMLRPC Endpoint.
14
+
case xmlrpc_missing // site contains RSD link but XML-RPC information is missing
14
15
15
16
publicvarlocalizedDescription:String{
16
17
switch(self){
@@ -25,11 +26,13 @@ import CocoaLumberjack
25
26
case.mobilePluginRedirectedError:
26
27
returnNSLocalizedString("You seem to have installed a mobile plugin from DudaMobile which is preventing the app to connect to your blog", comment:"")
27
28
case.invalid:
28
-
returnNSLocalizedString("We're sure this is a great site - but it's not a WordPress site, so you can't connect to it with this app.", comment:"Error message shown a URL points to a valid site but not a WordPress site.")
29
+
returnNSLocalizedString("Couldn't connect to the WordPress site. There is no valid WordPress site at this address. Check the site address (URL) you entered.", comment:"Error message shown a URL points to a valid site but not a WordPress site.")
29
30
case.blocked:
30
31
returnNSLocalizedString("Couldn't connect. Your host is blocking POST requests, and the app needs that in order to communicate with your site. Contact your host to solve this problem.", comment:"Message to show to user when he tries to add a self-hosted site but the host returned a 405 error, meaning that the host is blocking POST requests on /xmlrpc.php file.")
31
32
case.forbidden:
32
33
returnNSLocalizedString("Couldn't connect. We received a 403 error when trying to access your site XMLRPC endpoint. The app needs that in order to communicate with your site. Contact your host to solve this problem.", comment:"Message to show to user when he tries to add a self-hosted site but the host returned a 403 error, meaning that the access to the /xmlrpc.php file is forbidden.")
34
+
case.xmlrpc_missing:
35
+
returnNSLocalizedString("Couldn't connect. Required XML-RPC methods are missing on the server.", comment:"Message to show to user when he tries to add a self-hosted site with RSD link present, but xmlrpc is missing.")
33
36
}
34
37
}
35
38
}
@@ -192,6 +195,7 @@ open class WordPressOrgXMLRPCValidator: NSObject {
192
195
redirectCount:Int=0,
193
196
success:@escaping(_ xmlrpcURL:URL)->(),
194
197
failure:@escaping(_ error:NSError)->()){
198
+
195
199
guard redirectCount < redirectLimit else{
196
200
leterror=NSError(domain:URLError.errorDomain,
197
201
code:URLError.httpTooManyRedirects.rawValue,
@@ -247,6 +251,8 @@ open class WordPressOrgXMLRPCValidator: NSObject {
247
251
success:@escaping(_ xmlrpcURL:URL)->(),
248
252
failure:@escaping(_ error:NSError)->()){
249
253
DDLogInfo("Fetch the original url and look for the RSD link by using RegExp")
0 commit comments