From 9c2130f5858aba2488619e853ddd06875f2ac5aa Mon Sep 17 00:00:00 2001
From: Francesco Giacomini <francesco.giacomini@cnaf.infn.it>
Date: Tue, 14 Jan 2020 15:05:38 +0100
Subject: [PATCH] check that it's an SSL connection

fix issue #26
---
 src/ngx_http_voms_module.cpp | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/src/ngx_http_voms_module.cpp b/src/ngx_http_voms_module.cpp
index 29ae6a9..bee998f 100644
--- a/src/ngx_http_voms_module.cpp
+++ b/src/ngx_http_voms_module.cpp
@@ -266,6 +266,11 @@ static MaybeVomsAc retrieve_voms_ac_from_proxy(ngx_http_request_t* r)
     return boost::none;
   }
 
+  if (!r->connection->ssl) {
+    ngx_log_error(NGX_LOG_ERR, r->connection->log, 0, "plain HTTP request");
+    return boost::none;
+  }
+
   auto client_cert = X509Ptr{
       SSL_get_peer_certificate(r->connection->ssl->connection), X509_free};
   if (!client_cert) {
-- 
GitLab