Signal-iOS/SignalServiceKit/tests
Evan Hahn bf8fd72fba
Improve Accept-Language header value, fixing registration bug
Some users [are unable to register][1] because the server [returns a 400
error][2] if passed an invalid `Accept-Language` header.

This commit helps prevent two possible error modes:

- Filters out invalid language tags. Some users reported a "Workshopx"
  language, which the server would reject because it's syntactically
  invalid. Deleting this language (at the OS level) let them register.
- If no languages are valid, we should send `*` instead of the empty
  string. There's no evidence that this happened in practice.

In addition, this commit:

- Adds tests.
- Sends a maximum of 10 languages instead of 6.
- Omits the `q` value when it's 1 because [that's the default][3].
- Marginally improves performance by iterating lazily.

[1]: https://github.com/signalapp/Signal-iOS/issues/5261
[2]: bf6d3aa324/service/src/main/java/org/whispersystems/textsecuregcm/controllers/AccountController.java (L271-L275)
[3]: https://www.rfc-editor.org/rfc/rfc9110.html#section-12.4.2

Co-authored-by: Nora Trapp <nora@signal.org>
2022-07-11 12:20:24 -05:00
..
Account Move pre-key culling logic from TSPreKeyManager to the stores 2022-04-07 10:23:39 -07:00
Contacts Initial story sending support 2022-06-10 22:28:03 -04:00
Devices Update to LibSignalClient v0.15.0 2022-03-24 11:55:45 -07:00
Groups Rework the 'pending member requests and invites' view. 2020-09-03 18:33:07 -03:00
Messages Fix crash when deleting messages from the future 2022-06-27 09:02:04 -07:00
Network Improve Accept-Language header value, fixing registration bug 2022-07-11 12:20:24 -05:00
Security Apply script to normalize includes and imports. 2021-10-21 09:21:10 -03:00
Storage Make "Keep Muted Chats Archived" option available publicly 2022-05-26 10:44:43 -04:00
Util Remove trailing comma 2022-07-08 08:39:47 -05:00
SSKBaseTestObjC.h Respond to CR. 2021-10-21 09:21:31 -03:00
SSKBaseTestObjC.m Apply script to normalize includes and imports. 2021-10-21 09:21:10 -03:00
SSKBaseTestSwift.swift Test phone number sharing modes for sealed sender 2022-05-18 10:21:53 -07:00
SSKSwiftTests.swift Convert to just using CocoaPods for dependencies 2020-01-02 12:03:57 -08:00