summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorNikos Mavrogiannopoulos <nmav@gnutls.org>2013-05-05 12:05:11 +0300
committerNikos Mavrogiannopoulos <nmav@gnutls.org>2013-05-05 12:05:11 +0300
commitb3bab6daacff9126b194ca78485fdc7073d05a42 (patch)
tree9739cb49fa8a2b92fdb45c54a26814b7c65f12b2 /src
parent3dc88589897ea3b08cf1e736e643637eea39264c (diff)
downloadgnutls-b3bab6daacff9126b194ca78485fdc7073d05a42.tar.gz
Added --alpn option to cli
Diffstat (limited to 'src')
-rw-r--r--src/cli-args.def7
-rw-r--r--src/cli.c6
2 files changed, 13 insertions, 0 deletions
diff --git a/src/cli-args.def b/src/cli-args.def
index 5e663c09df..c6516a7e33 100644
--- a/src/cli-args.def
+++ b/src/cli-args.def
@@ -258,6 +258,13 @@ flag = {
};
flag = {
+ name = alpn;
+ arg-type = string;
+ descrip = "Application layer protocol";
+ doc = "This option will set and enable the Application Layer Protocol Negotiation (ALPN) in the TLS protocol.";
+};
+
+flag = {
name = port;
value = p;
arg-type = string;
diff --git a/src/cli.c b/src/cli.c
index 273ba624b7..5b69ce0dae 100644
--- a/src/cli.c
+++ b/src/cli.c
@@ -662,6 +662,12 @@ init_tls_session (const char *hostname)
if (HAVE_OPT(DH_BITS))
gnutls_dh_set_prime_bits( session, OPT_VALUE_DH_BITS);
+
+ if (HAVE_OPT(ALPN))
+ {
+ gnutls_datum_t p = { OPT_ARG(ALPN), strlen(OPT_ARG(ALPN)) };
+ gnutls_alpn_set_protocols( session, &p, 1);
+ }
gnutls_credentials_set (session, GNUTLS_CRD_ANON, anon_cred);
if (srp_cred)