Committed by
Ben Copsey
Don't step on a previously-specified user-agent
Signed-off-by: Ben Copsey <ben@allseeing-i.com>
Showing
1 changed file
with
2 additions
and
0 deletions
@@ -391,6 +391,7 @@ static NSError *ASITooMuchRedirectionError; | @@ -391,6 +391,7 @@ static NSError *ASITooMuchRedirectionError; | ||
391 | 391 | ||
392 | // Set a logical user agent (on iPhones, for now) | 392 | // Set a logical user agent (on iPhones, for now) |
393 | #if TARGET_OS_IPHONE | 393 | #if TARGET_OS_IPHONE |
394 | + if ([[self requestHeaders] objectForKey:@"User-Agent"] == nil) { | ||
394 | UIDevice *device = [UIDevice currentDevice]; | 395 | UIDevice *device = [UIDevice currentDevice]; |
395 | NSBundle *bundle = [NSBundle mainBundle]; | 396 | NSBundle *bundle = [NSBundle mainBundle]; |
396 | NSLocale *locale = [NSLocale currentLocale]; | 397 | NSLocale *locale = [NSLocale currentLocale]; |
@@ -405,6 +406,7 @@ static NSError *ASITooMuchRedirectionError; | @@ -405,6 +406,7 @@ static NSError *ASITooMuchRedirectionError; | ||
405 | ]; | 406 | ]; |
406 | 407 | ||
407 | [self addRequestHeader:@"User-Agent" value:userAgent]; | 408 | [self addRequestHeader:@"User-Agent" value:userAgent]; |
409 | + } | ||
408 | #endif | 410 | #endif |
409 | 411 | ||
410 | // Accept a compressed response | 412 | // Accept a compressed response |
-
Please register or login to post a comment