shrpx: Log upstream https request headers

This commit is contained in:
Tatsuhiro Tsujikawa 2012-11-23 21:30:17 +09:00
parent 8f62441112
commit 282b8b567a
1 changed files with 14 additions and 0 deletions

View File

@ -26,6 +26,7 @@
#include <cassert> #include <cassert>
#include <set> #include <set>
#include <sstream>
#include "shrpx_client_handler.h" #include "shrpx_client_handler.h"
#include "shrpx_downstream.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)); 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 && if(get_config()->client_proxy &&
downstream->get_request_method() != "CONNECT") { downstream->get_request_method() != "CONNECT") {
// Make sure that request path is an absolute URI. // Make sure that request path is an absolute URI.