Revision: 29252
http://sourceforge.net/p/bibdesk/svn/29252
Author: hofman
Date: 2025-05-01 11:41:23 +0000 (Thu, 01 May 2025)
Log Message:
-----------
cache encoded user and password rather than separrately
Modified Paths:
--------------
trunk/bibdesk/BDSKSRUGroupServer.h
trunk/bibdesk/BDSKSRUGroupServer.m
Modified: trunk/bibdesk/BDSKSRUGroupServer.h
===================================================================
--- trunk/bibdesk/BDSKSRUGroupServer.h 2025-04-30 22:24:59 UTC (rev 29251)
+++ trunk/bibdesk/BDSKSRUGroupServer.h 2025-05-01 11:41:23 UTC (rev 29252)
@@ -56,8 +56,7 @@
NSInteger requestedResults;
NSInteger downloadState;
NSString *errorMessage;
- NSString *user;
- NSString *password;
+ NSString *authorization;
}
@property (class, nonatomic, readonly) NSArray *supportedRecordSyntaxes;
Modified: trunk/bibdesk/BDSKSRUGroupServer.m
===================================================================
--- trunk/bibdesk/BDSKSRUGroupServer.m 2025-04-30 22:24:59 UTC (rev 29251)
+++ trunk/bibdesk/BDSKSRUGroupServer.m 2025-05-01 11:41:23 UTC (rev 29252)
@@ -146,21 +146,22 @@
- (void)startDownloadForRange:(NSRange)range {
if (needsReset) {
- NSString *aUser = nil;
- NSString *aPassword = nil;
- [[self serverInfo] getUsername:&aUser password:&aPassword];
- user = aUser;
- password = aPassword;
+ NSString *user = nil;
+ NSString *password = nil;
+ if ([[self serverInfo] getUsername:&user password:&password])
+ authorization = [[[NSString stringWithFormat:@"%@:%@", user,
password] dataUsingEncoding:NSUTF8StringEncoding]
base64EncodedStringWithOptions:0];
+ else
+ authorization = nil;
}
+
NSString *query = [self searchQueryWithRange:range];
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[self
serverURL]];
[request setHTTPMethod:@"POST"];
[request setValue:@"application/x-www-form-urlencoded; charset=utf-8"
forHTTPHeaderField:@"Content-type"];
[request setHTTPBody:[query dataUsingEncoding:NSUTF8StringEncoding]];
- if (user && password) {
- NSString *authString = [[[NSString stringWithFormat:@"%@:%@", user,
password] dataUsingEncoding:NSUTF8StringEncoding]
base64EncodedStringWithOptions:0];
- [request setValue:[NSString stringWithFormat:@"Basic %@", authString]
forHTTPHeaderField:@"Authorization"];
- }
+ if (authorization)
+ [request setValue:[NSString stringWithFormat:@"Basic %@",
authorization] forHTTPHeaderField:@"Authorization"];
+
[download cancel];
download = [[BDSKDownloader sharedDownloader]
startDataDownloadWithRequest:request delegate:self];
}
This was sent by the SourceForge.net collaborative development platform, the
world's largest Open Source development site.
_______________________________________________
Bibdesk-commit mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/bibdesk-commit