summaryrefslogtreecommitdiffstats
path: root/apps/s_server.c
diff options
context:
space:
mode:
authorDr. Stephen Henson <steve@openssl.org>2012-11-19 23:41:24 +0000
committerDr. Stephen Henson <steve@openssl.org>2013-08-19 14:14:05 +0100
commit08374de10f1cefc02122368c91b0cf4aff791f25 (patch)
tree671929f6dd25150a4707b870b12b15329f478c81 /apps/s_server.c
parent506e70a2164ff4c5d05c4159d30b06577cd57689 (diff)
with -rev close connection if client sends "CLOSE"
(cherry picked from commit 685755937a4f9f8b16f8953f631e14808f785c39)
Diffstat (limited to 'apps/s_server.c')
-rw-r--r--apps/s_server.c11
1 files changed, 11 insertions, 0 deletions
diff --git a/apps/s_server.c b/apps/s_server.c
index 6abb4d562c..b67ab4128e 100644
--- a/apps/s_server.c
+++ b/apps/s_server.c
@@ -296,6 +296,7 @@ static int cert_status_cb(SSL *s, void *arg);
static int no_resume_ephemeral = 0;
static int s_msg=0;
static int s_quiet=0;
+static int s_ign_eof=0;
static int s_brief=0;
static char *keymatexportlabel=NULL;
@@ -1223,6 +1224,10 @@ int MAIN(int argc, char *argv[])
#endif
s_nbio_test=1;
}
+ else if (strcmp(*argv,"-ign_eof") == 0)
+ s_ign_eof=1;
+ else if (strcmp(*argv,"-no_ign_eof") == 0)
+ s_ign_eof=0;
else if (strcmp(*argv,"-debug") == 0)
{ s_debug=1; }
#ifndef OPENSSL_NO_TLSEXT
@@ -3199,6 +3204,12 @@ static int rev_body(char *hostname, int s, unsigned char *context)
p--;
i--;
}
+ if (!s_ign_eof && i == 5 && !strncmp(buf, "CLOSE", 5))
+ {
+ ret = 1;
+ BIO_printf(bio_err, "CONNECTION CLOSED\n");
+ goto end;
+ }
BUF_reverse((unsigned char *)buf, NULL, i);
buf[i] = '\n';
BIO_write(io, buf, i + 1);