+ rewrite_headers(o, hr->headers, vars);
+ package.response() = gdu;
+ }
+ }
+
+ void rewrite_reqline (mp::odr & o, Z_HTTP_Request *hreq,
+ std::map<std::string, std::string> & vars) const
+ {
+ //rewrite the request line
+ std::string path;
+ if (strstr(hreq->path, "http://") == hreq->path)
+ {
+ std::cout << "Path in the method line is absolute, "
+ "possibly a proxy request\n";
+ path += hreq->path;
+ }
+ else
+ {
+ //TODO what about proto
+ path += z_HTTP_header_lookup(hreq->headers, "Host");
+ path += hreq->path;
+ }
+ std::cout << "Proxy request URL is " << path << std::endl;
+ std::string npath =
+ test_patterns(vars, path, req_uri_pats, req_groups_bynum);
+ std::cout << "Resp request URL is " << npath << std::endl;
+ if (!npath.empty())
+ hreq->path = odr_strdup(o, npath.c_str());
+ }
+
+ void rewrite_headers (mp::odr & o, Z_HTTP_Header *headers,
+ std::map<std::string, std::string> & vars) const
+ {
+ for (Z_HTTP_Header *header = headers;
+ header != 0;
+ header = header->next)
+ {
+ std::string sheader(header->name);
+ sheader += ": ";
+ sheader += header->value;
+ std::cout << header->name << ": " << header->value << std::endl;
+ std::string out = test_patterns(vars,
+ sheader,
+ req_uri_pats, req_groups_bynum);
+ if (!out.empty())