{"id":3049,"date":"2010-12-16T20:10:18","date_gmt":"2010-12-17T01:10:18","guid":{"rendered":"http:\/\/nuxx.net\/blog\/?p=3049"},"modified":"2010-12-17T08:47:39","modified_gmt":"2010-12-17T13:47:39","slug":"google-talk-doesnt-like-applicationx-javascript-config-for-pac-files","status":"publish","type":"post","link":"https:\/\/nuxx.net\/blog\/2010\/12\/16\/google-talk-doesnt-like-applicationx-javascript-config-for-pac-files\/","title":{"rendered":"Google Talk Doesn&#8217;t Like application\/x-javascript-config for PAC Files"},"content":{"rendered":"<p><img decoding=\"async\" src=\"https:\/\/nuxx.net\/blog\/wp-content\/uploads\/2026\/06\/google_talk_pac_file_download_weirdness.png\" height=480 width=640 border=0 title=\"Google Talk sending a FIN,ACK in the middle of downloading a PAC file.\"><\/p>\n<p>After a bunch of frustration I found an interesting quirk in how <a href=\"http:\/\/www.google.com\/talk\">Google Talk<\/a> uses <a href=\"http:\/\/en.wikipedia.org\/wiki\/Proxy_auto-config\">Proxy Autoconfiguration (PAC) files<\/a> (<a href=\"http:\/\/docs.sun.com\/app\/docs\/doc\/820-1652\/adyrk?l=en&#038;a=view\">Additional Documentation<\/a>). There are two <a href=\"http:\/\/en.wikipedia.org\/wiki\/MIME\">MIME<\/a> types which can be set for PAC files when serving them, <tt>application\/x-javascript-config<\/tt> and <tt>application\/x-ns-proxy-autoconfig<\/tt>, and both work with most browsers, but only the latter works properly with Google Talk.<\/p>\n<p>It turns out that if the MIME type is <tt>application\/x-javascript-config<\/tt> for the PAC file and the browser does not look directly to the PAC file itself, Google Talk will fail to connect. Looking deeper at it in a network capture (partially pictured above) I&#8217;d see the client closing the connection before it was done downloading the PAC file and thus the client would never receive a complete PAC file. Inspecting the TCP stream via Wireshark would show the data simply ending part-way through the PAC file. This resulted in a mysterious failure to connect with no useful error returned from Google Talk. If I simply changed the MIME type back to <tt>application\/x-ns-proxy-autoconfig<\/tt> for <tt>.pac<\/tt> files and restarted Apache, Google Talk would then download the whole PAC file and login fine.<\/p>\n<p>In both of these cases I am serving a typical PAC file off of Apache using <tt><a href=\"http:\/\/httpd.apache.org\/docs\/current\/mod\/mod_rewrite.html#rewriterule\">RewriteRule<\/a> ^\/$ \/internet.pac [R]<\/tt> to ensure that all requests to <tt>http:\/\/server.local\/<\/tt> go to <tt>http:\/\/server.local\/internet.pac<\/tt> via an <a href=\"http:\/\/en.wikipedia.org\/wiki\/HTTP_302\">HTTP 302<\/a>. Using a <a href=\"http:\/\/httpd.apache.org\/docs\/current\/mod\/mod_dir.html#directoryindex\"><tt>DirectoryIndex<\/tt><\/a> directive specifying <tt>internet.pac<\/tt> as the index file for the site also resulted in the same issue. In both cases the client was configured to look to <tt>http:\/\/server.local\/<\/tt> for a PAC file.<\/p>\n<p>Complicating things further I found that if instead of relying on a <tt>RewriteRule<\/tt> or <tt>DirectoryIndex<\/tt> I instead pointed the config directly to the PAC file itself (in this case <tt>http:\/\/server.local\/internet.pac<\/tt>) then the problem would not occur; Google Talk would download the entire PAC file (confirmed in a network capture) and sign in successfully regardless of MIME type.<\/p>\n<p>For purposes of this testing I used the latest released version of Google Talk, 1.0.0.104, running on Windows 7. Google Talk was also set to <em>Detect proxy automatically<\/em> which reads the system&#8217;s proxy settings. In this case it is the PAC file setting is defined in either Internet Explorer or Control Panel under (<em>Internet Options<\/em> \u2192 <em>Connections<\/em> \u2192 <em>LAN Settings<\/em> \u2192 <em>Use automatic configuration script<\/em>).<\/p>\n","protected":false},"excerpt":{"rendered":"<p>After a bunch of frustration I found an interesting quirk in how Google Talk uses Proxy Autoconfiguration (PAC) files (Additional Documentation). There are two MIME types which can be set for PAC files when serving them, application\/x-javascript-config and application\/x-ns-proxy-autoconfig, and both work with most browsers, but only the latter works properly with Google Talk. It\u2026<\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[13],"tags":[],"class_list":["post-3049","post","type-post","status-publish","format-standard","hentry","category-computers"],"_links":{"self":[{"href":"https:\/\/nuxx.net\/blog\/wp-json\/wp\/v2\/posts\/3049","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/nuxx.net\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/nuxx.net\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/nuxx.net\/blog\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/nuxx.net\/blog\/wp-json\/wp\/v2\/comments?post=3049"}],"version-history":[{"count":12,"href":"https:\/\/nuxx.net\/blog\/wp-json\/wp\/v2\/posts\/3049\/revisions"}],"predecessor-version":[{"id":3062,"href":"https:\/\/nuxx.net\/blog\/wp-json\/wp\/v2\/posts\/3049\/revisions\/3062"}],"wp:attachment":[{"href":"https:\/\/nuxx.net\/blog\/wp-json\/wp\/v2\/media?parent=3049"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/nuxx.net\/blog\/wp-json\/wp\/v2\/categories?post=3049"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/nuxx.net\/blog\/wp-json\/wp\/v2\/tags?post=3049"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}