Showing
2 changed files
with
29 additions
and
4 deletions
| @@ -89,7 +89,11 @@ NSLock *dialogLock = nil; | @@ -89,7 +89,11 @@ NSLock *dialogLock = nil; | ||
| 89 | [items addObject:backButton]; | 89 | [items addObject:backButton]; |
| 90 | 90 | ||
| 91 | label = [[UILabel alloc] initWithFrame:CGRectMake(0,0,170,50)]; | 91 | label = [[UILabel alloc] initWithFrame:CGRectMake(0,0,170,50)]; |
| 92 | - [label setText:[[[self request] url] host]]; | 92 | + if ([self type] == ASIProxyAuthenticationType) { |
| 93 | + [label setText:[[self request] proxyHost]]; | ||
| 94 | + } else { | ||
| 95 | + [label setText:[[[self request] url] host]]; | ||
| 96 | + } | ||
| 93 | [label setTextColor:[UIColor whiteColor]]; | 97 | [label setTextColor:[UIColor whiteColor]]; |
| 94 | [label setFont:[UIFont boldSystemFontOfSize:22.0]]; | 98 | [label setFont:[UIFont boldSystemFontOfSize:22.0]]; |
| 95 | [label setShadowColor:[UIColor colorWithRed:0 green:0 blue:0 alpha:0.5]]; | 99 | [label setShadowColor:[UIColor colorWithRed:0 green:0 blue:0 alpha:0.5]]; |
| @@ -122,10 +126,30 @@ NSLock *dialogLock = nil; | @@ -122,10 +126,30 @@ NSLock *dialogLock = nil; | ||
| 122 | 126 | ||
| 123 | - (void)loginWithCredentialsFromDialog:(id)sender | 127 | - (void)loginWithCredentialsFromDialog:(id)sender |
| 124 | { | 128 | { |
| 125 | - [[self request] setUsername:[[[[[[[self loginDialog] subviews] objectAtIndex:0] cellForRowAtIndexPath:[NSIndexPath indexPathForRow:0 inSection:0]] subviews] objectAtIndex:2] text]]; | 129 | + NSString *username = [[[[[[[self loginDialog] subviews] objectAtIndex:0] cellForRowAtIndexPath:[NSIndexPath indexPathForRow:0 inSection:0]] subviews] objectAtIndex:2] text]; |
| 126 | - [[self request] setPassword:[[[[[[[self loginDialog] subviews] objectAtIndex:0] cellForRowAtIndexPath:[NSIndexPath indexPathForRow:0 inSection:1]] subviews] objectAtIndex:2] text]]; | 130 | + NSString *password = [[[[[[[self loginDialog] subviews] objectAtIndex:0] cellForRowAtIndexPath:[NSIndexPath indexPathForRow:0 inSection:1]] subviews] objectAtIndex:2] text]; |
| 131 | + | ||
| 132 | + if ([self type] == ASIProxyAuthenticationType) { | ||
| 133 | + [[self request] setProxyUsername:username]; | ||
| 134 | + [[self request] setProxyPassword:password]; | ||
| 135 | + } else { | ||
| 136 | + [[self request] setUsername:username]; | ||
| 137 | + [[self request] setPassword:password]; | ||
| 138 | + } | ||
| 139 | + | ||
| 140 | + // Handle NTLM domains | ||
| 141 | + NSString *scheme = ([self type] == ASIStandardAuthenticationType) ? [[self request] authenticationScheme] : [[self request] proxyAuthenticationScheme]; | ||
| 142 | + if ([scheme isEqualToString:(NSString *)kCFHTTPAuthenticationSchemeNTLM]) { | ||
| 143 | + NSString *domain = [[[[[[[self loginDialog] subviews] objectAtIndex:0] cellForRowAtIndexPath:[NSIndexPath indexPathForRow:0 inSection:2]] subviews] objectAtIndex:2] text]; | ||
| 144 | + if ([self type] == ASIProxyAuthenticationType) { | ||
| 145 | + [[self request] setProxyDomain:domain]; | ||
| 146 | + } else { | ||
| 147 | + [[self request] setDomain:domain]; | ||
| 148 | + } | ||
| 149 | + } | ||
| 150 | + | ||
| 127 | [[self loginDialog] dismissWithClickedButtonIndex:1 animated:YES]; | 151 | [[self loginDialog] dismissWithClickedButtonIndex:1 animated:YES]; |
| 128 | - [[self request] retryWithAuthentication]; | 152 | + [[self request] retryUsingSuppliedCredentials]; |
| 129 | } | 153 | } |
| 130 | 154 | ||
| 131 | 155 |
| @@ -163,6 +163,7 @@ static NSRecursiveLock *delegateAuthenticationLock = nil; | @@ -163,6 +163,7 @@ static NSRecursiveLock *delegateAuthenticationLock = nil; | ||
| 163 | [self setShouldResetProgressIndicators:YES]; | 163 | [self setShouldResetProgressIndicators:YES]; |
| 164 | [self setAllowCompressedResponse:YES]; | 164 | [self setAllowCompressedResponse:YES]; |
| 165 | [self setDefaultResponseEncoding:NSISOLatin1StringEncoding]; | 165 | [self setDefaultResponseEncoding:NSISOLatin1StringEncoding]; |
| 166 | + [self setShouldPresentProxyAuthenticationDialog:YES]; | ||
| 166 | 167 | ||
| 167 | [self setTimeOutSeconds:10]; | 168 | [self setTimeOutSeconds:10]; |
| 168 | [self setUseSessionPersistance:YES]; | 169 | [self setUseSessionPersistance:YES]; |
-
Please register or login to post a comment