Andy Fowler
Committed by Ben Copsey

Don't step on a previously-specified user-agent

Signed-off-by: Ben Copsey <ben@allseeing-i.com>
... ... @@ -391,20 +391,22 @@ static NSError *ASITooMuchRedirectionError;
// Set a logical user agent (on iPhones, for now)
#if TARGET_OS_IPHONE
UIDevice *device = [UIDevice currentDevice];
NSBundle *bundle = [NSBundle mainBundle];
NSLocale *locale = [NSLocale currentLocale];
NSString *userAgent = [NSString stringWithFormat:@"%@ %@ (%@; %@ %@; %@)",
[bundle objectForInfoDictionaryKey:@"CFBundleDisplayName"],
[bundle objectForInfoDictionaryKey:@"CFBundleVersion"],
[device model],
[device systemName],
[device systemVersion],
[locale localeIdentifier]
];
[self addRequestHeader:@"User-Agent" value:userAgent];
if ([[self requestHeaders] objectForKey:@"User-Agent"] == nil) {
UIDevice *device = [UIDevice currentDevice];
NSBundle *bundle = [NSBundle mainBundle];
NSLocale *locale = [NSLocale currentLocale];
NSString *userAgent = [NSString stringWithFormat:@"%@ %@ (%@; %@ %@; %@)",
[bundle objectForInfoDictionaryKey:@"CFBundleDisplayName"],
[bundle objectForInfoDictionaryKey:@"CFBundleVersion"],
[device model],
[device systemName],
[device systemVersion],
[locale localeIdentifier]
];
[self addRequestHeader:@"User-Agent" value:userAgent];
}
#endif
// Accept a compressed response
... ...