Rollback removal of config info from MeasurementProxyUrlNamer.
Turns out I need it to properly implement IsProxyEncoded.
This commit is contained in:
@@ -47,7 +47,8 @@ class MeasurementProxyRewriteOptionsManagerTest
|
||||
ProxyInterfaceTestBase::SetUp();
|
||||
options_manager_ = new MeasurementProxyRewriteOptionsManager(
|
||||
server_context(), "https://www.example.com", "secret");
|
||||
url_namer_.reset(new MeasurementProxyUrlNamer());
|
||||
url_namer_.reset(new MeasurementProxyUrlNamer(
|
||||
"https://www.example.com", "secret"));
|
||||
server_context()->SetRewriteOptionsManager(options_manager_);
|
||||
server_context()->set_url_namer(url_namer_.get());
|
||||
}
|
||||
|
||||
@@ -27,7 +27,12 @@
|
||||
namespace net_instaweb {
|
||||
|
||||
|
||||
MeasurementProxyUrlNamer::MeasurementProxyUrlNamer() {
|
||||
MeasurementProxyUrlNamer::MeasurementProxyUrlNamer(
|
||||
const GoogleString& top_origin, const GoogleString& password)
|
||||
: top_origin_(top_origin), password_(password) {
|
||||
if (StringPiece(top_origin_).ends_with("/")) {
|
||||
top_origin_.resize(top_origin.size() - 1);
|
||||
}
|
||||
}
|
||||
|
||||
MeasurementProxyUrlNamer::~MeasurementProxyUrlNamer() {
|
||||
|
||||
@@ -33,6 +33,7 @@ namespace net_instaweb {
|
||||
|
||||
class MeasurementProxyUrlNamerTest : public RewriteTestBase {
|
||||
protected:
|
||||
MeasurementProxyUrlNamerTest() : namer_("http://www.example.com/", "pwd") {}
|
||||
MeasurementProxyUrlNamer namer_;
|
||||
};
|
||||
|
||||
|
||||
@@ -38,12 +38,10 @@ class RewriteOptions;
|
||||
// before fetching via us (as this doesn't implement Encode() itself).
|
||||
class MeasurementProxyUrlNamer : public UrlNamer {
|
||||
public:
|
||||
MeasurementProxyUrlNamer();
|
||||
MeasurementProxyUrlNamer(const GoogleString& top_origin,
|
||||
const GoogleString& password);
|
||||
~MeasurementProxyUrlNamer() override;
|
||||
|
||||
// Note: this doesn't deal with the authenication or verification
|
||||
// of origin or password, the MeasurementProxyRewriteOptionsManager is
|
||||
// expected to do that.
|
||||
bool Decode(const GoogleUrl& request_url,
|
||||
const RewriteOptions* rewrite_options,
|
||||
GoogleString* decoded) const override;
|
||||
@@ -61,6 +59,9 @@ class MeasurementProxyUrlNamer : public UrlNamer {
|
||||
}
|
||||
|
||||
private:
|
||||
GoogleString top_origin_;
|
||||
GoogleString password_;
|
||||
|
||||
DISALLOW_COPY_AND_ASSIGN(MeasurementProxyUrlNamer);
|
||||
};
|
||||
|
||||
|
||||
@@ -162,7 +162,9 @@ void ApacheServerContext::ChildInit(SystemRewriteDriverFactory* f) {
|
||||
if (global_config()->proxy_all_requests_mode()) {
|
||||
apache_factory_->SetNeedSchedulerThread();
|
||||
if (global_config()->measurement_proxy_mode()) {
|
||||
measurement_url_namer_.reset(new MeasurementProxyUrlNamer());
|
||||
measurement_url_namer_.reset(new MeasurementProxyUrlNamer(
|
||||
global_config()->measurement_proxy_root(),
|
||||
global_config()->measurement_proxy_password()));
|
||||
set_url_namer(measurement_url_namer_.get());
|
||||
SetRewriteOptionsManager(new MeasurementProxyRewriteOptionsManager(
|
||||
this,
|
||||
|
||||
Reference in New Issue
Block a user