iCal to Drupal requires Content-Encoding: gzip

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

iCal to Drupal requires Content-Encoding: gzip

Bob Nemec
Hello,
We're trying to provide an iCal feed from Seaside (on VW) to Drupal.  The Drupal use of the feed can be tested using a Google calendar iCal feed, and it works fine.  We're able to produce a simple iCal document as well, but Drupal does not accept it.  Both the Google and our Seaside iCal feeds download fine with just the browser.

The one big difference we can see in the header is that the Google contains 'Content-Encoding: gzip' and ours does not.  I have not be able to determine how we can properly provide the gzip compressed version of the content.  

Has anyone done an iCal feed from Seaside to Drupal?  Or, how can I get the gzip properly to be properly supported in my data source? 

Thanks for any help,
Bob Nemec
Cherniak Software

----
Here are some details... 
Documentation on iCal in Drupal ... 

I'm packaging the response with... (aFilename=events.ics, aContent is a read stream on the string)

WAResponse new
contentType: 'text/calendar;charset=utf-8';
doNotCache;
headerAt: 'Content-Disposition' put: 'attachment; filename="' , aFileName , '"';
headerAt: 'Content-length' put: aContents size printString;
contents: aContents;
yourself

It looks like SeasideHttpWriteHandler>>prepareStream:forMessageBody: will do the compression with GZipWriteStream if useGZipTransfer = true, but I can't find a way to propagate that setting, and so far none of my attempts at hacking it are working.  I had hoped something as simple as adding #headerAt: 'Content-Encoding' put: 'gzip' would work, but that just creates an invalid file. 

To see the header contents, we use the Live HTTP headers Firefox plug in. 

This is the Google header... 

http://www.google.com/calendar/ical/<our test calendar ics file>

GET /calendar/ical/<our test calendar ics file> HTTP/1.1
User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9.1.3) Gecko/20090824 Firefox/3.5.3 (.NET CLR 3.5.30729)
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
Accept-Language: en-us,en;q=0.5
Accept-Encoding: gzip,deflate
Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.7
Keep-Alive: 300
Connection: keep-alive
Cookie: <some cookie data>

HTTP/1.x 200 OK
Content-Type: text/calendar; charset=UTF-8
Cache-Control: no-cache, no-store, max-age=0, must-revalidate
Pragma: no-cache
Expires: Fri, 01 Jan 1990 00:00:00 GMT
Date: Mon, 21 Sep 2009 00:14:03 GMT
Content-Encoding: gzip
X-Content-Type-Options: nosniff
X-Frame-Options: SAMEORIGIN
Content-Length: 3421
Server: GFE/2.0
----------------------------------------------------------

And this is our Seaside header... 


GET /seaside/Test HTTP/1.1
Host: localhost:48199
User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9.1.3) Gecko/20090824 Firefox/3.5.3 (.NET CLR 3.5.30729)
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
Accept-Language: en-us,en;q=0.5
Accept-Encoding: gzip,deflate
Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.7
Keep-Alive: 300
Connection: keep-alive
Cookie: <some cookie data>

HTTP/1.x 200 OK
Expires: Wed, 11 Jun 1980 08:00:00 -0400
Cache-Control: no-cache,must-revalidate
Pragma: no-cache
Content-Disposition: attachment;filename=events.ics
Content-Type: text/calendar;charset=utf-8
Content-Length: 10944
----------------------------------------------------------




WAKomCompressed>>convertResponse: aResponse 
        | response gzip stream | 
        response := super convertResponse: aResponse. 
        response fieldAt: 'Content-Encoding' put: 'gzip'. 
        gzip := GZipWriteStream on: (stream := RWBinaryOrTextStream on: ''). 
        gzip nextPutAll: aResponse contents contents; close. 
        ^ response contents: stream reset 


_______________________________________________
seaside mailing list
[hidden email]
http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside
Bob Nemec