From 1a43a127795955f8a5b509391995068867279b19 Mon Sep 17 00:00:00 2001 From: Adam Dickmeiss Date: Fri, 21 Jun 2013 14:28:56 +0200 Subject: [PATCH] http_rewrite: rename Section -> Phase --- src/filter_http_rewrite.cpp | 29 ++++++++++++++--------------- src/filter_http_rewrite.hpp | 10 +++++----- 2 files changed, 19 insertions(+), 20 deletions(-) diff --git a/src/filter_http_rewrite.cpp b/src/filter_http_rewrite.cpp index 3fd5fc2..f93d5a7 100644 --- a/src/filter_http_rewrite.cpp +++ b/src/filter_http_rewrite.cpp @@ -67,7 +67,7 @@ namespace metaproxy_1 { RulePtr rule; }; - class HttpRewrite::Section { + class HttpRewrite::Phase { public: std::list within_list; void rewrite_reqline(mp::odr & o, Z_HTTP_Request *hreq, @@ -82,7 +82,7 @@ namespace metaproxy_1 { } yf::HttpRewrite::HttpRewrite() : - req_section(new Section), res_section(new Section) + req_phase(new Phase), res_phase(new Phase) { } @@ -101,10 +101,10 @@ void yf::HttpRewrite::process(mp::Package & package) const { Z_HTTP_Request *hreq = gdu->u.HTTP_Request; mp::odr o; - req_section->rewrite_reqline(o, hreq, vars); + req_phase->rewrite_reqline(o, hreq, vars); yaz_log(YLOG_LOG, ">> Request headers"); - req_section->rewrite_headers(o, hreq->headers, vars); - req_section->rewrite_body(o, + req_phase->rewrite_headers(o, hreq->headers, vars); + req_phase->rewrite_body(o, &hreq->content_buf, &hreq->content_len, vars); package.request() = gdu; } @@ -116,14 +116,14 @@ void yf::HttpRewrite::process(mp::Package & package) const yaz_log(YLOG_LOG, "Response code %d", hres->code); mp::odr o; yaz_log(YLOG_LOG, "<< Respose headers"); - res_section->rewrite_headers(o, hres->headers, vars); - res_section->rewrite_body(o, &hres->content_buf, + res_phase->rewrite_headers(o, hres->headers, vars); + res_phase->rewrite_body(o, &hres->content_buf, &hres->content_len, vars); package.response() = gdu; } } -void yf::HttpRewrite::Section::rewrite_reqline (mp::odr & o, +void yf::HttpRewrite::Phase::rewrite_reqline (mp::odr & o, Z_HTTP_Request *hreq, std::map & vars) const { @@ -158,7 +158,7 @@ void yf::HttpRewrite::Section::rewrite_reqline (mp::odr & o, } } -void yf::HttpRewrite::Section::rewrite_headers(mp::odr & o, +void yf::HttpRewrite::Phase::rewrite_headers(mp::odr & o, Z_HTTP_Header *headers, std::map & vars) const { @@ -192,7 +192,7 @@ void yf::HttpRewrite::Section::rewrite_headers(mp::odr & o, } } -void yf::HttpRewrite::Section::rewrite_body(mp::odr & o, +void yf::HttpRewrite::Phase::rewrite_body(mp::odr & o, char **content_buf, int *content_len, std::map & vars) const @@ -388,8 +388,7 @@ std::string yf::HttpRewrite::Replace::sub_vars ( } -void yf::HttpRewrite::configure_section(const xmlNode *ptr, - Section §ion) +void yf::HttpRewrite::configure_phase(const xmlNode *ptr, Phase &phase) { std::map rules; for (ptr = ptr->children; ptr; ptr = ptr->next) @@ -456,7 +455,7 @@ void yf::HttpRewrite::configure_section(const xmlNode *ptr, ("Reference to non-existing rule '" + values[3] + "' in http_rewrite filter"); w.rule = it->second; - section.within_list.push_back(w); + phase.within_list.push_back(w); } else { @@ -477,11 +476,11 @@ void yf::HttpRewrite::configure(const xmlNode * ptr, bool test_only, continue; else if (!strcmp((const char *) ptr->name, "request")) { - configure_section(ptr, *req_section); + configure_phase(ptr, *req_phase); } else if (!strcmp((const char *) ptr->name, "response")) { - configure_section(ptr, *res_section); + configure_phase(ptr, *res_phase); } else { diff --git a/src/filter_http_rewrite.hpp b/src/filter_http_rewrite.hpp index 58de9d9..970f353 100644 --- a/src/filter_http_rewrite.hpp +++ b/src/filter_http_rewrite.hpp @@ -28,19 +28,19 @@ namespace mp = metaproxy_1; namespace metaproxy_1 { namespace filter { class HttpRewrite : public Base { - class Section; + class Phase; class Replace; class Rule; class Within; typedef boost::shared_ptr RulePtr; - boost::scoped_ptr
req_section; - boost::scoped_ptr
res_section; - void configure_section(const xmlNode *ptr, Section §ion); + boost::scoped_ptr req_phase; + boost::scoped_ptr res_phase; + void configure_phase(const xmlNode *ptr, Phase &phase); public: HttpRewrite(); ~HttpRewrite(); void process(metaproxy_1::Package & package) const; - void configure(const xmlNode * ptr, + void configure(const xmlNode * ptr, bool test_only, const char *path); }; } -- 1.7.10.4