From d4b5040fa14a01708d298c938a66c1fecfb15787 Mon Sep 17 00:00:00 2001 From: "ebina%netscape.com" Date: Mon, 31 Aug 1998 16:31:12 +0000 Subject: [PATCH] Transfer encoded gzip streams were sent to this converter, but the transfer-encoding was never removed from the URL structure, causing infinite recursion. This fixes that bug. --- network/cnvts/cvunzip.c | 21 ++++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-) diff --git a/network/cnvts/cvunzip.c b/network/cnvts/cvunzip.c index d152467d361..4659a50ab1b 100644 --- a/network/cnvts/cvunzip.c +++ b/network/cnvts/cvunzip.c @@ -19,6 +19,7 @@ /* Please leave outside of ifdef for windows precompiled headers */ #include "xp.h" #include "prmem.h" +#include "plstr.h" #include "netutils.h" #include "mkselect.h" #include "mktcp.h" @@ -486,7 +487,25 @@ NET_UnZipConverter (int format_out, } /* create the next stream, but strip the compressed encoding */ - PR_FREEIF(URL_s->content_encoding); + /* + * We might have been sent here from either a transfer-encoding: gzip + * or a content-encoding: gzip stream. There is no way to know for + * sure at this point. Based on knowing what NET_StreamBuilder does + * I know transfer-encoding is processed before content-encoding + * and that the only encoding currently sent here are + * ENCODING_GZIP and ENCODING_GZIP2. If this changes in the + * future it could cause an infinite recursion bug here. + */ + if ((URL_s->transfer_encoding != NULL)&& + ((!PL_strcasecmp(URL_s->transfer_encoding, ENCODING_GZIP))|| + (!PL_strcasecmp(URL_s->transfer_encoding, ENCODING_GZIP2)))) + { + PR_FREEIF(URL_s->transfer_encoding); + } + else + { + PR_FREEIF(URL_s->content_encoding); + } obj->next_stream = NET_StreamBuilder(format_out, URL_s, window_id); if(!obj->next_stream)