Definition at line 50 of file filter_http_rewrite1.cpp.
◆ rewrite_response()
void mp::filter::HttpRewrite1::Rep::rewrite_response |
( |
mp::odr & |
o, |
|
|
Z_HTTP_Response * |
hres |
|
) |
| |
|
private |
Definition at line 66 of file filter_http_rewrite1.cpp.
68 const char *ctype = z_HTTP_header_lookup(hres->headers,
"Content-Type");
69 if (ctype && hres->content_buf)
71 std::string text(hres->content_buf, hres->content_len);
72 std::list<Rule>::const_iterator it;
73 int number_of_replaces = 0;
74 for (it =
rules.begin(); it !=
rules.end(); it++)
76 if (strcmp(ctype, it->content_type.c_str()) == 0)
78 boost::regex::flag_type b_mode = boost::regex::perl;
79 if (it->mode.find_first_of(
'i') != std::string::npos)
80 b_mode |= boost::regex::icase;
81 boost::regex e(it->pattern, b_mode);
82 boost::match_flag_type match_mode = boost::format_first_only;
83 if (it->mode.find_first_of(
'g') != std::string::npos)
84 match_mode = boost::format_all;
85 text = regex_replace(text, e, it->replacement, match_mode);
89 if (number_of_replaces > 0)
91 hres->content_buf = odr_strdup(o, text.c_str());
92 hres->content_len = strlen(hres->content_buf);
◆ HttpRewrite1
◆ rules
std::list<Rule> metaproxy_1::filter::HttpRewrite1::Rep::rules |
|
private |
The documentation for this class was generated from the following file: