changeset 1786:bc9333acb2fd

8189789: tomcat gzip-compressed response bodies appear to be broken in update 151 Reviewed-by: sherman, phh
author coffeys
date Thu, 09 Nov 2017 22:05:56 +0300
parents 9d464511a79e
children 87dbd3902655
files src/share/native/java/util/zip/Deflater.c src/share/native/java/util/zip/zlib/deflate.c src/share/native/java/util/zip/zlib/patches/ChangeLog_java
diffstat 3 files changed, 8 insertions(+), 11 deletions(-) [+]
line wrap: on
line diff
--- a/src/share/native/java/util/zip/Deflater.c	Tue Nov 14 12:28:43 2017 +0530
+++ b/src/share/native/java/util/zip/Deflater.c	Thu Nov 09 22:05:56 2017 +0300
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1996, 2009, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1996, 2017, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -159,13 +159,11 @@
 	switch (res) {
 	case Z_OK:
 	    (*env)->SetBooleanField(env, this, setParamsID, JNI_FALSE);
+	case Z_BUF_ERROR:
 	    this_off += this_len - strm->avail_in;
 	    (*env)->SetIntField(env, this, offID, this_off);
 	    (*env)->SetIntField(env, this, lenID, strm->avail_in);
-	    return len - strm->avail_out;
-	case Z_BUF_ERROR:
-	    (*env)->SetBooleanField(env, this, setParamsID, JNI_FALSE);
-	    return 0;
+	    return (jint) (len - strm->avail_out);
 	default:
 	    JNU_ThrowInternalError(env, strm->msg);
 	    return 0;
@@ -204,12 +202,11 @@
 	    (*env)->SetBooleanField(env, this, finishedID, JNI_TRUE);
 	    /* fall through */
 	case Z_OK:
+	case Z_BUF_ERROR:
 	    this_off += this_len - strm->avail_in;
 	    (*env)->SetIntField(env, this, offID, this_off);
 	    (*env)->SetIntField(env, this, lenID, strm->avail_in);
 	    return len - strm->avail_out;
-	case Z_BUF_ERROR:
-	    return 0;
 	default:
 	    JNU_ThrowInternalError(env, strm->msg);
 	    return 0;
--- a/src/share/native/java/util/zip/zlib/deflate.c	Tue Nov 14 12:28:43 2017 +0530
+++ b/src/share/native/java/util/zip/zlib/deflate.c	Thu Nov 09 22:05:56 2017 +0300
@@ -505,8 +505,6 @@
     s->pending = 0;
     s->pending_out = s->pending_buf;
 
-    s->high_water = 0;      /* reset to its inital value 0 */
-
     if (s->wrap < 0) {
         s->wrap = -s->wrap; /* was made negative by deflate(..., Z_FINISH); */
     }
@@ -520,7 +518,7 @@
         s->wrap == 2 ? crc32(0L, Z_NULL, 0) :
 #endif
         adler32(0L, Z_NULL, 0);
-    s->last_flush = Z_NO_FLUSH;
+    s->last_flush = -2;
 
     _tr_init(s);
 
@@ -613,7 +611,7 @@
     func = configuration_table[s->level].func;
 
     if ((strategy != s->strategy || func != configuration_table[level].func) &&
-        s->high_water) {
+        s->last_flush != -2) {
         /* Flush the last buffer: */
         int err = deflate(strm, Z_BLOCK);
         if (err == Z_STREAM_ERROR)
--- a/src/share/native/java/util/zip/zlib/patches/ChangeLog_java	Tue Nov 14 12:28:43 2017 +0530
+++ b/src/share/native/java/util/zip/zlib/patches/ChangeLog_java	Thu Nov 09 22:05:56 2017 +0300
@@ -92,3 +92,5 @@
       }
       s->status =
   #ifdef GZIP
+
+(7) deflate.c undo (6), replaced withe the official zlib repo fix see#305/#f969409