ObjFW  Diff

Differences From Artifact [90b01a441b]:

To Artifact [fc33672140]:


191
192
193
194
195
196
197

198
199
200
201
202
203
204
  didReceiveIntoBuffer: (unsigned char *)buffer
		length: (size_t)length
		sender: (of_socket_address_t)sender
	       context: (id)context
	     exception: (id)exception;
@end


static OFString *
domainFromHostname(void)
{
	char hostname[256];
	OFString *domain;

	if (gethostname(hostname, 256) != 0)







>







191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
  didReceiveIntoBuffer: (unsigned char *)buffer
		length: (size_t)length
		sender: (of_socket_address_t)sender
	       context: (id)context
	     exception: (id)exception;
@end

#ifndef OF_WII
static OFString *
domainFromHostname(void)
{
	char hostname[256];
	OFString *domain;

	if (gethostname(hostname, 256) != 0)
222
223
224
225
226
227
228

229
230
231
232
233
234
235
		if (pos == OF_NOT_FOUND)
			return nil;

		return [domain substringWithRange:
		    of_range(pos + 1, [domain length] - pos - 1)];
	}
}


static bool
isFQDN(OFString *host, OFDNSResolverSettings *settings)
{
	const char *UTF8String = [host UTF8String];
	size_t length = [host UTF8StringLength];
	unsigned int dots = 0;







>







223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
		if (pos == OF_NOT_FOUND)
			return nil;

		return [domain substringWithRange:
		    of_range(pos + 1, [domain length] - pos - 1)];
	}
}
#endif

static bool
isFQDN(OFString *host, OFDNSResolverSettings *settings)
{
	const char *UTF8String = [host UTF8String];
	size_t length = [host UTF8StringLength];
	unsigned int dots = 0;
853
854
855
856
857
858
859

860
861

862
863
864
865
866
867
868
#ifdef OF_HAVE_IPV6
		_nameServers = [[OFArray alloc]
		    initWithObjects: @"127.0.0.1", @"::1", nil];
#else
		_nameServers = [[OFArray alloc] initWithObject: @"127.0.0.1"];
#endif


	if (_localDomain == nil)
		_localDomain = [domainFromHostname() copy];


	if (_searchDomains == nil) {
		if (_localDomain != nil)
			_searchDomains = [[OFArray alloc]
			    initWithObject: _localDomain];
		else
			_searchDomains = [[OFArray alloc] init];







>


>







855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
#ifdef OF_HAVE_IPV6
		_nameServers = [[OFArray alloc]
		    initWithObjects: @"127.0.0.1", @"::1", nil];
#else
		_nameServers = [[OFArray alloc] initWithObject: @"127.0.0.1"];
#endif

#ifndef OF_WII
	if (_localDomain == nil)
		_localDomain = [domainFromHostname() copy];
#endif

	if (_searchDomains == nil) {
		if (_localDomain != nil)
			_searchDomains = [[OFArray alloc]
			    initWithObject: _localDomain];
		else
			_searchDomains = [[OFArray alloc] init];