Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Relax validation of HTTP header values to retain L/M behavior
This relaxes some validation logic newly introduced in the version of OkHttp used in N. This change leaves the character code validation stricter than it was in M by still preventing control codes like \n, \r, backspace and delete. It does allow developers to pass Java characters > 7F to addRequestProperty() and also receive headers from servers which contain characters > 7F. Android's HttpURLConnection does not follow the HTTP spec as it encodes request header values and interprets response headers as UTF-8 and not ISO-8859-1. If a server is expecting or sending ISO-8859-1 encoded characters >7F in headers then these will still be corrupted or misinterpreted by Android. However, this has been the behavior since L and is not changed here. The OkHttp change which caused characters >7F to generate an IllegalArgumentException and partially reverted here: square/okhttp#1785 See also: square/okhttp#1998 square/okhttp#2016 for recent upstream bugs. Bug: 28867041 Bug: https://code.google.com/p/android/issues/detail?id=210205 (cherry picked from commit 75687ca5ae54f417afb4c02ba04767da6786d829) Change-Id: Ib640b58addff4c0c4eac589c77eb74a6bd6b3ec2
- Loading branch information