Bug 735311 - Adapt to new Google HTTP restriction
Google has recently imposed a limit on the number of unauthorized HTTP requests to its OAuth2-based interfaces. The normal operation of SoupSession is to issue the first HTTP request unauthorized and see if the server issues a "401 Unauthorized" response (since not all HTTP services require authorization). On a "401 Unauthorized" response, SoupSession emits an "authenticate" signal, which the application is supposed to handle. Once credentials are in hand, SoupSession resends the same HTTP request and subsequent requests with an Authenticate header while the socket connection holds. Google's unauthorized request limit breaks this logic flow. Once the limit is exceeded, the Google server issues a "403 Forbidden" response instead of "401 Unauthorized" to an unauthorized HTTP request. This breaks error handling in the E-D-S CalDAV backend. The workaround is to preload the SoupAuthManager with a pre-configured SoupAuth when using OAuth 2.0 authentication. This avoids the initial unauthorized HTTP round-trip. The backend implements the GInitable interface for this since obtaining a valid access token is a failable step. (cherry picked from commit 00a46567)
parent
a4a8d2d5
Please register or sign in to comment