Commit ee32658e authored by mrowe@apple.com's avatar mrowe@apple.com

Set a sensible user agent string for the HTTP requests that Sparkle makes...

Set a sensible user agent string for the HTTP requests that Sparkle makes (checking for and downloading updates).

Reviewed by Sam Weinig.

* WebKitLauncher/WebKitNightlyEnablerSparkle.m:
(userAgentStringForSparkle):
(initializeSparkle):

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@44925 268f45cc-cd09-0410-ab3c-d52691b4dbfc
parent c72459b2
2009-06-21 Mark Rowe <mrowe@apple.com>
Reviewed by Sam Weinig.
Set a sensible user agent string for the HTTP requests that Sparkle makes (checking for and downloading updates).
* WebKitLauncher/WebKitNightlyEnablerSparkle.m:
(userAgentStringForSparkle):
(initializeSparkle):
2009-06-21 Mark Rowe <mrowe@apple.com>
Reviewed by Sam Weinig.
......
......@@ -122,6 +122,17 @@ static void setMethodImplementation(Method m, IMP imp)
#endif
static NSString *userAgentStringForSparkle()
{
NSBundle *safariBundle = [NSBundle mainBundle];
NSString *safariVersion = [[safariBundle localizedInfoDictionary] valueForKey:@"CFBundleShortVersionString"];
NSString *safariBuild = [[[safariBundle infoDictionary] valueForKey:(NSString *)kCFBundleVersionKey] substringFromIndex:1];
NSString *webKitRevision = [[webKitLauncherBundle() infoDictionary] valueForKey:(NSString *)kCFBundleVersionKey];
NSString *applicationName = [NSString stringWithFormat:@"Version/%@ Safari/%@ WebKitRevision/%@", safariVersion, safariBuild, webKitRevision];
Class WebView = objc_lookUpClass("WebView");
return objc_msgSend(WebView, @selector(_standardUserAgentWithApplicationName:), applicationName);
}
void initializeSparkle()
{
// Override some Sparkle behaviour
......@@ -135,6 +146,7 @@ void initializeSparkle()
setMethodImplementation(methodToPatch, (IMP)updateAlertInitForAlertPanel);
SUUpdater *updater = [SUUpdater updaterForBundle:webKitLauncherBundle()];
[updater setUserAgentString:userAgentStringForSparkle()];
// Find the first separator on the Safari menu…
NSMenu *applicationSubmenu = [[[NSApp mainMenu] itemAtIndex:0] submenu];
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment