Add GSTLSServerName option

This commit is contained in:
Richard Frith-Macdonald 2018-05-18 20:26:35 +01:00
parent 09da1e6894
commit ed286536e2
8 changed files with 91 additions and 7 deletions

View file

@ -882,6 +882,7 @@ static NSURLProtocol *placeholder = nil;
GSTLSPriority,
GSTLSRemoteHosts,
GSTLSRevokeFile,
GSTLSServerName,
GSTLSVerify,
nil];
}
@ -896,6 +897,20 @@ static NSURLProtocol *placeholder = nil;
[this->output setProperty: str forKey: key];
}
}
/* If there is no value set for the server name, and the host in the
* URL is a domain name rather than an address, we use that.
*/
if (nil == [this->output propertyForKey: GSTLSServerName])
{
NSString *host = [url host];
unichar c;
c = [host length] == 0 ? 0 : [host characterAtIndex: 0];
if (c != 0 && c != ':' && !isdigit(c))
{
[this->output setProperty: host forKey: GSTLSServerName];
}
}
if (_debug) [this->output setProperty: @"YES" forKey: GSTLSDebug];
}
[this->input setDelegate: self];