{"action":"created","issue":{"url":"https://api.github.com/repos/cloudant/java-cloudant/issues/288","repository_url":"https://api.github.com/repos/cloudant/java-cloudant","labels_url":"https://api.github.com/repos/cloudant/java-cloudant/issues/288/labels{/name}","comments_url":"https://api.github.com/repos/cloudant/java-cloudant/issues/288/comments","events_url":"https://api.github.com/repos/cloudant/java-cloudant/issues/288/events","html_url":"https://github.com/cloudant/java-cloudant/pull/288","id":174317084,"number":288,"title":"Changed CookieInterceptor to use CookieManager","user":{"login":"ricellis","id":10698320,"avatar_url":"https://avatars.githubusercontent.com/u/10698320?v=3","gravatar_id":"","url":"https://api.github.com/users/ricellis","html_url":"https://github.com/ricellis","followers_url":"https://api.github.com/users/ricellis/followers","following_url":"https://api.github.com/users/ricellis/following{/other_user}","gists_url":"https://api.github.com/users/ricellis/gists{/gist_id}","starred_url":"https://api.github.com/users/ricellis/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ricellis/subscriptions","organizations_url":"https://api.github.com/users/ricellis/orgs","repos_url":"https://api.github.com/users/ricellis/repos","events_url":"https://api.github.com/users/ricellis/events{/privacy}","received_events_url":"https://api.github.com/users/ricellis/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":{"login":"rhyshort","id":1616727,"avatar_url":"https://avatars.githubusercontent.com/u/1616727?v=3","gravatar_id":"","url":"https://api.github.com/users/rhyshort","html_url":"https://github.com/rhyshort","followers_url":"https://api.github.com/users/rhyshort/followers","following_url":"https://api.github.com/users/rhyshort/following{/other_user}","gists_url":"https://api.github.com/users/rhyshort/gists{/gist_id}","starred_url":"https://api.github.com/users/rhyshort/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/rhyshort/subscriptions","organizations_url":"https://api.github.com/users/rhyshort/orgs","repos_url":"https://api.github.com/users/rhyshort/repos","events_url":"https://api.github.com/users/rhyshort/events{/privacy}","received_events_url":"https://api.github.com/users/rhyshort/received_events","type":"User","site_admin":false},"assignees":[{"login":"rhyshort","id":1616727,"avatar_url":"https://avatars.githubusercontent.com/u/1616727?v=3","gravatar_id":"","url":"https://api.github.com/users/rhyshort","html_url":"https://github.com/rhyshort","followers_url":"https://api.github.com/users/rhyshort/followers","following_url":"https://api.github.com/users/rhyshort/following{/other_user}","gists_url":"https://api.github.com/users/rhyshort/gists{/gist_id}","starred_url":"https://api.github.com/users/rhyshort/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/rhyshort/subscriptions","organizations_url":"https://api.github.com/users/rhyshort/orgs","repos_url":"https://api.github.com/users/rhyshort/repos","events_url":"https://api.github.com/users/rhyshort/events{/privacy}","received_events_url":"https://api.github.com/users/rhyshort/received_events","type":"User","site_admin":false},{"login":"tomblench","id":6302842,"avatar_url":"https://avatars.githubusercontent.com/u/6302842?v=3","gravatar_id":"","url":"https://api.github.com/users/tomblench","html_url":"https://github.com/tomblench","followers_url":"https://api.github.com/users/tomblench/followers","following_url":"https://api.github.com/users/tomblench/following{/other_user}","gists_url":"https://api.github.com/users/tomblench/gists{/gist_id}","starred_url":"https://api.github.com/users/tomblench/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/tomblench/subscriptions","organizations_url":"https://api.github.com/users/tomblench/orgs","repos_url":"https://api.github.com/users/tomblench/repos","events_url":"https://api.github.com/users/tomblench/events{/privacy}","received_events_url":"https://api.github.com/users/tomblench/received_events","type":"User","site_admin":false}],"milestone":null,"comments":2,"created_at":"2016-08-31T16:20:38Z","updated_at":"2016-09-02T13:12:13Z","closed_at":null,"pull_request":{"url":"https://api.github.com/repos/cloudant/java-cloudant/pulls/288","html_url":"https://github.com/cloudant/java-cloudant/pull/288","diff_url":"https://github.com/cloudant/java-cloudant/pull/288.diff","patch_url":"https://github.com/cloudant/java-cloudant/pull/288.patch"},"body":"## What\r\n\r\nChanged `CookieInterceptor` to use `java.net.CookieManager`\r\n\r\n## How\r\n\r\nThe previous `CookieInterceptor` code failed to account for the possibility of multiple `Set-Cookie` headers being present in a response. It also failed to account for the possibility of multiple cookie values within a single header. Finally and most obviously from #287 it failed to check that the string parsing it was doing was safe. To avoid having to write code for all these scenarios it seemed preferable to use the `java.net.CookieManager` instead, which should be spec compliant.\r\n\r\n* Removed our existing cookie/header parsing and used an instance of `java.net.CookieManager` instead.\r\n* Refactored methods and error handling to work with `CookieManager` changes.\r\n* Made the `shouldAttemptCookieRequest` atomic as it is potentially accessed by multiple `HttpConnection` instances.\r\n\r\n## Testing\r\n\r\nAdded tests:\r\n* HttpTest#badCredsDisablesCookie - to check that a 401 when requesting a\r\ncookie stops any further attempts.\r\n* HttpTest#cookieAppliedToDifferentURL - to validate that the cookie is\r\nsuccessfully applied to a different request URL.\r\n\r\nUpdated the `OK_COOKIE` to better match CouchDB.\r\nFixed assertions impacted by cookie change (optional \" not present in a `CookieManager` handled cookie).\r\n\r\n## Issues\r\n\r\nFixes #287 "},"comment":{"url":"https://api.github.com/repos/cloudant/java-cloudant/issues/comments/244370854","html_url":"https://github.com/cloudant/java-cloudant/pull/288#issuecomment-244370854","issue_url":"https://api.github.com/repos/cloudant/java-cloudant/issues/288","id":244370854,"user":{"login":"ricellis","id":10698320,"avatar_url":"https://avatars.githubusercontent.com/u/10698320?v=3","gravatar_id":"","url":"https://api.github.com/users/ricellis","html_url":"https://github.com/ricellis","followers_url":"https://api.github.com/users/ricellis/followers","following_url":"https://api.github.com/users/ricellis/following{/other_user}","gists_url":"https://api.github.com/users/ricellis/gists{/gist_id}","starred_url":"https://api.github.com/users/ricellis/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ricellis/subscriptions","organizations_url":"https://api.github.com/users/ricellis/orgs","repos_url":"https://api.github.com/users/ricellis/repos","events_url":"https://api.github.com/users/ricellis/events{/privacy}","received_events_url":"https://api.github.com/users/ricellis/received_events","type":"User","site_admin":false},"created_at":"2016-09-02T13:12:13Z","updated_at":"2016-09-02T13:12:13Z","body":"@rhyshort @tomblench the tests are passing on this now, but as well as changing the tests I added some more logging so might be worth another look"}}
{"actor":{"display_login":"ricellis"}}