{"action":"created","issue":{"url":"https://api.github.com/repos/logstash-plugins/logstash-input-http/issues/40","labels_url":"https://api.github.com/repos/logstash-plugins/logstash-input-http/issues/40/labels{/name}","comments_url":"https://api.github.com/repos/logstash-plugins/logstash-input-http/issues/40/comments","events_url":"https://api.github.com/repos/logstash-plugins/logstash-input-http/issues/40/events","html_url":"https://github.com/logstash-plugins/logstash-input-http/pull/40","id":125603158,"number":40,"title":"added support for compressed http requests","user":{"login":"dwapstra","id":10467987,"avatar_url":"https://avatars.githubusercontent.com/u/10467987?v=3","gravatar_id":"","url":"https://api.github.com/users/dwapstra","html_url":"https://github.com/dwapstra","followers_url":"https://api.github.com/users/dwapstra/followers","following_url":"https://api.github.com/users/dwapstra/following{/other_user}","gists_url":"https://api.github.com/users/dwapstra/gists{/gist_id}","starred_url":"https://api.github.com/users/dwapstra/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dwapstra/subscriptions","organizations_url":"https://api.github.com/users/dwapstra/orgs","repos_url":"https://api.github.com/users/dwapstra/repos","events_url":"https://api.github.com/users/dwapstra/events{/privacy}","received_events_url":"https://api.github.com/users/dwapstra/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":4,"created_at":"2016-01-08T12:32:31Z","updated_at":"2016-01-13T11:10:21Z","closed_at":null,"pull_request":{"url":"https://api.github.com/repos/logstash-plugins/logstash-input-http/pulls/40","html_url":"https://github.com/logstash-plugins/logstash-input-http/pull/40","diff_url":"https://github.com/logstash-plugins/logstash-input-http/pull/40.diff","patch_url":"https://github.com/logstash-plugins/logstash-input-http/pull/40.patch"},"body":"My first ruby code hack... need to add tests still.\r\n\r\nI have tested this with curl and it works for me...\r\n\r\nI'm unsure about the best place for the 'require' statement, suggestions welcome.\r\n"},"comment":{"url":"https://api.github.com/repos/logstash-plugins/logstash-input-http/issues/comments/171256156","html_url":"https://github.com/logstash-plugins/logstash-input-http/pull/40#issuecomment-171256156","issue_url":"https://api.github.com/repos/logstash-plugins/logstash-input-http/issues/40","id":171256156,"user":{"login":"jsvd","id":31809,"avatar_url":"https://avatars.githubusercontent.com/u/31809?v=3","gravatar_id":"","url":"https://api.github.com/users/jsvd","html_url":"https://github.com/jsvd","followers_url":"https://api.github.com/users/jsvd/followers","following_url":"https://api.github.com/users/jsvd/following{/other_user}","gists_url":"https://api.github.com/users/jsvd/gists{/gist_id}","starred_url":"https://api.github.com/users/jsvd/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jsvd/subscriptions","organizations_url":"https://api.github.com/users/jsvd/orgs","repos_url":"https://api.github.com/users/jsvd/repos","events_url":"https://api.github.com/users/jsvd/events{/privacy}","received_events_url":"https://api.github.com/users/jsvd/received_events","type":"User","site_admin":false},"created_at":"2016-01-13T11:10:21Z","updated_at":"2016-01-13T11:10:21Z","body":"I don't think we should let the event through as it is a malformed request. with that in mind, for the `CompressedRequests` module, I'd suggest something along the lines of:\r\n\r\n```ruby\r\n  def call(env)\r\n    if method_handled?(env) && encoding_handled?(env)\r\n      extracted = decode(env['rack.input'], env['HTTP_CONTENT_ENCODING'])\r\n\r\n      env.delete('HTTP_CONTENT_ENCODING')\r\n      env['CONTENT_LENGTH'] = extracted.bytesize\r\n      env['rack.input'] = StringIO.new(extracted)\r\n    end\r\n\r\n    @app.call(env)\r\n\r\n  rescue Zlib::Error\r\n    [400, {'Content-Type' => 'text/plain'}, [\"Failed to decompress body\"]]\r\n  end\r\n\r\n  def decode(input, content_encoding)\r\n    case content_encoding\r\n    when 'gzip' then\r\n      Zlib::GzipReader.new(input).read\r\n    when 'deflate' then\r\n      Zlib::Inflate.inflate(input.read)\r\n    end\r\n  end\r\n```\r\n\r\nwhat do you think?"}}