{"id":1720,"date":"2006-07-02T09:39:38","date_gmt":"2006-07-02T12:39:38","guid":{"rendered":"http:\/\/brockerhoff.net\/bb\/viewtopic.php?p=1815"},"modified":"2010-05-08T19:48:34","modified_gmt":"2010-05-08T22:48:34","slug":"version-checking","status":"publish","type":"post","link":"https:\/\/brockerhoff.net\/blog\/2006\/07\/02\/version-checking\/","title":{"rendered":"Version checking"},"content":{"rendered":"<p>I&#8217;ve finally solved a vexing problem that has been affecting version checks for my software.<\/p>\n<p>Basically, checking for updates inside of <a href=\"\/xray\">XRay<\/a> and <a href=\"\/zingg\">Zingg!<\/a> asks my webserver for a .plist file which contains the latest versions of everything, along with a brief message. On the server, however, this is actually a PHP script which also stores the user&#8217;s system version &#8211; which is appended to the URL &#8211; into a small database.<\/p>\n<p>Since I changed over to <a href=\"http:\/\/www.dreamhost.com\/rewards.cgi?rbrockerhoff\">DreamHost<\/a>, my server has been set to gzip everything it sends if the receiver is capable of decoding gzipped  files. However, for some time &#8211; not sure when that changed &#8211; this has messed up my version checking, and users would get a &#8220;website was unreachable&#8221; error. I did get some reports about this every couple of months, but always had attributed it to a network glitch somewhere&#8230; until I tried it myself and got consistent errors.<\/p>\n<p>I read the .plist file directly using +[NSDictionary dictionaryWithContentsOfURL:]. Some combination of Cocoa, php and server parameters now causes the result to be gzipped, and NSDictionary doesn&#8217;t understand that format. Anyway, once I figured it out, I had to find a way to turn gzipping off for this particular file only, as I can&#8217;t change all the old software versions that are out there.<\/p>\n<p>So, for now, adding this statement at the front of the php part of the file solved it:<\/p>\n<pre><code>header('Content-Encoding: UTF-8');<\/code><\/pre>\n<p>Strangely enough, <a href=\"http:\/\/www.w3.org\/Protocols\/rfc2616\/rfc2616-sec3.html#sec3.5\">rfc2616<\/a> says:<\/p>\n<blockquote><p>The Internet Assigned Numbers Authority (IANA) acts as a registry for content-coding value tokens. Initially, the registry contains the following tokens:<\/p>\n<p>gzip&#8230;<\/p>\n<p>compress&#8230;<\/p>\n<p>deflate&#8230;<\/p>\n<p>identity The default (identity) encoding; the use of no transformation whatsoever. This content-coding is used only in the Accept- Encoding header, and SHOULD NOT be used in the Content-Encoding header.<\/p><\/blockquote>\n<p>&#8230;and that&#8217;s it. No &#8220;UTF-8&#8221; is mentioned, so why is it working now? I tried &#8220;identity&#8221; (before seeing the SHOULD NOT comment) and it had no effect at all. I suppose I should try to debug this on my local server adn see where the problem lies, but time is short&#8230;<\/p>\n<p>I don&#8217;t plan to use this method in XRay II, so it&#8217;s not urgent. I&#8217;ll probably use <a href=\"http:\/\/www.andymatuschak.org\/\">Andy Matuschak<\/a>&#8216;s <a href=\"http:\/\/www.andymatuschak.org\/pages\/sparkle\">Sparkle<\/a>, of which I&#8217;ve had good references.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>I&#8217;ve finally solved a vexing problem that has been affecting version checks for my software. Basically, checking for updates inside of XRay and Zingg! asks my webserver for a .plist file which contains the latest versions of everything, along with a brief message. On the server, however, this is actually a PHP script which also [&hellip;]<\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"jetpack_post_was_ever_published":false,"_jetpack_newsletter_access":"","_jetpack_dont_email_post_to_subs":false,"_jetpack_newsletter_tier_id":0,"_jetpack_memberships_contains_paywalled_content":false,"_jetpack_memberships_contains_paid_content":false,"footnotes":""},"categories":[4,19],"tags":[29,30],"class_list":["post-1720","post","type-post","status-publish","format-standard","hentry","category-dev","category-software","tag-xray","tag-zingg"],"featured_image_src":null,"author_info":{"display_name":"Rainer Brockerhoff","author_link":"https:\/\/brockerhoff.net\/blog\/author\/rbrockerhoff\/"},"jetpack_featured_media_url":"","jetpack_shortlink":"https:\/\/wp.me\/p1q3Zc-rK","jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/brockerhoff.net\/blog\/wp-json\/wp\/v2\/posts\/1720","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/brockerhoff.net\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/brockerhoff.net\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/brockerhoff.net\/blog\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/brockerhoff.net\/blog\/wp-json\/wp\/v2\/comments?post=1720"}],"version-history":[{"count":0,"href":"https:\/\/brockerhoff.net\/blog\/wp-json\/wp\/v2\/posts\/1720\/revisions"}],"wp:attachment":[{"href":"https:\/\/brockerhoff.net\/blog\/wp-json\/wp\/v2\/media?parent=1720"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/brockerhoff.net\/blog\/wp-json\/wp\/v2\/categories?post=1720"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/brockerhoff.net\/blog\/wp-json\/wp\/v2\/tags?post=1720"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}