Article delegate-en <_A3785@delegate-en.ML_>
  upper oldest olders older1 this newer1 newers latest
search
[Top/Up] [oldest] - [Older+chunk] - [Newer+chunk] - [newest + Check]
[delegate-en/3785] [Reference:<_A3783@delegate-en.ML_>]
Newsgroups: mail-lists.delegate-en

[DeleGate-En] Re: Problem with Content-Encoding
28 Jun 2007 04:44:41 GMT "Bieber, Sebastian" <pyuhabdyi.ml@ml.delegate.org>


Hi!

First, let me say "thanks a lot" for your quick answer. Applying the patch to filter.c solved the problem described - now content is compressed before sent to the client.

Unfortunately, with the patch, the browser now displays the content in it's compressed form (as a "dump" of the gzip'ed file)!

Looking at delegate's response header i found this:

	HTTP/1.x 200 OK
	DeleGate-Ver: 9.5.6 (delay=15)
	Server: Zope/(Zope 2.9.6-final, python 2.4.4, linux2) ZServer/1.1
	Date: Thu, 28 Jun 2007 03:48:54 GMT
	Content-Type: text/html; charset=utf-8
	Vary: Accept-Language, Accept-Encoding
	Content-Language: de-de
	Via: 1.1 - (DeleGate/9.5.6)
	Connection: keep-alive, timeout=50, maxreq=58
	Content-Encoding: gzip,deflate
	Content-Length: 742

The "Content-Encoding"-header is set to the list of acceptable encodings received in the http request, it seems. This obviously "confuses" the browser - my up-to-date firefox, at least.

In http.c, in function HTTP_putMIMEmsg, the "Content-Encoding" header is set like this:

	if( zip ){
            sv1log("#CEcl put Content-Encoding:%s\n",cencode);
            fprintf(out,"%s %s\r\n",F_ContEncode,cencode);

            fprintf(out,"%s %s\r\n",F_Vary,"Accept-Encoding");
            }

As a (dumb, but quick) solution, i changed this to:

	if( zip ){
      	/*
            sv1log("#CEcl put Content-Encoding:%s\n",cencode);
            fprintf(out,"%s %s\r\n",F_ContEncode,cencode);
            */
            sv1log("#CEcl put Content-Encoding:%s\n","gzip");
            fprintf(out,"%s %s\r\n",F_ContEncode,"gzip");

            fprintf(out,"%s %s\r\n",F_Vary,"Accept-Encoding");
            }

With this modification, content compression now works perfectly.
Thanks again for your help - and for your gorgeous software!

So long,
Sebastian 

-----Ursprüngliche Nachricht-----
Von: Yutaka Sato [mailto:feedback@delegate.org] 
Gesendet: Mittwoch, 27. Juni 2007 18:50
An: feedback@delegate.org
Cc: Bieber, Sebastian; feedback@delegate.org
Betreff: Re: [DeleGate-En:3784] Problem with Content-Encoding

Hi,

In message <_A3781@delegate-en.ML_> on 06/27/07(20:29:36)
you "Bieber, Sebastian" <pyuhabdyi.ml@ml.delegate.org> wrote:
 |While trying various different combinations of "acc-encoding"- and
 |"gen-encoding"-values, i found that decompressing, if neccessary,
 |gzip'ed content from the Zope server is no problem. But with none of the
 |tested configurations delegate would (re)compress the content. There
 |seems not to be a problem with the content itself or the communication
 |with the client, all pages/images/files are delivered "in perfect
 |health" - but uncompressed... 
 |This behaviour occurs identically with firefox, internet explorer or
 |lynx as client, respectively.

Ooops... It seems that I disabled it in DeleGate/8.6.0 (4 years ago)
in which I fixed it to cope with "Accept-Encoding: x-gzip" ...

! 8.6.0 030514 http.c: fixed to echo Accept-Encoding:x-gzip to Content-Encoding
...
diff -cr delegate8.5.9/src/http.c delegate8.6.0/src/http.c
*** delegate8.5.9/src/http.c	Mon Aug  4 06:59:52 2003
--- delegate8.6.0/src/http.c	Wed Jul 30 10:15:26 2003
***************
*** 1499,1505 ****
--- 1628,1637 ----
  			 || (Conn->xf_filtersCFI & XF_FTOCL) != 0
  			)
  			{
+ 				/*
  				sprintf(buf,"%s %s\r\n",F_AccEncodeX,"gzip");
+ 				*/
+ 				sprintf(buf,"%s %s\r\n",F_AccEncodeX,QX_accEnc);
  				wcc = strlen(buf);
  				fputs(buf,RX_tcp);
  				RX_wrHeadTotal += wcc;

By the modification, it became unabled to cope with a list value in
the filed as "Accept-Encoding: gzip,deflate".
I'll fix it as the enclosed patch to "src/filter.c", in the next
release (9.5.7 or 9.6.3).  Thank you.

Cheers,
Yutaka
--
  9 9   Yutaka Sato <y.sato@delegate.org> http://delegate.org/y.sato/
 ( ~ )  National Institute of Advanced Industrial Science and Technology
_<   >_ 1-1-4 Umezono, Tsukuba, Ibaraki, 305-8568 Japan
Do the more with the less -- B. Fuller


*** ../delegate9.5.6/src/filter.c	Sat Feb 17 19:11:05 2007
--- src/filter.c	Thu Jun 28 01:36:23 2007
***************
*** 511,517 ****
--- 511,520 ----
  	if( !withGzip || gzip == 0 )
  		return 0;
  
+ 	/*
  	if( strcaseeq(enc,"gzip") || strcaseeq(enc,"x-gzip") ){
+ 	*/
+ 	if( isinListX(enc,"gzip","c") || isinListX(enc,"x-gzip","c") ){
  		Start = Time();
  		out = TMPFILE("gzip");
  		if( streq(gzip,"-") ){

  admin search upper oldest olders older1 this newer1 newers latest
[Top/Up] [oldest] - [Older+chunk] - [Newer+chunk] - [newest + Check]
@_@V