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 +4 -4
- data/CHANGELOG.md +3 -0
- data/lib/logstash/inputs/http.rb +5 -4
- data/logstash-input-http.gemspec +1 -1
- data/spec/inputs/http_spec.rb +18 -4
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 3648e185031d3c683d8358957f0748f35ad1e819
|
4
|
+
data.tar.gz: d8297d164e01f1dfa0c96c14babba645f1770e97
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f26f64902532cb0b434ebed7bf2bec635031a88700535d6db9b029d23effa3d05ed28275aa23d5d8a1dbf24e3d28ba31573c496762aef404cffdb66485bbfb32
|
7
|
+
data.tar.gz: 78990664e22c39ff4b1ba875cb4cbe3c6b4329e2e6cca451630572d6b13b374d153431b62e9fdb8975e640283036b191ec5286e8dcba304965ee5cebca671f69
|
data/CHANGELOG.md
CHANGED
data/lib/logstash/inputs/http.rb
CHANGED
@@ -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',
|
126
|
+
['200', @response_headers, ['ok']]
|
126
127
|
rescue => e
|
127
128
|
@logger.error("unable to process event #{req.inspect}. exception => #{e.inspect}")
|
128
|
-
['500',
|
129
|
+
['500', @response_headers, ['internal error']]
|
129
130
|
end
|
130
131
|
end
|
131
132
|
|
data/logstash-input-http.gemspec
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
Gem::Specification.new do |s|
|
2
2
|
s.name = 'logstash-input-http'
|
3
|
-
s.version = '2.1.
|
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"
|
data/spec/inputs/http_spec.rb
CHANGED
@@ -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
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
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.
|
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-
|
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.
|
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
|