diff --git a/lib/modules/SSL.pmod/File.pike b/lib/modules/SSL.pmod/File.pike index 2669aabb4bbbc822dea937daee01e30107969348..53e21ef4bd5a21ff542a01824acb0cd17f7a2305 100644 --- a/lib/modules/SSL.pmod/File.pike +++ b/lib/modules/SSL.pmod/File.pike @@ -2298,10 +2298,10 @@ protected int ssl_close_callback (int called_from_real_backend) return -1; } -//! The next protocol chosen by the client during application layer -//! protocol negotiation (ALPN) or next protocol negotiation (NPN). -string `->next_protocol() { - return conn->next_protocol; +//! The application protocol chosen by the client during application layer +//! protocol negotiation (ALPN). +string `->application_protocol() { + return conn->application_protocol; } //! Return the currently active cipher suite. diff --git a/lib/modules/SSL.pmod/ServerConnection.pike b/lib/modules/SSL.pmod/ServerConnection.pike index be62a794d6f54aaec389fc4baceeb331e20369fb..79229118024848beeeb8cc71bec7b070f8c90771 100644 --- a/lib/modules/SSL.pmod/ServerConnection.pike +++ b/lib/modules/SSL.pmod/ServerConnection.pike @@ -14,8 +14,10 @@ import "."; import Constants; inherit Connection; +// ALPN int has_application_layer_protocol_negotiation; -string(8bit) next_protocol; +string(8bit) application_protocol; + multiset(int) remote_extensions = (<>); int reuse; @@ -107,9 +109,9 @@ Packet server_hello_packet() }; ext (EXTENSION_application_layer_protocol_negotiation, - next_protocol && has_application_layer_protocol_negotiation) + application_protocol && has_application_layer_protocol_negotiation) { - return ADT.struct()->put_var_string_array( ({next_protocol}), 1, 2); + return ADT.struct()->put_var_string_array(({application_protocol}), 1, 2); }; if (fail) return fail; @@ -553,18 +555,18 @@ int(-1..1) handle_handshake(int type, string(8bit) data, string(8bit) raw) // Although the protocol list is sent in client // preference order, it is the server preference that // wins. - next_protocol = 0; + application_protocol = 0; foreach(context->advertised_protocols;; string(8bit) prot) if( protocols[prot] ) { - next_protocol = prot; + application_protocol = prot; break; } - if( !next_protocol ) + if( !application_protocol ) send_packet(alert(ALERT_fatal, ALERT_no_application_protocol, "ALPN: No compatible protocol.\n")); SSL3_DEBUG_MSG("ALPN extension: %O %O\n", - protocols, next_protocol); + protocols, application_protocol); } break; @@ -756,16 +758,8 @@ int(-1..1) handle_handshake(int type, string(8bit) data, string(8bit) raw) { default: send_packet(alert(ALERT_fatal, ALERT_unexpected_message, - "Expected next protocol or finished.\n")); + "Expected finished.\n")); return -1; - case HANDSHAKE_next_protocol: - { - // draft-agl-tls-nextprotoneg-03 - next_protocol = input->get_var_string(1); - string padding = input->get_var_string(1); - handshake_messages += raw; - break; - } case HANDSHAKE_finished: { string(8bit) my_digest;