From a800d82a7b12748cd9e4ee89fdb03675cfe812c0 Mon Sep 17 00:00:00 2001 From: CaS Date: Wed, 12 Dec 2001 14:30:59 +0000 Subject: [PATCH] Improved debug a little git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@11712 72102866-910b-0410-8b05-ffd578937521 --- Source/GSHTTPURLHandle.m | 35 +++++++++++++++++++++-------------- 1 file changed, 21 insertions(+), 14 deletions(-) diff --git a/Source/GSHTTPURLHandle.m b/Source/GSHTTPURLHandle.m index 3b9385efd..ae454c571 100644 --- a/Source/GSHTTPURLHandle.m +++ b/Source/GSHTTPURLHandle.m @@ -297,6 +297,8 @@ static void debugWrite(NSData *data) - (void) loadInBackground { NSNotificationCenter *nc; + NSString *host = nil; + NSString *port = nil; /* * Don't start a load if one is in progress. @@ -315,6 +317,8 @@ static void debugWrite(NSData *data) contentLength = 0; if ([[request objectForKey: GSHTTPPropertyProxyHostKey] length] == 0) { + host = [url host]; + port = [url scheme]; if ([[url scheme] isEqualToString: @"https"]) { if (sslClass == 0) @@ -324,15 +328,15 @@ static void debugWrite(NSData *data) return; } sock = [sslClass - fileHandleAsClientInBackgroundAtAddress: [url host] - service: [url scheme] + fileHandleAsClientInBackgroundAtAddress: host + service: port protocol: @"tcp"]; } else { sock = [NSFileHandle - fileHandleAsClientInBackgroundAtAddress: [url host] - service: [url scheme] + fileHandleAsClientInBackgroundAtAddress: host + service: port protocol: @"tcp"]; } } @@ -350,20 +354,20 @@ static void debugWrite(NSData *data) @"https not supported ... needs SSL bundle"]; return; } + host = [request objectForKey: GSHTTPPropertyProxyHostKey]; + port = [request objectForKey: GSHTTPPropertyProxyPortKey]; sock = [sslClass - fileHandleAsClientInBackgroundAtAddress: - [request objectForKey: GSHTTPPropertyProxyHostKey] - service: - [request objectForKey: GSHTTPPropertyProxyPortKey] + fileHandleAsClientInBackgroundAtAddress: host + service: port protocol: @"tcp"]; } else { + host = [request objectForKey: GSHTTPPropertyProxyHostKey]; + port = [request objectForKey: GSHTTPPropertyProxyPortKey]; sock = [NSFileHandle - fileHandleAsClientInBackgroundAtAddress: - [request objectForKey: GSHTTPPropertyProxyHostKey] - service: - [request objectForKey: GSHTTPPropertyProxyPortKey] + fileHandleAsClientInBackgroundAtAddress: host + service: port protocol: @"tcp"]; } } @@ -372,7 +376,8 @@ static void debugWrite(NSData *data) /* * 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; } RETAIN(sock); @@ -409,6 +414,7 @@ static void debugWrite(NSData *data) - (void) bgdConnect: (NSNotification*)notification { NSNotificationCenter *nc = [NSNotificationCenter defaultCenter]; + NSDictionary *userInfo = [notification userInfo]; NSEnumerator *wpEnumerator; NSMutableString *s; @@ -423,7 +429,8 @@ static void debugWrite(NSData *data) e = [userInfo objectForKey: GSFileHandleNotificationError]; 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. */