Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(310)

Unified Diff: third_party/zlib/mixed-source.patch

Issue 10957038: net: separate SPDY cookies with "; " as the new RFC requires. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: address willchan's comments Created 8 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « third_party/zlib/deflate.c ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/zlib/mixed-source.patch
diff --git a/third_party/zlib/mixed-source.patch b/third_party/zlib/mixed-source.patch
index bd55ef4cc7da99d1ee173a33f141bed08dc46a79..ed54802c097852509b8e3a28b464770f8f25fabc 100644
--- a/third_party/zlib/mixed-source.patch
+++ b/third_party/zlib/mixed-source.patch
@@ -1,5 +1,5 @@
diff --git a/third_party/zlib/deflate.c b/third_party/zlib/deflate.c
-index 5c4022f..02d1516 100644
+index 5c4022f..88b2ec0 100644
--- a/third_party/zlib/deflate.c
+++ b/third_party/zlib/deflate.c
@@ -70,14 +70,15 @@ typedef enum {
@@ -213,7 +213,7 @@ index 5c4022f..02d1516 100644
Assert(scan <= s->window+(unsigned)(s->window_size-1), "wild scan");
-@@ -1204,20 +1293,67 @@ local uInt longest_match(s, cur_match)
+@@ -1204,20 +1293,74 @@ local uInt longest_match(s, cur_match)
}
#endif /* ASMV */
@@ -233,7 +233,7 @@ index 5c4022f..02d1516 100644
+ unsigned i;
+ IPos cookie_location;
+
-+ if (len >= MAX_MATCH)
++ if (len >= MAX_MATCH || len == 0)
+ return 0;
+
+ for (i = 0; i < len; i++)
@@ -253,6 +253,13 @@ index 5c4022f..02d1516 100644
+ return 0;
+ }
+ }
++ /* Check that we aren't matching a prefix of another cookie by ensuring
++ * that the final byte is either a semicolon (which cannot appear in a
++ * cookie value), or non-cookie data. */
++ if (s->window[cookie_location+len-1] != ';' &&
++ class_at(s, cookie_location+len) != 0) {
++ return 0;
++ }
+ s->match_start = cookie_location;
+ return len;
+ }
@@ -282,7 +289,7 @@ index 5c4022f..02d1516 100644
/* The code is optimized for HASH_BITS >= 8 and MAX_MATCH-2 multiple of 16.
* It is easy to get rid of this optimization if necessary.
*/
-@@ -1360,6 +1496,21 @@ local void fill_window(s)
+@@ -1360,6 +1503,21 @@ local void fill_window(s)
*/
} while (--n);
#endif
@@ -304,7 +311,7 @@ index 5c4022f..02d1516 100644
more += wsize;
}
if (s->strm->avail_in == 0) return;
-@@ -1378,6 +1529,9 @@ local void fill_window(s)
+@@ -1378,6 +1536,9 @@ local void fill_window(s)
Assert(more >= 2, "more < 2");
n = read_buf(s->strm, s->window + s->strstart + s->lookahead, more);
@@ -314,7 +321,7 @@ index 5c4022f..02d1516 100644
s->lookahead += n;
/* Initialize the hash value now that we have some input: */
-@@ -1459,9 +1613,10 @@ local void fill_window(s)
+@@ -1459,9 +1620,10 @@ local void fill_window(s)
* NOTE: this function should be optimized to avoid extra copying from
* window to pending_buf.
*/
@@ -326,7 +333,7 @@ index 5c4022f..02d1516 100644
{
/* Stored blocks are limited to 0xffff bytes, pending_buf is limited
* to pending_buf_size, and each stored block has a 5 byte header:
-@@ -1517,13 +1672,19 @@ local block_state deflate_stored(s, flush)
+@@ -1517,13 +1679,19 @@ local block_state deflate_stored(s, flush)
* new strings in the dictionary only for unmatched strings or for short
* matches. It is used only for the fast compression options.
*/
@@ -347,7 +354,7 @@ index 5c4022f..02d1516 100644
for (;;) {
/* Make sure that we always have enough lookahead, except
* at the end of the input file. We need MAX_MATCH bytes
-@@ -1554,7 +1715,7 @@ local block_state deflate_fast(s, flush)
+@@ -1554,7 +1722,7 @@ local block_state deflate_fast(s, flush)
* of window index 0 (in particular we have to avoid a match
* of the string with itself at the start of the input file).
*/
@@ -356,7 +363,7 @@ index 5c4022f..02d1516 100644
/* longest_match() sets match_start */
}
if (s->match_length >= MIN_MATCH) {
-@@ -1613,12 +1774,25 @@ local block_state deflate_fast(s, flush)
+@@ -1613,12 +1781,25 @@ local block_state deflate_fast(s, flush)
* evaluation for matches: a match is finally adopted only if there is
* no better match at the next window position.
*/
@@ -383,7 +390,7 @@ index 5c4022f..02d1516 100644
/* Process the input block. */
for (;;) {
-@@ -1648,13 +1822,18 @@ local block_state deflate_slow(s, flush)
+@@ -1648,13 +1829,18 @@ local block_state deflate_slow(s, flush)
s->prev_length = s->match_length, s->prev_match = s->match_start;
s->match_length = MIN_MATCH-1;
@@ -405,7 +412,7 @@ index 5c4022f..02d1516 100644
/* longest_match() sets match_start */
if (s->match_length <= 5 && (s->strategy == Z_FILTERED
-@@ -1673,7 +1852,22 @@ local block_state deflate_slow(s, flush)
+@@ -1673,7 +1859,20 @@ local block_state deflate_slow(s, flush)
/* If there was a match at the previous step and the current
* match is not better, output the previous match:
*/
@@ -420,24 +427,22 @@ index 5c4022f..02d1516 100644
+ /* We require that a Z_CLASS_COOKIE match be
+ * preceded by either a semicolon (which cannot be
+ * part of a cookie), or non-cookie data. This is
-+ * to prevent
-+ * a cookie from being a prefix of another.
-+ * spdy_framer.cc ensures that cookies are always
-+ * terminated by a semicolon. */
++ * to prevent a cookie from being a suffix of
++ * another. */
+ (class_at(s, s->prev_match-1) == Z_CLASS_STANDARD ||
+ *(s->window + s->prev_match-1) == ';')))) {
uInt max_insert = s->strstart + s->lookahead - MIN_MATCH;
/* Do not insert strings in hash table beyond this. */
diff --git a/third_party/zlib/deflate.h b/third_party/zlib/deflate.h
-index cbf0d1e..83b4602 100644
+index cbf0d1e..2fe6fd6 100644
--- a/third_party/zlib/deflate.h
+++ b/third_party/zlib/deflate.h
@@ -91,6 +91,9 @@ typedef unsigned IPos;
* save space in the various tables. IPos is used only for parameter passing.
*/
-+#define Z_COOKIE_HASH_SIZE 64
++#define Z_COOKIE_HASH_SIZE 256
+#define Z_COOKIE_HASH_MASK (Z_COOKIE_HASH_SIZE-1)
+
typedef struct internal_state {
« no previous file with comments | « third_party/zlib/deflate.c ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698