Page MenuHomePhabricator

User agent strings (for UIWebView and NSURLConnection requests) need to be updated
Closed, ResolvedPublic

Description

Author: benrimmington

Description:
The project contains four UIWebView requests with a custom HTTP header field.

... setValue:@"Wikipedia Mobile/2.0" forHTTPHeaderField:@"User_Agent"];

UIWebView's default "User-Agent" field should be enough (see Bug 28884). Otherwise, the "Wikipedia Mobile/2.0" value contains an invalid space character, and an out-of-date version number.

There's also an action=opensearch request (using NSURLConnection) without a custom "User-Agent" value. Is the default value suitable?

Should the code for creating requests be refactored into a category of NSMutableURLRequest?


Version: 1.0.0 (Android)
Severity: trivial
OS: other
Platform: Other

Details

Reference
bz28905

Related Objects

StatusSubtypeAssignedTask
ResolvedNone
ResolvedNone
ResolvedNone
Resolvedyuvipanda
Resolved brion
ResolvedNone
ResolvedNone
ResolvedNone
ResolvedNone
ResolvedNone
ResolvedNone
ResolvedNone
ResolvedNone
ResolvedNone
ResolvedNone
Resolved Tfinc
ResolvedNone
Resolved Tfinc
ResolvedNone
Resolved brion
DeclinedNone
ResolvedNone
ResolvedNone
ResolvedNone
ResolvedNone
ResolvedNone
ResolvedNone

Event Timeline

bzimport raised the priority of this task from to Medium.Nov 21 2014, 11:26 PM
bzimport set Reference to bz28905.
bzimport added a subscriber: Unknown Object (MLST).

benrimmington wrote:

+[NSMutableURLRequest(Wikipedia) wikipedia_requestWithURL:] method.

Attached:

This ain't an in browser XHR request, bug 28884 doesn't apply here - the app should have its own user-agent. It should not use the underlying library's User-Agent.

Putting a User_agent header isn't illegal (Well i guess if you get technical non-standardized headers should start with x-) its just rather pointless.

benrimmington wrote:

(In reply to comment #2)

This ain't an in browser XHR request, bug 28884 doesn't apply here - the app
should have its own user-agent. It should not use the underlying library's
User-Agent.

RootViewController and WikiViewController are using UIWebView to load requests, so the policy for browser-based applications should apply.

RootViewController is also using NSURLConnection to request action=opensearch results, but the default User-Agent might be sufficient:

http://stackoverflow.com/questions/1532206/changing-the-useragent-of-nsurlconnection

(I'm not sure how to verify that the app name and version are included by default).

Putting a User_agent header isn't illegal (Well i guess if you get technical
non-standardized headers should start with x-) its just rather pointless.

The main issue with the User_Agent strings is the hard-coded version number (it's using "Wikipedia Mobile/2.0", but the current CFBundleVersion is 2.1).

This has now been fixed with the new PhoneGap build.