leaf-potato commented on code in PR #2102:
URL: https://github.com/apache/brpc/pull/2102#discussion_r1096714580
##########
src/brpc/server.cpp:
##########
@@ -642,6 +642,33 @@ int Server::InitializeOnce() {
return 0;
}
+int Server::InitALPNOptions(ServerSSLOptions* options) {
+ if (options == nullptr) {
+ LOG(ERROR) << "Fail to init alpn options, ssl options is nullptr.";
+ return -1;
+ }
+
+ const std::string& alpns = options->alpns;
+ butil::StringSplitter split(alpns.data(), alpns.data() + alpns.size(),
',');
+
+ std::string row_protocol;
+ for (; split; split++) {
Review Comment:
写法参考的src/brpc/details/ssl_helper.cpp文件中ParseSSLProtocols函数里的实现
可能的1个改动点:split++ => ++split
##########
src/brpc/details/ssl_helper.cpp:
##########
@@ -441,6 +441,42 @@ static int SetSSLOptions(SSL_CTX* ctx, const std::string&
ciphers,
return 0;
}
+static int ServerALPNCallback(SSL* ssl,
Review Comment:
好像第1个参数都没单独换行。是说第2、3行没有和第1个参数缩进对齐?
##########
src/brpc/details/ssl_helper.cpp:
##########
@@ -441,6 +441,42 @@ static int SetSSLOptions(SSL_CTX* ctx, const std::string&
ciphers,
return 0;
}
+static int ServerALPNCallback(SSL* ssl,
+ const unsigned char** out, unsigned char* outlen,
+ const unsigned char* in, unsigned int inlen, void* arg) {
+ const std::string* alpns = static_cast<const std::string*>(arg);
+ if (alpns == nullptr) {
+ return SSL_TLSEXT_ERR_NOACK;
+ }
+
+ // Use OpenSSL standard select API.
+ int select_result = SSL_select_next_proto(
Review Comment:
这儿感觉加不加都行?
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]