[Mod_gzip] Re: Antwort: a patch for fixing lower case headers(content-encodi ng, transfer- encoding)

Jin Zhao mod_gzip@lists.over.net
Mon, 28 Apr 2003 15:50:06 -0500


This message is in MIME format. Since your mail reader does not understand
this format, some or all of this message may not be legible.

------_=_NextPart_001_01C30DC7.8951D380
Content-Type: text/plain;
	charset="iso-8859-1"

Hi Michael,

I am glad to see your response and feel it a pleasure that my 
suggestion might be useful in improving mod_gzip.

I agree that comparing headers directly using mod_gzip_strnicmp should 
be fine, without adding another layer of conditional check.

The current code:
######################################################
else if ( lbuf[0] == 'C' || lbuf[0] == 'c' )
                  {
                   if ( 
mod_gzip_strnicmp(lbuf,"Content-Encoding:",17)==0)
		{
                      #ifdef MOD_GZIP_DEBUG1
                      mod_gzip_printf( "%s: HEADER: %5.5d: * 
'Content-Encoding:' seen",
                                        cn,linecount);
                      #endif

                      ce_seen = 1;
                     }
######################################################

Remove the first layer of conditional check:
######################################################
else if ( mod_gzip_strnicmp(lbuf,"Content-Encoding:",17)==0)
		{
                      #ifdef MOD_GZIP_DEBUG1
                      mod_gzip_printf( "%s: HEADER: %5.5d: * 
'Content-Encoding:' seen",
                                        cn,linecount);
                      #endif

                      ce_seen = 1;
                     }
######################################################

Again I am not  a real C programmer also and have not even read closely 
through all of the mod_gzip code. Take this email as a joke if the 
above fix looks silly.

> Thus I would suggest adding this patch (or maybe some variant
> of it - I am not the C programmer; maybe the mod_gzip_strnicmp
> function itself should rather be used there?) to the next
> version, whenever this one will be released.
> Right now, all I can do is accept it and document it. But I
> hope you will not have to maintain any separate source tree.
>
> Thank you for finding, fixing and posting this bug!
>
> Regards, Michael

Thank you for developing and maintaining mod_gzip for the community.

Jin

------_=_NextPart_001_01C30DC7.8951D380
Content-Type: text/html;
	charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2//EN">
<HTML>
<HEAD>
<META HTTP-EQUIV=3D"Content-Type" CONTENT=3D"text/html; =
charset=3Diso-8859-1">
<META NAME=3D"Generator" CONTENT=3D"MS Exchange Server version =
5.5.2653.12">
<TITLE>Re: Antwort: a patch for fixing lower case =
headers(content-encoding, transfer-	encoding)</TITLE>
</HEAD>
<BODY>

<P><FONT SIZE=3D2>Hi Michael,</FONT>
</P>

<P><FONT SIZE=3D2>I am glad to see your response and feel it a pleasure =
that my </FONT>
<BR><FONT SIZE=3D2>suggestion might be useful in improving =
mod_gzip.</FONT>
</P>

<P><FONT SIZE=3D2>I agree that comparing headers directly using =
mod_gzip_strnicmp should </FONT>
<BR><FONT SIZE=3D2>be fine, without adding another layer of conditional =
check.</FONT>
</P>

<P><FONT SIZE=3D2>The current code:</FONT>
<BR><FONT =
SIZE=3D2>######################################################</FONT>
<BR><FONT SIZE=3D2>else if ( lbuf[0] =3D=3D 'C' || lbuf[0] =3D=3D 'c' =
)</FONT>
<BR><FONT =
SIZE=3D2>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nb=
sp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; {</FONT>
<BR><FONT =
SIZE=3D2>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nb=
sp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; if ( </FONT>
<BR><FONT =
SIZE=3D2>mod_gzip_strnicmp(lbuf,&quot;Content-Encoding:&quot;,17)=3D=3D0=
)</FONT>
<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; =
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <FONT SIZE=3D2>{</FONT>
<BR><FONT =
SIZE=3D2>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nb=
sp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&n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D2>######################################################</FONT>
</P>

<P><FONT SIZE=3D2>Remove the first layer of conditional check:</FONT>
<BR><FONT =
SIZE=3D2>######################################################</FONT>
<BR><FONT SIZE=3D2>else if ( =
mod_gzip_strnicmp(lbuf,&quot;Content-Encoding:&quot;,17)=3D=3D0)</FONT>
<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; =
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <FONT SIZE=3D2>{</FONT>
<BR><FONT =
SIZE=3D2>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nb=
sp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; #ifdef =
MOD_GZIP_DEBUG1</FONT>
<BR><FONT =
SIZE=3D2>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nb=
sp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; =
mod_gzip_printf( &quot;%s: HEADER: %5.5d: * </FONT>
<BR><FONT SIZE=3D2>'Content-Encoding:' seen&quot;,</FONT>
<BR><FONT =
SIZE=3D2>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nb=
sp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nb=
sp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nb=
sp;&nbsp;&nbsp;&nbsp;&nbsp; cn,linecount);</FONT>
<BR><FONT =
SIZE=3D2>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nb=
sp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; =
#endif</FONT>
</P>

<P><FONT =
SIZE=3D2>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nb=
sp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ce_seen =
=3D 1;</FONT>
<BR><FONT =
SIZE=3D2>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nb=
sp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }</FONT>
<BR><FONT =
SIZE=3D2>######################################################</FONT>
</P>

<P><FONT SIZE=3D2>Again I am not&nbsp; a real C programmer also and =
have not even read closely </FONT>
<BR><FONT SIZE=3D2>through all of the mod_gzip code. Take this email as =
a joke if the </FONT>
<BR><FONT SIZE=3D2>above fix looks silly.</FONT>
</P>

<P><FONT SIZE=3D2>&gt; Thus I would suggest adding this patch (or maybe =
some variant</FONT>
<BR><FONT SIZE=3D2>&gt; of it - I am not the C programmer; maybe the =
mod_gzip_strnicmp</FONT>
<BR><FONT SIZE=3D2>&gt; function itself should rather be used there?) =
to the next</FONT>
<BR><FONT SIZE=3D2>&gt; version, whenever this one will be =
released.</FONT>
<BR><FONT SIZE=3D2>&gt; Right now, all I can do is accept it and =
document it. But I</FONT>
<BR><FONT SIZE=3D2>&gt; hope you will not have to maintain any separate =
source tree.</FONT>
<BR><FONT SIZE=3D2>&gt;</FONT>
<BR><FONT SIZE=3D2>&gt; Thank you for finding, fixing and posting this =
bug!</FONT>
<BR><FONT SIZE=3D2>&gt;</FONT>
<BR><FONT SIZE=3D2>&gt; Regards, Michael</FONT>
</P>

<P><FONT SIZE=3D2>Thank you for developing and maintaining mod_gzip for =
the community.</FONT>
</P>

<P><FONT SIZE=3D2>Jin</FONT>
</P>

</BODY>
</HTML>
------_=_NextPart_001_01C30DC7.8951D380--