Improved debug a little

git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@11712 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
CaS 2001-12-12 14:30:59 +00:00
parent 544543d2d2
commit a800d82a7b

View file

@ -297,6 +297,8 @@ static void debugWrite(NSData *data)
- (void) loadInBackground - (void) loadInBackground
{ {
NSNotificationCenter *nc; NSNotificationCenter *nc;
NSString *host = nil;
NSString *port = nil;
/* /*
* Don't start a load if one is in progress. * Don't start a load if one is in progress.
@ -315,6 +317,8 @@ static void debugWrite(NSData *data)
contentLength = 0; contentLength = 0;
if ([[request objectForKey: GSHTTPPropertyProxyHostKey] length] == 0) if ([[request objectForKey: GSHTTPPropertyProxyHostKey] length] == 0)
{ {
host = [url host];
port = [url scheme];
if ([[url scheme] isEqualToString: @"https"]) if ([[url scheme] isEqualToString: @"https"])
{ {
if (sslClass == 0) if (sslClass == 0)
@ -324,15 +328,15 @@ static void debugWrite(NSData *data)
return; return;
} }
sock = [sslClass sock = [sslClass
fileHandleAsClientInBackgroundAtAddress: [url host] fileHandleAsClientInBackgroundAtAddress: host
service: [url scheme] service: port
protocol: @"tcp"]; protocol: @"tcp"];
} }
else else
{ {
sock = [NSFileHandle sock = [NSFileHandle
fileHandleAsClientInBackgroundAtAddress: [url host] fileHandleAsClientInBackgroundAtAddress: host
service: [url scheme] service: port
protocol: @"tcp"]; protocol: @"tcp"];
} }
} }
@ -350,20 +354,20 @@ static void debugWrite(NSData *data)
@"https not supported ... needs SSL bundle"]; @"https not supported ... needs SSL bundle"];
return; return;
} }
host = [request objectForKey: GSHTTPPropertyProxyHostKey];
port = [request objectForKey: GSHTTPPropertyProxyPortKey];
sock = [sslClass sock = [sslClass
fileHandleAsClientInBackgroundAtAddress: fileHandleAsClientInBackgroundAtAddress: host
[request objectForKey: GSHTTPPropertyProxyHostKey] service: port
service:
[request objectForKey: GSHTTPPropertyProxyPortKey]
protocol: @"tcp"]; protocol: @"tcp"];
} }
else else
{ {
host = [request objectForKey: GSHTTPPropertyProxyHostKey];
port = [request objectForKey: GSHTTPPropertyProxyPortKey];
sock = [NSFileHandle sock = [NSFileHandle
fileHandleAsClientInBackgroundAtAddress: fileHandleAsClientInBackgroundAtAddress: host
[request objectForKey: GSHTTPPropertyProxyHostKey] service: port
service:
[request objectForKey: GSHTTPPropertyProxyPortKey]
protocol: @"tcp"]; protocol: @"tcp"];
} }
} }
@ -372,7 +376,8 @@ static void debugWrite(NSData *data)
/* /*
* Tell superclass that the load failed - let it do housekeeping. * Tell superclass that the load failed - let it do housekeeping.
*/ */
[self backgroundLoadDidFailWithReason: @"Unable to connect to host"]; [self backgroundLoadDidFailWithReason: [NSString stringWithFormat:
@"Unable to connect to %@:%@", host, port]];
return; return;
} }
RETAIN(sock); RETAIN(sock);
@ -409,6 +414,7 @@ static void debugWrite(NSData *data)
- (void) bgdConnect: (NSNotification*)notification - (void) bgdConnect: (NSNotification*)notification
{ {
NSNotificationCenter *nc = [NSNotificationCenter defaultCenter]; NSNotificationCenter *nc = [NSNotificationCenter defaultCenter];
NSDictionary *userInfo = [notification userInfo]; NSDictionary *userInfo = [notification userInfo];
NSEnumerator *wpEnumerator; NSEnumerator *wpEnumerator;
NSMutableString *s; NSMutableString *s;
@ -423,7 +429,8 @@ static void debugWrite(NSData *data)
e = [userInfo objectForKey: GSFileHandleNotificationError]; e = [userInfo objectForKey: GSFileHandleNotificationError];
if (e != nil) if (e != nil)
{ {
NSLog(@"Unable to connect via socket"); NSLog(@"Unable to connect to %@:%@ via socket",
[sock socketAddress], [sock socketService]);
/* /*
* Tell superclass that the load failed - let it do housekeeping. * Tell superclass that the load failed - let it do housekeeping.
*/ */