logstash-input-http 2.1.0 → 2.1.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: ba514b03f267447315b843c65a676c710300a3ee
4
- data.tar.gz: f15c517f4ec64213b6c7e3ef95f89a5b6bf88843
3
+ metadata.gz: 3648e185031d3c683d8358957f0748f35ad1e819
4
+ data.tar.gz: d8297d164e01f1dfa0c96c14babba645f1770e97
5
5
  SHA512:
6
- metadata.gz: dfc240fde16f8fbac393bda7104bce9f4ef0338d3101fbd72829937fdd35522772e17d0a340757f225234a40662507ec7123886d24c5269918fc9df064f71eef
7
- data.tar.gz: c1456684b3692f82e5a68f409efd2bb731c1483a048dab507c4d4ae5f2d0911efade13101d5a45a4fa9e2680a79d473c27695df532c95e318389997888b4fc64
6
+ metadata.gz: f26f64902532cb0b434ebed7bf2bec635031a88700535d6db9b029d23effa3d05ed28275aa23d5d8a1dbf24e3d28ba31573c496762aef404cffdb66485bbfb32
7
+ data.tar.gz: 78990664e22c39ff4b1ba875cb4cbe3c6b4329e2e6cca451630572d6b13b374d153431b62e9fdb8975e640283036b191ec5286e8dcba304965ee5cebca671f69
@@ -1,3 +1,6 @@
1
+ ## 2.1.1
2
+ - Support for custom response headers
3
+
1
4
  ## 2.1.0
2
5
  - Support compressed and gziped requests (thanks dwapstra)
3
6
 
@@ -73,12 +73,13 @@ class LogStash::Inputs::Http < LogStash::Inputs::Base
73
73
  # and no codec for the request's content-type is found
74
74
  config :additional_codecs, :validate => :hash, :default => { "application/json" => "json" }
75
75
 
76
+ # specify a custom set of response headers
77
+ config :response_headers, :validate => :hash, :default => { 'Content-Type' => 'text/plain' }
78
+
76
79
  # useless headers puma adds to the requests
77
80
  # mostly due to rack compliance
78
81
  REJECTED_HEADERS = ["puma.socket", "rack.hijack?", "rack.hijack", "rack.url_scheme", "rack.after_reply", "rack.version", "rack.errors", "rack.multithread", "rack.multiprocess", "rack.run_once", "SCRIPT_NAME", "QUERY_STRING", "SERVER_PROTOCOL", "SERVER_SOFTWARE", "GATEWAY_INTERFACE"]
79
82
 
80
- RESPONSE_HEADERS = {'Content-Type' => 'text/plain'}
81
-
82
83
  public
83
84
  def register
84
85
  require "logstash/util/http_compressed_requests"
@@ -122,10 +123,10 @@ class LogStash::Inputs::Http < LogStash::Inputs::Base
122
123
  decorate(event)
123
124
  queue << event
124
125
  end
125
- ['200', RESPONSE_HEADERS, ['ok']]
126
+ ['200', @response_headers, ['ok']]
126
127
  rescue => e
127
128
  @logger.error("unable to process event #{req.inspect}. exception => #{e.inspect}")
128
- ['500', RESPONSE_HEADERS, ['internal error']]
129
+ ['500', @response_headers, ['internal error']]
129
130
  end
130
131
  end
131
132
 
@@ -1,6 +1,6 @@
1
1
  Gem::Specification.new do |s|
2
2
  s.name = 'logstash-input-http'
3
- s.version = '2.1.0'
3
+ s.version = '2.1.1'
4
4
  s.licenses = ['Apache License (2.0)']
5
5
  s.summary = "Logstash Input plugin that receives HTTP requests"
6
6
  s.description = "This gem is a logstash plugin required to be installed on top of the Logstash core pipeline using $LS_HOME/bin/plugin install gemname. This gem is not a stand-alone program"
@@ -82,10 +82,10 @@ describe LogStash::Inputs::Http do
82
82
  it "should process the request normally" do
83
83
  subject.register
84
84
  Thread.new { subject.run(queue) }
85
- z = StringIO.new ""
86
- w = Zlib::GzipWriter.new z;
87
- w.write("hello");
88
- w.finish;
85
+ z = StringIO.new ""
86
+ w = Zlib::GzipWriter.new z
87
+ w.write("hello")
88
+ w.finish
89
89
  agent.post!("http://localhost:#{port}/meh.json",
90
90
  :headers => { "content-type" => "text/plain", "content-encoding" => "gzip" },
91
91
  :body => z.string)
@@ -147,6 +147,20 @@ describe LogStash::Inputs::Http do
147
147
  end
148
148
  end
149
149
 
150
+ context "when using custom headers" do
151
+ let(:custom_headers) { { 'access-control-allow-origin' => '*' } }
152
+ subject { LogStash::Inputs::Http.new("port" => port, "response_headers" => custom_headers) }
153
+
154
+ describe "the response" do
155
+ it "should include the custom headers" do
156
+ subject.register
157
+ Thread.new { subject.run(queue) }
158
+ response = agent.post!("http://localhost:#{port}/meh", :body => "hello")
159
+ expect(response.headers.to_hash).to include(custom_headers)
160
+ end
161
+ end
162
+ end
163
+
150
164
  context "with :ssl => false" do
151
165
  subject { LogStash::Inputs::Http.new("port" => port, "ssl" => false) }
152
166
  it "should not raise exception" do
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: logstash-input-http
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.1.0
4
+ version: 2.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Elastic
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-01-13 00:00:00.000000000 Z
11
+ date: 2016-01-29 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  requirement: !ruby/object:Gem::Requirement
@@ -152,7 +152,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
152
152
  version: '0'
153
153
  requirements: []
154
154
  rubyforge_project:
155
- rubygems_version: 2.4.8
155
+ rubygems_version: 2.4.5
156
156
  signing_key:
157
157
  specification_version: 4
158
158
  summary: Logstash Input plugin that receives HTTP requests