Android CookieManager throws error caused by websites that are sending back illegal/invalid cookies. #476
Closed
3 of 5 tasks
Labels
bug
Something isn't working
This is technically not a "bug" in InAppWebView, but caused by websites that are sending back illegal/invalid cookies.
Environment
Device information:
Description
Expected behavior: degrade gracefully - set cookie value to "" if not supplied.
Current behavior:
E/MethodChannel#com.pichillilorenzo/flutter_inappwebview_cookiemanager( 3057): Failed to handle method call
Steps to reproduce
Unfortunately some websites send back illegal cookies that aren't in "name=value" form, they are just a text string without any
=
sign. This causes the CookieManager to throw an error (stacktrace below). CookieManager is following the spec, the websites are violating it. But we'd still prefer to handle the illegal cookies rather than crash the app.The proposed resolution would check that both a name and value exist, then set the value to an empty string if it doesn't exist.
Fix (1-line)
Line 156 of MyCookieManager.java could be
String value = (nameValue.length > 1) ? nameValue[1].trim() : "";
The precisely equivalent code doesn't exist in Swift, there's no splitting the string into an array. I don't know how iOS behaves in this situation.
Stacktrace/Logcat
potential test case:
The text was updated successfully, but these errors were encountered: