s_client should inform the user of any compression/expansion methods used.
[openssl.git] / apps / s_client.c
index 74d578d6bef2cc416ec1fd3eeb65c34442e4c07f..0f7dd88613ffc49dc1b6400f755c21075f18dca1 100644 (file)
@@ -136,10 +136,6 @@ typedef unsigned int u_int;
 #include <openssl/rand.h>
 #include "s_apps.h"
 
-#ifdef OPENSSL_SYS_WINDOWS
-#include <conio.h>
-#endif
-
 #ifdef OPENSSL_SYS_WINCE
 /* Windows CE incorrectly defines fileno as returning void*, so to avoid problems below... */
 #ifdef fileno
@@ -260,7 +256,7 @@ int MAIN(int argc, char **argv)
        char *engine_id=NULL;
        ENGINE *e=NULL;
 #endif
-#ifdef OPENSSL_SYS_WINDOWS
+#if defined(OPENSSL_SYS_WINDOWS) || defined(OPENSSL_SYS_MSDOS)
        struct timeval tv;
 #endif
 
@@ -644,7 +640,7 @@ re_start:
 
                if (!ssl_pending)
                        {
-#ifndef OPENSSL_SYS_WINDOWS
+#if !defined(OPENSSL_SYS_WINDOWS) && !defined(OPENSSL_SYS_MSDOS)
                        if (tty_on)
                                {
                                if (read_tty)  FD_SET(fileno(stdin),&readfds);
@@ -671,8 +667,8 @@ re_start:
                         * will choke the compiler: if you do have a cast then
                         * you can either go for (int *) or (void *).
                         */
-#ifdef OPENSSL_SYS_WINDOWS
-                       /* Under Windows we make the assumption that we can
+#if defined(OPENSSL_SYS_WINDOWS) || defined(OPENSSL_SYS_MSDOS)
+                        /* Under Windows/DOS we make the assumption that we can
                         * always write to the tty: therefore if we need to
                         * write to the tty we just fall through. Otherwise
                         * we timeout the select every second and see if there
@@ -686,7 +682,7 @@ re_start:
                                        tv.tv_usec = 0;
                                        i=select(width,(void *)&readfds,(void *)&writefds,
                                                 NULL,&tv);
-#ifdef OPENSSL_SYS_WINCE
+#if defined(OPENSSL_SYS_WINCE) || defined(OPENSSL_SYS_MSDOS)
                                        if(!i && (!_kbhit() || !read_tty) ) continue;
 #else
                                        if(!i && (!((_kbhit()) || (WAIT_OBJECT_0 == WaitForSingleObject(GetStdHandle(STD_INPUT_HANDLE), 0))) || !read_tty) ) continue;
@@ -855,8 +851,8 @@ printf("read=%d pending=%d peek=%d\n",k,SSL_pending(con),SSL_peek(con,zbuf,10240
                                }
                        }
 
-#ifdef OPENSSL_SYS_WINDOWS
-#ifdef OPENSSL_SYS_WINCE
+#if defined(OPENSSL_SYS_WINDOWS) || defined(OPENSSL_SYS_MSDOS)
+#if defined(OPENSSL_SYS_WINCE) || defined(OPENSSL_SYS_MSDOS)
                else if (_kbhit())
 #else
                else if ((_kbhit()) || (WAIT_OBJECT_0 == WaitForSingleObject(GetStdHandle(STD_INPUT_HANDLE), 0)))
@@ -948,6 +944,7 @@ static void print_stuff(BIO *bio, SSL *s, int full)
        SSL_CIPHER *c;
        X509_NAME *xn;
        int j,i;
+       const COMP_METHOD *comp, *exp;
 
        if (full)
                {
@@ -1050,6 +1047,12 @@ static void print_stuff(BIO *bio, SSL *s, int full)
                                                         EVP_PKEY_bits(pktmp));
                EVP_PKEY_free(pktmp);
        }
+       comp=SSL_get_current_compression(s);
+       exp=SSL_get_current_expansion(s);
+       BIO_printf(bio,"Compression: %s\n",
+               comp ? SSL_COMP_get_name(comp) : "NONE");
+       BIO_printf(bio,"Expansion: %s\n",
+               exp ? SSL_COMP_get_name(exp) : "NONE");
        SSL_SESSION_print(bio,SSL_get_session(s));
        BIO_printf(bio,"---\n");
        if (peer != NULL)