Add comment on #endif
This commit is contained in:
parent
636ef51b0f
commit
e65e7711ca
|
@ -379,7 +379,7 @@ static void init_ssl_ctx(SSL_CTX *ssl_ctx) {
|
||||||
/* Set NPN callback */
|
/* Set NPN callback */
|
||||||
#ifndef OPENSSL_NO_NEXTPROTONEG
|
#ifndef OPENSSL_NO_NEXTPROTONEG
|
||||||
SSL_CTX_set_next_proto_select_cb(ssl_ctx, select_next_proto_cb, NULL);
|
SSL_CTX_set_next_proto_select_cb(ssl_ctx, select_next_proto_cb, NULL);
|
||||||
#endif
|
#endif /* !OPENSSL_NO_NEXTPROTONEG */
|
||||||
}
|
}
|
||||||
|
|
||||||
static void ssl_handshake(SSL *ssl, int fd) {
|
static void ssl_handshake(SSL *ssl, int fd) {
|
||||||
|
|
|
@ -339,7 +339,7 @@ static SSL_CTX *create_ssl_ctx(void) {
|
||||||
SSL_OP_NO_SESSION_RESUMPTION_ON_RENEGOTIATION);
|
SSL_OP_NO_SESSION_RESUMPTION_ON_RENEGOTIATION);
|
||||||
#ifndef OPENSSL_NO_NEXTPROTONEG
|
#ifndef OPENSSL_NO_NEXTPROTONEG
|
||||||
SSL_CTX_set_next_proto_select_cb(ssl_ctx, select_next_proto_cb, NULL);
|
SSL_CTX_set_next_proto_select_cb(ssl_ctx, select_next_proto_cb, NULL);
|
||||||
#endif
|
#endif /* !OPENSSL_NO_NEXTPROTONEG */
|
||||||
|
|
||||||
#if OPENSSL_VERSION_NUMBER >= 0x10002000L
|
#if OPENSSL_VERSION_NUMBER >= 0x10002000L
|
||||||
SSL_CTX_set_alpn_protos(ssl_ctx, (const unsigned char *)"\x02h2", 3);
|
SSL_CTX_set_alpn_protos(ssl_ctx, (const unsigned char *)"\x02h2", 3);
|
||||||
|
@ -510,7 +510,7 @@ static void eventcb(struct bufferevent *bev, short events, void *ptr) {
|
||||||
|
|
||||||
#ifndef OPENSSL_NO_NEXTPROTONEG
|
#ifndef OPENSSL_NO_NEXTPROTONEG
|
||||||
SSL_get0_next_proto_negotiated(ssl, &alpn, &alpnlen);
|
SSL_get0_next_proto_negotiated(ssl, &alpn, &alpnlen);
|
||||||
#endif
|
#endif /* !OPENSSL_NO_NEXTPROTONEG */
|
||||||
#if OPENSSL_VERSION_NUMBER >= 0x10002000L
|
#if OPENSSL_VERSION_NUMBER >= 0x10002000L
|
||||||
if (alpn == NULL) {
|
if (alpn == NULL) {
|
||||||
SSL_get0_alpn_selected(ssl, &alpn, &alpnlen);
|
SSL_get0_alpn_selected(ssl, &alpn, &alpnlen);
|
||||||
|
|
|
@ -176,7 +176,7 @@ static SSL_CTX *create_ssl_ctx(const char *key_file, const char *cert_file) {
|
||||||
|
|
||||||
#ifndef OPENSSL_NO_NEXTPROTONEG
|
#ifndef OPENSSL_NO_NEXTPROTONEG
|
||||||
SSL_CTX_set_next_protos_advertised_cb(ssl_ctx, next_proto_cb, NULL);
|
SSL_CTX_set_next_protos_advertised_cb(ssl_ctx, next_proto_cb, NULL);
|
||||||
#endif
|
#endif /* !OPENSSL_NO_NEXTPROTONEG */
|
||||||
|
|
||||||
#if OPENSSL_VERSION_NUMBER >= 0x10002000L
|
#if OPENSSL_VERSION_NUMBER >= 0x10002000L
|
||||||
SSL_CTX_set_alpn_select_cb(ssl_ctx, alpn_select_proto_cb, NULL);
|
SSL_CTX_set_alpn_select_cb(ssl_ctx, alpn_select_proto_cb, NULL);
|
||||||
|
@ -696,7 +696,7 @@ static void eventcb(struct bufferevent *bev, short events, void *ptr) {
|
||||||
|
|
||||||
#ifndef OPENSSL_NO_NEXTPROTONEG
|
#ifndef OPENSSL_NO_NEXTPROTONEG
|
||||||
SSL_get0_next_proto_negotiated(ssl, &alpn, &alpnlen);
|
SSL_get0_next_proto_negotiated(ssl, &alpn, &alpnlen);
|
||||||
#endif
|
#endif /* !OPENSSL_NO_NEXTPROTONEG */
|
||||||
#if OPENSSL_VERSION_NUMBER >= 0x10002000L
|
#if OPENSSL_VERSION_NUMBER >= 0x10002000L
|
||||||
if (alpn == NULL) {
|
if (alpn == NULL) {
|
||||||
SSL_get0_alpn_selected(ssl, &alpn, &alpnlen);
|
SSL_get0_alpn_selected(ssl, &alpn, &alpnlen);
|
||||||
|
|
|
@ -890,7 +890,7 @@ int Http2Handler::verify_npn_result() {
|
||||||
// Check the negotiated protocol in NPN or ALPN
|
// Check the negotiated protocol in NPN or ALPN
|
||||||
#ifndef OPENSSL_NO_NEXTPROTONEG
|
#ifndef OPENSSL_NO_NEXTPROTONEG
|
||||||
SSL_get0_next_proto_negotiated(ssl_, &next_proto, &next_proto_len);
|
SSL_get0_next_proto_negotiated(ssl_, &next_proto, &next_proto_len);
|
||||||
#endif
|
#endif // !OPENSSL_NO_NEXTPROTONEG
|
||||||
for (int i = 0; i < 2; ++i) {
|
for (int i = 0; i < 2; ++i) {
|
||||||
if (next_proto) {
|
if (next_proto) {
|
||||||
auto proto = StringRef{next_proto, next_proto_len};
|
auto proto = StringRef{next_proto, next_proto_len};
|
||||||
|
@ -2211,7 +2211,7 @@ int HttpServer::run() {
|
||||||
|
|
||||||
#ifndef OPENSSL_NO_NEXTPROTONEG
|
#ifndef OPENSSL_NO_NEXTPROTONEG
|
||||||
SSL_CTX_set_next_protos_advertised_cb(ssl_ctx, next_proto_cb, &next_proto);
|
SSL_CTX_set_next_protos_advertised_cb(ssl_ctx, next_proto_cb, &next_proto);
|
||||||
#endif
|
#endif // !OPENSSL_NO_NEXTPROTONEG
|
||||||
#if OPENSSL_VERSION_NUMBER >= 0x10002000L
|
#if OPENSSL_VERSION_NUMBER >= 0x10002000L
|
||||||
// ALPN selection callback
|
// ALPN selection callback
|
||||||
SSL_CTX_set_alpn_select_cb(ssl_ctx, alpn_select_proto_cb, this);
|
SSL_CTX_set_alpn_select_cb(ssl_ctx, alpn_select_proto_cb, this);
|
||||||
|
|
|
@ -179,7 +179,7 @@ bool tls_h2_negotiated(ssl_socket &socket) {
|
||||||
|
|
||||||
#ifndef OPENSSL_NO_NEXTPROTONEG
|
#ifndef OPENSSL_NO_NEXTPROTONEG
|
||||||
SSL_get0_next_proto_negotiated(ssl, &next_proto, &next_proto_len);
|
SSL_get0_next_proto_negotiated(ssl, &next_proto, &next_proto_len);
|
||||||
#endif
|
#endif // !OPENSSL_NO_NEXTPROTONEG
|
||||||
#if OPENSSL_VERSION_NUMBER >= 0x10002000L
|
#if OPENSSL_VERSION_NUMBER >= 0x10002000L
|
||||||
if (next_proto == nullptr) {
|
if (next_proto == nullptr) {
|
||||||
SSL_get0_alpn_selected(ssl, &next_proto, &next_proto_len);
|
SSL_get0_alpn_selected(ssl, &next_proto, &next_proto_len);
|
||||||
|
|
|
@ -859,7 +859,7 @@ int Client::connection_made() {
|
||||||
|
|
||||||
#ifndef OPENSSL_NO_NEXTPROTONEG
|
#ifndef OPENSSL_NO_NEXTPROTONEG
|
||||||
SSL_get0_next_proto_negotiated(ssl, &next_proto, &next_proto_len);
|
SSL_get0_next_proto_negotiated(ssl, &next_proto, &next_proto_len);
|
||||||
#endif
|
#endif // !OPENSSL_NO_NEXTPROTONEG
|
||||||
#if OPENSSL_VERSION_NUMBER >= 0x10002000L
|
#if OPENSSL_VERSION_NUMBER >= 0x10002000L
|
||||||
if (next_proto == nullptr) {
|
if (next_proto == nullptr) {
|
||||||
SSL_get0_alpn_selected(ssl, &next_proto, &next_proto_len);
|
SSL_get0_alpn_selected(ssl, &next_proto, &next_proto_len);
|
||||||
|
@ -2406,7 +2406,7 @@ int main(int argc, char **argv) {
|
||||||
#ifndef OPENSSL_NO_NEXTPROTONEG
|
#ifndef OPENSSL_NO_NEXTPROTONEG
|
||||||
SSL_CTX_set_next_proto_select_cb(ssl_ctx, client_select_next_proto_cb,
|
SSL_CTX_set_next_proto_select_cb(ssl_ctx, client_select_next_proto_cb,
|
||||||
nullptr);
|
nullptr);
|
||||||
#endif
|
#endif // !OPENSSL_NO_NEXTPROTONEG
|
||||||
|
|
||||||
#if OPENSSL_VERSION_NUMBER >= 0x10002000L
|
#if OPENSSL_VERSION_NUMBER >= 0x10002000L
|
||||||
std::vector<unsigned char> proto_list;
|
std::vector<unsigned char> proto_list;
|
||||||
|
|
|
@ -1097,7 +1097,7 @@ int HttpClient::connection_made() {
|
||||||
unsigned int next_proto_len;
|
unsigned int next_proto_len;
|
||||||
#ifndef OPENSSL_NO_NEXTPROTONEG
|
#ifndef OPENSSL_NO_NEXTPROTONEG
|
||||||
SSL_get0_next_proto_negotiated(ssl, &next_proto, &next_proto_len);
|
SSL_get0_next_proto_negotiated(ssl, &next_proto, &next_proto_len);
|
||||||
#endif
|
#endif // !OPENSSL_NO_NEXTPROTONEG
|
||||||
for (int i = 0; i < 2; ++i) {
|
for (int i = 0; i < 2; ++i) {
|
||||||
if (next_proto) {
|
if (next_proto) {
|
||||||
auto proto = StringRef{next_proto, next_proto_len};
|
auto proto = StringRef{next_proto, next_proto_len};
|
||||||
|
@ -2315,7 +2315,7 @@ int communicate(
|
||||||
#ifndef OPENSSL_NO_NEXTPROTONEG
|
#ifndef OPENSSL_NO_NEXTPROTONEG
|
||||||
SSL_CTX_set_next_proto_select_cb(ssl_ctx, client_select_next_proto_cb,
|
SSL_CTX_set_next_proto_select_cb(ssl_ctx, client_select_next_proto_cb,
|
||||||
nullptr);
|
nullptr);
|
||||||
#endif
|
#endif // !OPENSSL_NO_NEXTPROTONEG
|
||||||
|
|
||||||
#if OPENSSL_VERSION_NUMBER >= 0x10002000L
|
#if OPENSSL_VERSION_NUMBER >= 0x10002000L
|
||||||
auto proto_list = util::get_default_alpn();
|
auto proto_list = util::get_default_alpn();
|
||||||
|
|
|
@ -551,7 +551,7 @@ int ClientHandler::validate_next_proto() {
|
||||||
|
|
||||||
#ifndef OPENSSL_NO_NEXTPROTONEG
|
#ifndef OPENSSL_NO_NEXTPROTONEG
|
||||||
SSL_get0_next_proto_negotiated(conn_.tls.ssl, &next_proto, &next_proto_len);
|
SSL_get0_next_proto_negotiated(conn_.tls.ssl, &next_proto, &next_proto_len);
|
||||||
#endif
|
#endif // !OPENSSL_NO_NEXTPROTONEG
|
||||||
#if OPENSSL_VERSION_NUMBER >= 0x10002000L
|
#if OPENSSL_VERSION_NUMBER >= 0x10002000L
|
||||||
if (next_proto == nullptr) {
|
if (next_proto == nullptr) {
|
||||||
SSL_get0_alpn_selected(conn_.tls.ssl, &next_proto, &next_proto_len);
|
SSL_get0_alpn_selected(conn_.tls.ssl, &next_proto, &next_proto_len);
|
||||||
|
|
|
@ -525,7 +525,7 @@ int Connection::check_http2_requirement() {
|
||||||
|
|
||||||
#ifndef OPENSSL_NO_NEXTPROTONEG
|
#ifndef OPENSSL_NO_NEXTPROTONEG
|
||||||
SSL_get0_next_proto_negotiated(tls.ssl, &next_proto, &next_proto_len);
|
SSL_get0_next_proto_negotiated(tls.ssl, &next_proto, &next_proto_len);
|
||||||
#endif
|
#endif // !OPENSSL_NO_NEXTPROTONEG
|
||||||
#if OPENSSL_VERSION_NUMBER >= 0x10002000L
|
#if OPENSSL_VERSION_NUMBER >= 0x10002000L
|
||||||
if (next_proto == nullptr) {
|
if (next_proto == nullptr) {
|
||||||
SSL_get0_alpn_selected(tls.ssl, &next_proto, &next_proto_len);
|
SSL_get0_alpn_selected(tls.ssl, &next_proto, &next_proto_len);
|
||||||
|
|
|
@ -1651,7 +1651,7 @@ int Http2Session::connection_made() {
|
||||||
|
|
||||||
#ifndef OPENSSL_NO_NEXTPROTONEG
|
#ifndef OPENSSL_NO_NEXTPROTONEG
|
||||||
SSL_get0_next_proto_negotiated(conn_.tls.ssl, &next_proto, &next_proto_len);
|
SSL_get0_next_proto_negotiated(conn_.tls.ssl, &next_proto, &next_proto_len);
|
||||||
#endif
|
#endif // !OPENSSL_NO_NEXTPROTONEG
|
||||||
#if OPENSSL_VERSION_NUMBER >= 0x10002000L
|
#if OPENSSL_VERSION_NUMBER >= 0x10002000L
|
||||||
if (!next_proto) {
|
if (!next_proto) {
|
||||||
SSL_get0_alpn_selected(conn_.tls.ssl, &next_proto, &next_proto_len);
|
SSL_get0_alpn_selected(conn_.tls.ssl, &next_proto, &next_proto_len);
|
||||||
|
|
|
@ -408,7 +408,7 @@ int LiveCheck::tls_handshake() {
|
||||||
|
|
||||||
#ifndef OPENSSL_NO_NEXTPROTONEG
|
#ifndef OPENSSL_NO_NEXTPROTONEG
|
||||||
SSL_get0_next_proto_negotiated(conn_.tls.ssl, &next_proto, &next_proto_len);
|
SSL_get0_next_proto_negotiated(conn_.tls.ssl, &next_proto, &next_proto_len);
|
||||||
#endif
|
#endif // !OPENSSL_NO_NEXTPROTONEG
|
||||||
#if OPENSSL_VERSION_NUMBER >= 0x10002000L
|
#if OPENSSL_VERSION_NUMBER >= 0x10002000L
|
||||||
if (next_proto == nullptr) {
|
if (next_proto == nullptr) {
|
||||||
SSL_get0_alpn_selected(conn_.tls.ssl, &next_proto, &next_proto_len);
|
SSL_get0_alpn_selected(conn_.tls.ssl, &next_proto, &next_proto_len);
|
||||||
|
|
|
@ -927,7 +927,7 @@ SSL_CTX *create_ssl_context(const char *private_key_file, const char *cert_file,
|
||||||
// NPN advertisement
|
// NPN advertisement
|
||||||
#ifndef OPENSSL_NO_NEXTPROTONEG
|
#ifndef OPENSSL_NO_NEXTPROTONEG
|
||||||
SSL_CTX_set_next_protos_advertised_cb(ssl_ctx, next_proto_cb, nullptr);
|
SSL_CTX_set_next_protos_advertised_cb(ssl_ctx, next_proto_cb, nullptr);
|
||||||
#endif
|
#endif // !OPENSSL_NO_NEXTPROTONEG
|
||||||
#if OPENSSL_VERSION_NUMBER >= 0x10002000L
|
#if OPENSSL_VERSION_NUMBER >= 0x10002000L
|
||||||
// ALPN selection callback
|
// ALPN selection callback
|
||||||
SSL_CTX_set_alpn_select_cb(ssl_ctx, alpn_select_proto_cb, nullptr);
|
SSL_CTX_set_alpn_select_cb(ssl_ctx, alpn_select_proto_cb, nullptr);
|
||||||
|
@ -1124,7 +1124,7 @@ SSL_CTX *create_ssl_client_context(
|
||||||
// OpenSSL does not offer SSL_set_next_proto_select_cb.
|
// OpenSSL does not offer SSL_set_next_proto_select_cb.
|
||||||
#ifndef OPENSSL_NO_NEXTPROTONEG
|
#ifndef OPENSSL_NO_NEXTPROTONEG
|
||||||
SSL_CTX_set_next_proto_select_cb(ssl_ctx, next_proto_select_cb, nullptr);
|
SSL_CTX_set_next_proto_select_cb(ssl_ctx, next_proto_select_cb, nullptr);
|
||||||
#endif
|
#endif // !OPENSSL_NO_NEXTPROTONEG
|
||||||
|
|
||||||
return ssl_ctx;
|
return ssl_ctx;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue