Closed Bug 1316204 Opened 9 years ago Closed 9 years ago

Don't include non-ASCII characters (e.g., emoji) in User-Agent strings

Categories

(Firefox for iOS :: General, defect, P1)

All
iOS
defect

Tracking

()

RESOLVED FIXED
Iteration:
1.9
Tracking Status
fxios-v6.0 --- fixed
fxios-v7.0 --- fixed

People

(Reporter: farhan, Assigned: farhan)

References

Details

(Whiteboard: [mobileAS])

Attachments

(1 file)

55 bytes, text/x-github-pull-request
sleroux
: review+
Details | Review
The emoji I've added to the nightly build bundle name is breaking the testSyncUA test. What do we want to do with this test? I really like the emojis! So lets try to fix/disable this test for nightly only? How important is this test? Cause of course emojis are more important
edit: I was being sarcastic at the end there. I even added an emoji to signal that. But bugzilla removed it. :(
Flags: needinfo?(sleroux)
Darn. I like the emojis too. We might be able to make the regex less strict in its checking or find a way to match against a unicode character for the emoji. Looking at the regex, I'm sure weakening the the regex check devalues the test a bit but I'm not sure if it's that big of a deal. A more forgiving regex could be: ^Firefox-iOS-Sync/[0-9\\.]+ .* This would match the prefix of the strings and version and just leave the app name part to be whatever.
Flags: needinfo?(sleroux)
The User-Agent header must only contain ASCII. See e.g., Bug 1188550. Don't weaken the test, fix the code.
A more thorough response: RFC 2616 specifies that User-Agent consists of product and version strings, which are composed of tokens. Token is defined as token = 1*<any CHAR except CTLs or separators> separators = "(" | ")" | "<" | ">" | "@" | "," | ";" | ":" | "\" | <"> | "/" | "[" | "]" | "?" | "=" | "{" | "}" | SP | HT CHAR = <any US-ASCII character (octets 0 - 127)> CTL = <any US-ASCII control character (octets 0 - 31) and DEL (127)> product = token ["/" product-version] product-version = token User-Agent = "User-Agent" ":" 1*( product | comment ) Examples: User-Agent: CERN-LineMode/2.15 libwww/2.17b3 This is why Android has MOZ_APP_ASCII_DISPLAYNAME, so that the User-Agent string it sends is plain ASCII. If you don't do this correctly, you make Firefox diverge from the HTTP specs, and that's a bad thing.
Component: Build & Test → General
Hardware: Other → All
Summary: Emojis in beta/nightly build names breaks a test → Don't include non-ASCII characters (e.g., emoji) in User-Agent strings
Blocks: 1317439
Assignee: nobody → fpatel
Iteration: --- → 1.9
Priority: -- → P1
Whiteboard: [mobileAS]
Attached file Pull Request
Lets remove the emoji as failing tests are not a good thing to have.
Attachment #8812280 - Flags: review?(sleroux)
Why not just fix the UA while keeping the emoji in the app name?
Attachment #8812280 - Flags: review?(sleroux) → review+
We could do that. If it was something important it might have been worth it to make changes to how we handle UA and display names. But for something small like this the path of least resistance is just to revert it back to normal. :(
Heh, OK. I think the fix would be pretty straightforward if we wanted to keep them though -- we could just fall back to "Firefox" instead of the app name if the AppConstants.BuildChannel == Aurora/Beta/Nightly. Up to you! :winkemoji:
Ah I see. I'll look into this. But for now, I'll close this one. master https://github.com/mozilla-mobile/firefox-ios/commit/5d748436938c2088756ade1009cf5f4944486247
Status: NEW → RESOLVED
Closed: 9 years ago
Resolution: --- → FIXED
Whiteboard: [mobileAS] → [mobileAS][needsuplift]
v6.x 3a0227a
Whiteboard: [mobileAS][needsuplift] → [mobileAS]
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: