Signal-iOS/SignalServiceKit
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
..
protobuf Add support for replying to gift messages 2022-07-07 10:49:20 -07:00
Resources Save a receipt when you send someone a badge 2022-07-08 13:17:30 -05:00
src Improve Accept-Language header value, fixing registration bug 2022-07-11 12:20:24 -05:00
tests Improve Accept-Language header value, fixing registration bug 2022-07-11 12:20:24 -05:00
Utilities More Python 3 script fixes 2022-03-24 10:28:27 -05:00
.clang-format Update clang-format with AllowShortEnumsOnASingleLine: false 2022-03-14 11:20:20 -07:00
.gitignore
.travis.yml
CONTRIBUTING.md Change references from master to main 2022-05-02 10:30:40 -05:00
LICENSE
README.md Convert to just using CocoaPods for dependencies 2020-01-02 12:03:57 -08:00

SignalServiceKit

SignalServiceKit is an Objective-C library for communicating with the Signal messaging service for iOS & OS X

To use SignalServiceKit via CocoaPods add the following to your Podfile

pod 'SignalServiceKit', git: 'https://github.com/signalapp/Signal-iOS.git'