Merge branch 'master' into rfc1143
diff --git a/libtelnet.c b/libtelnet.c
index 1b08287..1860ece 100644
--- a/libtelnet.c
+++ b/libtelnet.c
@@ -547,7 +547,7 @@
 		unsigned int size) {
 #ifdef HAVE_ZLIB
 	/* if we have an inflate (decompression) zlib stream, use it */
-	if (telnet->z != 0) {
+	if (telnet->z != 0 && !(telnet->flags & LIBTELNET_PFLAG_DEFLATE)) {
 		unsigned char inflate_buffer[4096];
 		int rs;
 
@@ -597,7 +597,7 @@
 		unsigned int size) {
 #ifdef HAVE_ZLIB
 	/* if we have a deflate (compression) zlib box, use it */
-	if (telnet->z != 0) {
+	if (telnet->z != 0 && telnet->flags & LIBTELNET_PFLAG_DEFLATE) {
 		unsigned char deflate_buffer[1024];
 		int rs;