Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CBL-4719: ReplicatorAPITest::options() Set proxy settings from _sg.proxy #1843

Merged
merged 2 commits into from
Jul 21, 2023
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
38 changes: 37 additions & 1 deletion Replicator/tests/ReplicatorAPITest.hh
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,43 @@ class ReplicatorAPITest : public C4Test {
enc.writeString(_sg.networkInterface);
}

// TODO: Set proxy settings from _proxy
if ( _sg.proxy ) {
enc.writeKey(C4STR(kC4ReplicatorProxyType));
slice proxyType;
switch ( _sg.proxy->type ) {
case ProxyType::HTTP:
proxyType = slice(kC4ProxyTypeHTTP);
case ProxyType::HTTPS:
proxyType = slice(kC4ProxyTypeHTTPS);
// TODO: Once SOCKS is implemented (CBL-4715)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's not :D

// case ProxyType::SOCKS:
// proxyType = slice(kC4ProxyTypeSOCKS);
default:
proxyType = kC4ProxyTypeNone;
}
enc.writeString(proxyType);
if ( proxyType != slice(kC4ProxyTypeNone) ) {
enc.writeKey(kC4ReplicatorProxyHost);
enc.writeString(_sg.proxy->hostname);

enc.writeKey(kC4ReplicatorProxyPort);
enc.writeInt(_sg.proxy->port);

enc.writeKey(kC4ReplicatorProxyAuth);
enc.beginDict();

enc.writeKey(kC4ReplicatorAuthType);
enc.writeString(kC4AuthTypeBasic);

enc.writeKey(kC4ReplicatorAuthUserName);
enc.writeString(_sg.proxy->username);

enc.writeKey(kC4ReplicatorAuthPassword);
enc.writeString(_sg.proxy->password);

enc.endDict();
}
}
// Copy any preexisting options:
for ( Dict::iterator i(_options.asDict()); i; ++i ) {
enc.writeKey(i.keyString());
Expand Down
Loading