{"action":"created","issue":{"url":"https://api.github.com/repos/sferik/twitter/issues/690","labels_url":"https://api.github.com/repos/sferik/twitter/issues/690/labels{/name}","comments_url":"https://api.github.com/repos/sferik/twitter/issues/690/comments","events_url":"https://api.github.com/repos/sferik/twitter/issues/690/events","html_url":"https://github.com/sferik/twitter/pull/690","id":79192468,"number":690,"title":"Properly escape stream parameters","user":{"login":"dsander","id":20943,"avatar_url":"https://avatars.githubusercontent.com/u/20943?v=3","gravatar_id":"","url":"https://api.github.com/users/dsander","html_url":"https://github.com/dsander","followers_url":"https://api.github.com/users/dsander/followers","following_url":"https://api.github.com/users/dsander/following{/other_user}","gists_url":"https://api.github.com/users/dsander/gists{/gist_id}","starred_url":"https://api.github.com/users/dsander/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dsander/subscriptions","organizations_url":"https://api.github.com/users/dsander/orgs","repos_url":"https://api.github.com/users/dsander/repos","events_url":"https://api.github.com/users/dsander/events{/privacy}","received_events_url":"https://api.github.com/users/dsander/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":1,"created_at":"2015-05-21T22:48:28Z","updated_at":"2015-05-21T22:57:23Z","closed_at":null,"pull_request":{"url":"https://api.github.com/repos/sferik/twitter/pulls/690","html_url":"https://github.com/sferik/twitter/pull/690","diff_url":"https://github.com/sferik/twitter/pull/690.diff","patch_url":"https://github.com/sferik/twitter/pull/690.patch"},"body":"Currently parameters passed to the streaming API are not encoded as per twitters [rules](https://dev.twitter.com/oauth/overview/percent-encoding-parameters). Filtering for `@twitter` results in a 401 error, easily reproducible  by running:\r\n\r\n```\r\nclient.filter(track: '@twitter') { |tweet| puts tweet.text }\r\n```\r\nThis PR fixes the problem for `5.x` releases.\r\n\r\nThe same PR can be applied to `master` but there the fix does not work, because of the`http` gem version. Version `0.8.3` introduced [HTTP::URI.parse(uri).normalize](https://github.com/httprb/http.rb/blob/v0.8.3/lib/http/request.rb#L70) which unescapes parts of the query string and thus produces the same exception as before:\r\n```\r\nproperly_escaped_url = 'https://stream.twitter.com:443/1.1/statuses/filter.json?track=%40twitter'\r\nputs HTTP::URI.parse(properly_escaped_url)\r\n# -> https://stream.twitter.com:443/1.1/statuses/filter.json?track=%40twitter\r\nputs HTTP::URI.parse(properly_escaped_url).normalize\r\n# -> https://stream.twitter.com/1.1/statuses/filter.json?track=@twitter\r\n\r\n```\r\n"},"comment":{"url":"https://api.github.com/repos/sferik/twitter/issues/comments/104444501","html_url":"https://github.com/sferik/twitter/pull/690#issuecomment-104444501","issue_url":"https://api.github.com/repos/sferik/twitter/issues/690","id":104444501,"user":{"login":"dsander","id":20943,"avatar_url":"https://avatars.githubusercontent.com/u/20943?v=3","gravatar_id":"","url":"https://api.github.com/users/dsander","html_url":"https://github.com/dsander","followers_url":"https://api.github.com/users/dsander/followers","following_url":"https://api.github.com/users/dsander/following{/other_user}","gists_url":"https://api.github.com/users/dsander/gists{/gist_id}","starred_url":"https://api.github.com/users/dsander/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dsander/subscriptions","organizations_url":"https://api.github.com/users/dsander/orgs","repos_url":"https://api.github.com/users/dsander/repos","events_url":"https://api.github.com/users/dsander/events{/privacy}","received_events_url":"https://api.github.com/users/dsander/received_events","type":"User","site_admin":false},"created_at":"2015-05-21T22:57:23Z","updated_at":"2015-05-21T22:57:23Z","body":"Ok, this looks bad the PR requires ruby 1.9 and I guess you are still supporting 1.8 in 0.5.x?"}}