From 282b8b567a3e2b78c5f23415f9e9e1593beddd58 Mon Sep 17 00:00:00 2001 From: Tatsuhiro Tsujikawa Date: Fri, 23 Nov 2012 21:30:17 +0900 Subject: [PATCH] shrpx: Log upstream https request headers --- src/shrpx_https_upstream.cc | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/src/shrpx_https_upstream.cc b/src/shrpx_https_upstream.cc index 776c6c2a..5e868350 100644 --- a/src/shrpx_https_upstream.cc +++ b/src/shrpx_https_upstream.cc @@ -26,6 +26,7 @@ #include #include +#include #include "shrpx_client_handler.h" #include "shrpx_downstream.h" @@ -140,6 +141,19 @@ int htp_hdrs_completecb(http_parser *htp) downstream->set_request_connection_close(!http_should_keep_alive(htp)); + if(ENABLE_LOG) { + std::stringstream ss; + ss << downstream->get_request_method() << " " + << downstream->get_request_path() << " " + << "HTTP/" << downstream->get_request_major() << "." + << downstream->get_request_minor() << "\n"; + const Headers& headers = downstream->get_request_headers(); + for(size_t i = 0; i < headers.size(); ++i) { + ss << headers[i].first << ": " << headers[i].second << "\n"; + } + LOG(INFO) << "Upstream https request headers\n" << ss.str(); + } + if(get_config()->client_proxy && downstream->get_request_method() != "CONNECT") { // Make sure that request path is an absolute URI.