Repository navigation
Commit 7c135eb
committed
Use a separate connection for each GrandSlam request
Apple's edge serves at most two requests per connection and answers
everything after that with a 503 HTML error page. Authenticating takes
three requests -- init, complete and apptokens -- and they all went
through AppleAPI.shared.session, so apptokens was rejected whenever it
landed on a reused connection and signing in failed at the last step.
Give each request its own session, and therefore its own connection.
The response body was also parsed as a property list before the status
code was checked, so Apple's HTML error page surfaced as NSCocoaErrorDomain
3840, "The data couldn't be read because it isn't in the correct format."
That describes the parser rather than the failure and sends people looking
at their Apple ID, their anisette server and their OS version. Check for a
5xx first and report it as what it is.
Port of rileytestut/AltSign#521 parent 69397b4 commit 7c135eb
1 file changed
Lines changed: 14 additions & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
265 | 265 | | |
266 | 266 | | |
267 | 267 | | |
268 | | - | |
269 | | - | |
| 268 | + | |
| 269 | + | |
| 270 | + | |
| 271 | + | |
| 272 | + | |
| 273 | + | |
| 274 | + | |
| 275 | + | |
| 276 | + | |
| 277 | + | |
| 278 | + | |
| 279 | + | |
| 280 | + | |
| 281 | + | |
270 | 282 | | |
271 | 283 | | |
272 | 284 | | |
| |||
0 commit comments