My favorites | Sign in
Project Home
READ-ONLY: This project has been archived. For more information see this post.
Search
for
  Advanced search   Search tips   Subscriptions

Issue 15 attachment: xpathleak.diff (3.7 KB)

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
Index: version.h
===================================================================
--- version.h (revision 88378)
+++ version.h (working copy)
@@ -20,5 +20,6 @@
#define SCROBBLER_ID @"aip"
#define SCROBBLER_VERSION @"2.0"
#define VERSION_STRING @"Mobile Last.fm 1.0.0"
-#define USER_AGENT [NSString stringWithFormat:@"MobileLastFM/1.0.0 (%@; %@ %@)", [UIDevice currentDevice].model, [UIDevice currentDevice].systemName, [UIDevice currentDevice].systemVersion]
#define VERSION @"1.0.0"
+
+extern NSString *kUserAgent;
\ No newline at end of file
Index: Classes/LastFMService.m
===================================================================
--- Classes/LastFMService.m (revision 88378)
+++ Classes/LastFMService.m (working copy)
@@ -97,7 +97,7 @@
theResponseData = [NSData dataWithContentsOfFile:CACHE_FILE([signature md5sum])];
} else {
NSMutableURLRequest *theRequest = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:[NSString stringWithFormat:@"%s", API_URL]] cachePolicy:NSURLRequestReloadIgnoringCacheData timeoutInterval:[((MobileLastFMApplicationDelegate *)[UIApplication sharedApplication].delegate) hasWiFiConnection]?40:60];
- [theRequest setValue:USER_AGENT forHTTPHeaderField:@"User-Agent"];
+ [theRequest setValue:kUserAgent forHTTPHeaderField:@"User-Agent"];
[theRequest setHTTPMethod:@"POST"];
[theRequest setHTTPBody:[[NSString stringWithFormat:@"%@&api_sig=%@", [sortedParams componentsJoinedByString:@"&"], [signature md5sum]] dataUsingEncoding:NSUTF8StringEncoding]];

Index: Classes/MobileLastFMApplicationDelegate.m
===================================================================
--- Classes/MobileLastFMApplicationDelegate.m (revision 88378)
+++ Classes/MobileLastFMApplicationDelegate.m (working copy)
@@ -23,6 +23,8 @@
#import "PlaybackViewController.h"
#include "version.h"

+NSString *kUserAgent;
+
@implementation MobileLastFMApplicationDelegate

@synthesize window;
@@ -60,7 +62,8 @@
}
- (id)init {
if (self = [super init]) {
- NSLog(@"%@", USER_AGENT);
+ kUserAgent = [[NSString alloc] initWithFormat:@"MobileLastFM/%@ (%@; %@; %@ %@)", VERSION, [UIDevice currentDevice].model, [[[NSUserDefaults standardUserDefaults] objectForKey: @"AppleLanguages"] objectAtIndex:0], [UIDevice currentDevice].systemName, [UIDevice currentDevice].systemVersion];
+ NSLog(@"%@", kUserAgent);
[[NSUserDefaults standardUserDefaults] registerDefaults:[NSDictionary dictionaryWithObjectsAndKeys:
[NSNumber numberWithFloat: 0.8], @"volume",
[NSNumber numberWithInt:0], @"discovery",
@@ -254,7 +257,7 @@
}
-(NSURLRequest *)requestWithURL:(NSURL *)url {
NSMutableURLRequest *req = [NSMutableURLRequest requestWithURL:url];
- [req setValue:USER_AGENT forHTTPHeaderField:@"User-Agent"];
+ [req setValue:kUserAgent forHTTPHeaderField:@"User-Agent"];
[req setTimeoutInterval:[self hasWiFiConnection]?40:60];
return req;
}
Index: Classes/LastFMRadio.m
===================================================================
--- Classes/LastFMRadio.m (revision 88378)
+++ Classes/LastFMRadio.m (working copy)
@@ -335,7 +335,7 @@

NSURL *trackURL = [NSURL URLWithString:[[_playlist objectAtIndex:0] objectForKey:@"location"]];
NSMutableURLRequest *theRequest = [NSMutableURLRequest requestWithURL:trackURL cachePolicy:NSURLRequestReloadIgnoringCacheData timeoutInterval:[((MobileLastFMApplicationDelegate *)[UIApplication sharedApplication].delegate) hasWiFiConnection]?40:60];
- [theRequest setValue:USER_AGENT forHTTPHeaderField:@"User-Agent"];
+ [theRequest setValue:kUserAgent forHTTPHeaderField:@"User-Agent"];
NSLog(@"Streaming: %@\n", trackURL);
if(_connection) [_connection release];
_connection=[[NSURLConnection alloc] initWithRequest:theRequest delegate:self];
Powered by Google Project Hosting