Topic: 304 Error handling
Cozi has developed a calendar Widget for www.cozi.com.
When we poll for new appointments, we pass a 'version' number in the query string to indicate the version of the appointments we have on the client. The server compares this with the version of the calendar data that exists on the server. If there are no changes/additions/deletions to the calendar data, Cozi returns a 304 error. This is to reduce the load on our services. Unfortunately, Chumby is trying to help us here. I think they get the 304 but that the query string does not exist in their cache, so they strip the headers and try to load the appointments since Chumby feels it was not in the cache. And Chumby is like a pit bull dog locked on this. It will not give up and return the 304 back the client. On subsequent attempts, we return 304s as well and don't pass a Content-Length field in the header because it is a 304. Chumby really wants a Content-Length. Looking at the logs I get a steady stream of errors. Below is a snippet from the log. I've removed some auth cookie data, but you should get the general idea. On the first call to the services, the 'version' parameter is 0. On subsequent ones it is > 0.
Sadly, I think Chumby is technically correct that it is not the same query string. However, Chumby should not be handling the caching in this manner. Besides the fact that this eventually crashes the Chumby as it consinuously retries to get the data, the XML class never issues an onLoad, onHTTPStatus, or onData. I believe the correct action by Chumby should be to get the 304 and pass it back to the application. We handle the caching in the app when we get the 304. Versions of this widget run across a wide variety of OSs and it runs in the desktop version of the Flash control.
Any assistance would be greatly appreciated.
Log file:
2009-05-15 08:45:12 NetStreamRequest::Open(5): Opening protocol 'http://' host 'cozicentral.cozi.com' port 80 location '/rest/api/calendar/interval/default.ashx?output=appointments,household,notes,abbreviations,location&startDate=2009-05-14T15:45:12Z&endDate=2009-05-22T15:45:12Z&tzOffset=420&account=d705e7f7-c1af-4e60-8e5c-a6c82d08dfd4&auth=<<<<removed>>>>&version=3142&apiKey=vistagadget'
2009-05-15 08:45:12 NetStreamRequest::Open(5) opened http object id 13
2009-05-15 08:45:12 HTTPCacheHeaderParse::Parse1123Date(-1) has invalid asctime() format
2009-05-15 08:45:12 HTTPCurlObject::Pump() ERROR! BROKEN SERVER sent header with no Content-Length. RFC2616 violation! (8 headers)
2009-05-15 08:45:12 HTTPCurlObject::Cancel(id=13) removing handle 0027d3d8 from multihandle
2009-05-15 08:45:12 HTTPCurlObject::Cancel() id=13 cancel forces expiration of cache entry 12!
2009-05-15 08:45:13 HTTPCurlObject::Pump() ERROR! BROKEN SERVER sent header with no Content-Length. RFC2616 violation! (16 headers)
2009-05-15 08:45:13 HTTPCurlObject::Cancel(id=13) removing handle 0027d3d8 from multihandle
2009-05-15 08:45:13 HTTPCurlObject::Pump() ERROR! BROKEN SERVER sent header with no Content-Length. RFC2616 violation! (24 headers)
2009-05-15 08:45:13 HTTPCurlObject::Cancel(id=13) removing handle 0027d3d8 from multihandle