Remove the noisy "Cookie tried to set to another path" log - #5530
Merged
Conversation
…#5528) parseCookieHeader logged a warning whenever a Set-Cookie Path attribute was not a prefix of the request path, then honored the path anyway. Unlike the domain check just above it, which rewrites the cookie's domain, this branch changes nothing about the outcome, so the log flagged the code doing the correct thing. It also fires on perfectly valid cookies. RFC 6265 places no requirement on Path relative to the request URI, and getURLPath returns the host when the URL has no path, so a plain "Path=/" cookie on a request to https://example.com warns on every response. Reported on device as several lines per request, continuously. Only the log line is removed; cookie parsing behavior is unchanged. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Reported in discussion #5528 — this line floods device logs, several entries per request, continuously.
ConnectionRequest.parseCookieHeaderlogged a warning whenever aSet-CookiePathattribute was not a prefix of the request path, and then honored that path anyway:Two reasons to drop it:
ConnectionRequest.java:1681) rewrites the cookie's domain, so its log tells you a cookie was altered. The path branch changes nothing about the outcome — it flags the code doing the correct thing.Pathrelative to the request URI; browsers accept any path. AndCodenameOneImplementation.getURLPathreturns the host when the URL has no path, sohttps://example.comyields"example.com"and a plainPath=/cookie warns on every single response. The check is alsoindexOfrather than a prefix test, so/v1inside/api/v1/xmatches at index 4 and warns too.Only the log line is removed. Cookie parsing behavior is unchanged: when the condition is false the cookie keeps
Cookie's default"/"path exactly as before.Tightening the check itself (making
setPathunconditional, per RFC) would narrow cookie scope for existing apps, so that is deliberately left out of this PR.🤖 Generated with Claude Code