{"action":"created","issue":{"url":"https://api.github.com/repos/rest-client/rest-client/issues/472","repository_url":"https://api.github.com/repos/rest-client/rest-client","labels_url":"https://api.github.com/repos/rest-client/rest-client/issues/472/labels{/name}","comments_url":"https://api.github.com/repos/rest-client/rest-client/issues/472/comments","events_url":"https://api.github.com/repos/rest-client/rest-client/issues/472/events","html_url":"https://github.com/rest-client/rest-client/pull/472","id":138731260,"number":472,"title":"Allowing invalid cookie characters, if :allow_invalid_cookies is set to true","user":{"login":"AlecHFerguson","id":7835569,"avatar_url":"https://avatars.githubusercontent.com/u/7835569?v=3","gravatar_id":"","url":"https://api.github.com/users/AlecHFerguson","html_url":"https://github.com/AlecHFerguson","followers_url":"https://api.github.com/users/AlecHFerguson/followers","following_url":"https://api.github.com/users/AlecHFerguson/following{/other_user}","gists_url":"https://api.github.com/users/AlecHFerguson/gists{/gist_id}","starred_url":"https://api.github.com/users/AlecHFerguson/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/AlecHFerguson/subscriptions","organizations_url":"https://api.github.com/users/AlecHFerguson/orgs","repos_url":"https://api.github.com/users/AlecHFerguson/repos","events_url":"https://api.github.com/users/AlecHFerguson/events{/privacy}","received_events_url":"https://api.github.com/users/AlecHFerguson/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":1,"created_at":"2016-03-05T22:54:20Z","updated_at":"2016-03-24T04:21:46Z","closed_at":null,"pull_request":{"url":"https://api.github.com/repos/rest-client/rest-client/pulls/472","html_url":"https://github.com/rest-client/rest-client/pull/472","diff_url":"https://github.com/rest-client/rest-client/pull/472.diff","patch_url":"https://github.com/rest-client/rest-client/pull/472.patch"},"body":"`RestClient::Request` validates that cookie keys and values conform to RFC 6265.  However, I've found use cases where I actually want to pass invalid cookies.  In particular, testing a RESTful endpoint to ensure it can handle these values.\r\n\r\nMy solution is to make this configurable.  If you pass in `:allow_invalid_cookies => true` to `RestClient::Request::new`, cookie validation is ignored.  The original behavior of validating them should be preserved.\r\n\r\nI also fixed some documentation that was inconsistent with the actual code.  Please review.\r\n\r\nI've added unit tests to confirm the behavior.  Should I also add some integration tests?"},"comment":{"url":"https://api.github.com/repos/rest-client/rest-client/issues/comments/200657945","html_url":"https://github.com/rest-client/rest-client/pull/472#issuecomment-200657945","issue_url":"https://api.github.com/repos/rest-client/rest-client/issues/472","id":200657945,"user":{"login":"ab","id":350770,"avatar_url":"https://avatars.githubusercontent.com/u/350770?v=3","gravatar_id":"","url":"https://api.github.com/users/ab","html_url":"https://github.com/ab","followers_url":"https://api.github.com/users/ab/followers","following_url":"https://api.github.com/users/ab/following{/other_user}","gists_url":"https://api.github.com/users/ab/gists{/gist_id}","starred_url":"https://api.github.com/users/ab/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ab/subscriptions","organizations_url":"https://api.github.com/users/ab/orgs","repos_url":"https://api.github.com/users/ab/repos","events_url":"https://api.github.com/users/ab/events{/privacy}","received_events_url":"https://api.github.com/users/ab/received_events","type":"User","site_admin":false},"created_at":"2016-03-24T04:21:46Z","updated_at":"2016-03-24T04:21:46Z","body":"> In my reading of the code, I'm not sure what \"just set the Cookie header directly\" refers to. Line 129 seems to actually prevent this:\r\n\r\nIn an HTTP request, cookies are set in a header called `Cookie`. We unfortunately are stuck with a deeply confusing API in rest-client that commingles options and headers (at least until a version 3.0 rewrite). It understands a `:cookies` option, which is _not_ the same as the `:cookie` header. Note the difference in pluralization. (Yes, I know.)\r\n\r\nSo passing `:cookie` singular will allow you to set the raw `Cookie: ...` header with whatever values you want. The `:cookies` option is processed at a higher level before generating the `Cookie` header. I don't think it's a good idea for the `:cookies` option to accept invalid cookie data.\r\n\r\n\r\n"}}