Skip to content

Commit 87bc78d

Browse files
authored
correctly log the state of ssl_enabled during run (#180)
1 parent aba42b3 commit 87bc78d

File tree

4 files changed

+41
-2
lines changed

4 files changed

+41
-2
lines changed

CHANGELOG.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
## 3.9.1
2+
- Correctly log the state of `ssl_enabled` during `run` [#180](https://github.com/logstash-plugins/logstash-input-http/pull/180)
3+
14
## 3.9.0
25
- Netty boss and worker groups are separated [#178](https://github.com/logstash-plugins/logstash-input-http/pull/178)
36
As a result, when shutdown requested incoming connections are closed first and improved graceful shutdown

VERSION

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
3.9.0
1+
3.9.1

lib/logstash/inputs/http.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -225,7 +225,7 @@ def register
225225

226226
def run(queue)
227227
@queue = queue
228-
@logger.info("Starting http input listener", :address => "#{@host}:#{@port}", :ssl => "#{@ssl}")
228+
@logger.info("Starting http input listener", :address => "#{@host}:#{@port}", :ssl_enabled => @ssl_enabled)
229229
@http_server.run()
230230
end
231231

spec/inputs/http_spec.rb

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -544,6 +544,24 @@ def setup_server_client(url = self.url)
544544
expect { subject.register }.to_not raise_exception
545545
end
546546

547+
context "during run" do
548+
let(:http_server) do
549+
http_server = double(:http_server)
550+
allow(http_server).to receive(:close)
551+
allow(http_server).to receive(:run)
552+
http_server
553+
end
554+
before(:each) do
555+
allow(subject).to receive(:create_http_server).and_return(http_server)
556+
subject.register
557+
end
558+
it "should show ssl is disabled" do
559+
#[2024-10-18T10:09:33,199][INFO ][logstash.inputs.http ][main][0d48] Starting http input listener {:address=>"0.0.0.0:3333", :ssl_enabled=>false}
560+
expect(subject.logger).to receive(:info).with(/^Starting http input listener/, hash_including(:ssl_enabled => false))
561+
subject.run(nil)
562+
end
563+
end
564+
547565
context "and `ssl_` settings provided" do
548566
let(:ssc) { SelfSignedCertificate.new }
549567
let(:config) { { "port" => 0, "ssl_enabled" => false, "ssl_certificate" => ssc.certificate.path, "ssl_client_authentication" => "none", "cipher_suites" => ["TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA"] } }
@@ -585,6 +603,24 @@ def setup_server_client(url = self.url)
585603
expect { subject.register }.to_not raise_exception
586604
end
587605

606+
context "during run" do
607+
let(:http_server) do
608+
http_server = double(:http_server)
609+
allow(http_server).to receive(:close)
610+
allow(http_server).to receive(:run)
611+
http_server
612+
end
613+
before(:each) do
614+
allow(subject).to receive(:create_http_server).and_return(http_server)
615+
subject.register
616+
end
617+
it "should show ssl is enabled" do
618+
#[2024-10-18T10:09:33,199][INFO ][logstash.inputs.http ][main][0d48] Starting http input listener {:address=>"0.0.0.0:3333", :ssl_enabled=>true}
619+
expect(subject.logger).to receive(:info).with(/^Starting http input listener/, hash_including(:ssl_enabled => true))
620+
subject.run(nil)
621+
end
622+
end
623+
588624
context "with ssl_verify_mode = none" do
589625
subject { LogStash::Inputs::Http.new(config.merge("ssl_client_authentication" => "none")) }
590626

0 commit comments

Comments
 (0)