AFNetworking/AFNetworking — pull request #1865 by dkasper (2014-02-28 18:29:40+00:00)
Title: Fix domain name validation for wildcard SSL certificates

Currently the number of components must match with validatesDomainName, but this fails a couple of cases.
1) *.domain.com doesn't match domain.com
2) *.domain.com doesn't match x.y.domain.com

Fix this by doing pairwise comparison between the components, starting at the end
If we hit a wildcard and it is the last component then return YES
If we hit a wildcard and it is not the last component then skip the comparison for that component.

This is relevant to https://github.com/AFNetworking/AFNetworking/issues/1852 also.