Commit a87dba71 authored by Fred Qiu's avatar Fred Qiu Committed by Facebook GitHub Bot

Rename alpn option in folly/openssl

Summary:
Renamed alpn option from requireAlpnIfClientSupports to
alpnAllowMismatch.

Reviewed By: knekritz

Differential Revision: D29968118

fbshipit-source-id: bb515efec22520e52444530a2de2b3835691c26c
parent 24821079
......@@ -590,7 +590,7 @@ int SSLContext::alpnSelectCallback(
item.length,
in,
inlen) != OPENSSL_NPN_NEGOTIATED) {
if (context->getRequireAlpnIfClientSupports()) {
if (!context->getAlpnAllowMismatch()) {
return SSL_TLSEXT_ERR_ALERT_FATAL;
} else {
return SSL_TLSEXT_ERR_NOACK;
......
......@@ -533,12 +533,10 @@ class SSLContext {
void unsetNextProtocols();
void deleteNextProtocolsStrings();
bool getRequireAlpnIfClientSupports() const {
return requireAlpnIfClientSupports_;
}
bool getAlpnAllowMismatch() const { return alpnAllowMismatch_; }
void setRequireAlpnIfClientSupports(bool require) {
requireAlpnIfClientSupports_ = require;
void setAlpnAllowMismatch(bool allowMismatch) {
alpnAllowMismatch_ = allowMismatch;
}
#endif // FOLLY_OPENSSL_HAS_ALPN
......@@ -685,7 +683,7 @@ class SSLContext {
size_t pickNextProtocols();
bool requireAlpnIfClientSupports_{false};
bool alpnAllowMismatch_{true};
#endif // FOLLY_OPENSSL_HAS_ALPN
......
......@@ -587,10 +587,10 @@ TEST_F(NextProtocolTest, RandomizedAlpnTest) {
EXPECT_EQ(selectedProtocols.size(), 2);
}
TEST_F(NextProtocolTest, AlpnRequiredIfClientSupportsTestNoClientProtocol) {
TEST_F(NextProtocolTest, AlpnNotAllowMismatchNoClientProtocol) {
clientCtx->setAdvertisedNextProtocols({});
serverCtx->setAdvertisedNextProtocols({"foo", "bar", "baz"});
serverCtx->setRequireAlpnIfClientSupports(true);
serverCtx->setAlpnAllowMismatch(false);
connect();
......@@ -598,20 +598,20 @@ TEST_F(NextProtocolTest, AlpnRequiredIfClientSupportsTestNoClientProtocol) {
expectNoProtocol();
}
TEST_F(NextProtocolTest, AlpnRequiredIfClientSupportsTestOverlap) {
TEST_F(NextProtocolTest, AlpnNotAllowMismatchWithOverlap) {
clientCtx->setAdvertisedNextProtocols({"blub", "baz"});
serverCtx->setAdvertisedNextProtocols({"foo", "bar", "baz"});
serverCtx->setRequireAlpnIfClientSupports(true);
serverCtx->setAlpnAllowMismatch(false);
connect();
expectProtocol("baz");
}
TEST_F(NextProtocolTest, AlpnRequiredIfClientSupportsTestNoOverlap) {
TEST_F(NextProtocolTest, AlpnNotAllowMismatchWithoutOverlap) {
clientCtx->setAdvertisedNextProtocols({"blub"});
serverCtx->setAdvertisedNextProtocols({"foo", "bar", "baz"});
serverCtx->setRequireAlpnIfClientSupports(true);
serverCtx->setAlpnAllowMismatch(false);
connect();
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment