<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Pheromone Lab &#187; firefox</title>
	<atom:link href="http://lab.pheromone.ca/tag/firefox/feed/" rel="self" type="application/rss+xml" />
	<link>http://lab.pheromone.ca</link>
	<description>Inspiration, Experimentation, Innovation</description>
	<lastBuildDate>Mon, 30 Jan 2012 23:56:51 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0.1</generator>
		<item>
		<title>Issues with bad implementations of &#8220;Accept&#8221; HTTP header</title>
		<link>http://lab.pheromone.ca/2009/11/16/http-accept-header-implementatio/</link>
		<comments>http://lab.pheromone.ca/2009/11/16/http-accept-header-implementatio/#comments</comments>
		<pubDate>Mon, 16 Nov 2009 21:37:55 +0000</pubDate>
		<dc:creator>karl</dc:creator>
				<category><![CDATA[Tech]]></category>
		<category><![CDATA[code]]></category>
		<category><![CDATA[firefox]]></category>
		<category><![CDATA[http]]></category>
		<category><![CDATA[implementation]]></category>
		<category><![CDATA[security]]></category>
		<category><![CDATA[server]]></category>

		<guid isPermaLink="false">http://lab.pheromone.ca/?p=182</guid>
		<description><![CDATA[<p>The DDOS which was not a DDOS. We had an issue recently between the Web sites of <a href="http://www.rds.ca/" title="RDS.ca">RDS</a> and <a href="http://legrandclub.rds.ca/" title="LE GRAND CLUB - Accueil">Le Grand Club</a>. Le Grand Club has been literally killed by the trafic coming from RDS, which is around 1 million hits a day. When checking the Grand Club HTTP logs of Le Grand Club, we noticed that all referers were coming from the home page of RDS, but coming from many different&#8230; <a href="http://lab.pheromone.ca/2009/11/16/http-accept-header-implementatio/" class="read_more">...</a></p>]]></description>
			<content:encoded><![CDATA[<p>The DDOS which was not a DDOS. We had an issue recently between the Web sites of <a href="http://www.rds.ca/" title="RDS.ca">RDS</a> and <a href="http://legrandclub.rds.ca/" title="LE GRAND CLUB - Accueil">Le Grand Club</a>. Le Grand Club has been literally killed by the trafic coming from RDS, which is around 1 million hits a day. When checking the Grand Club HTTP logs of Le Grand Club, we noticed that all referers were coming from the home page of RDS, but coming from many different IP addresses and User Agents. What was happening? A security issue? An implementation issue on Le Grand Club in Rails?</p>
<p>No. Just a human error in the markup and bad HTTP browsers implementations.</p>
<p>An <code>IMG</code> element on the home page was calling a dynamic html file of Le Grand Club. With each request on the home page of RDS, a request was made on Le Grand Club.</p>
<p>How to avoid that this happens again in the future?</p>
<h2 id="accept">Accept header in HTTP 1.1</h2>
<p>When typing a URL in a browser address bar or following a link in a Web page, the client (browsers such as Firefox, Opera, Safari for example) sends  information to the server. It&#8217;s a &#8220;business card&#8221; giving enough details for knowing how the server should handle the client. This is a common pattern of social relationship before entering into a dialog.</p>
<p>The Accept header as defined in the HTTP specification.</p>
<blockquote><p>14.1 Accept</p>
<p>The Accept request-header field can be used to specify certain media types which are acceptable for the response. Accept headers can be used to indicate that the request is specifically limited to a small set of desired types, as in the case of a request for an in-line image.</p>
<pre style="font-family: Courier, fixed;">
       Accept         = &quot;Accept&quot; &quot;:&quot;
                        #( media-range [ accept-params ] )
       media-range    = ( &quot;*/*&quot;
                        | ( type &quot;/&quot; &quot;*&quot; )
                        | ( type &quot;/&quot; subtype )
                        ) *( &quot;;&quot; parameter )
       accept-params  = &quot;;&quot; &quot;q&quot; &quot;=&quot; qvalue *( accept-extension )
       accept-extension = &quot;;&quot; token [ &quot;=&quot; ( token | quoted-string ) ]</pre>
<p>The asterisk &quot;*&quot; character is used to group media types into ranges, with &quot;*/*&quot; indicating all media types and &quot;type/*&quot; indicating all subtypes of that type. The media-range MAY include media type parameters that are applicable to that range.</p>
<p>via<a href='http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html'>HTTP/1.1: Header Field Definitions</a>.</p>
</blockquote>
<h2 id="practice">Accept header in practice</h2>
<p>Let&#8217;s try to visit the <a href="http://w3.org/">W3C Web site</a>. The following is what Firefox is sending to the Apache server of W3C.</p>
<pre style="font-family: Courier, fixed;">Host:              www.w3.org
User-Agent:        Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10.5; fr; rv:1.9.1.5) Gecko/20091102 Firefox/3.5.5
<strong>Accept:            text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8</strong>
Accept-Language:   fr,fr-fr;q=0.8,en-us;q=0.5,en;q=0.3
Accept-Encoding:   gzip,deflate
Accept-Charset:    ISO-8859-1,utf-8;q=0.7,*;q=0.7
Keep-Alive:        300
Connection:        keep-alive
If-Modified-Since: Sun, 15 Nov 2009 13:42:32 GMT
If-None-Match:     "703c-478691095e200;89-3f26bd17a2f00"
Cache-Control:     max-age=0</pre>
<p>The <code>Accept</code> header informs the server that the client will be able to process document of a certain nature. In this case, Firefox is saying: &#8220;I accept document which are html (text/html) or xhtml (application/xhtml+xml) or xml (application/xml) or if everything else fails, try to send me something in another format.&#8221;</p>
<p>If the server has what is needed, it will send the requested document for this specific URL in the right format (here html). So far no magic. Everything is perfect. Simple!</p>
<p>We receive the document which contains calls to other resources on the Web, such as stylesheet, scripts, and <strong>images</strong>. The html document will contain <code>IMG</code> element and get from the <code>src</code> attribute, the url to <code>GET</code>. Firefox sends again an accept header for this image.</p>
<pre style="font-family: Courier, fixed;">Accept: image/png,image/*;q=0.8,*/*;q=0.5</pre>
<p>It clearly says that Firefox is accepting images, PNG format in priority, then other type of images if no PNG available, and finally anything. The server receiving this request can send back an image in PNG, or GIF, or JPEG.</p>
<h2 id="solution-rails">Solution Rails</h2>
<p>We know that for specific URLs, we have specific type of contents. So when Firefox is sending an accept image for a URL which is in fact HTML. We can easily decide that the server should reply &#8220;<code>406 Not Acceptable</code>&#8220;, the proper way in HTTP to say that you can&#8217;t provide the right format to the client. The next morning, I seat with Benoit Goyette and discussed about handling in Rails this HTTP corner case. Better be ready for the next time. In a few times, Benoit finished a prototype code, perfectly working in a test environment.</p>
<pre style="font-family: Courier, fixed;">
before_filter :accept_headers
  def accept_headers
  if request.env['HTTP_ACCEPT'] =~ /^image.*$/ &amp;&amp; !(request.env['REQUEST_PATH'] =~ /^.*[jpg|jpeg|gif|png]$/)
    render :nothing => true, :status => 406
  end
end
</pre>
<p>Hourra? Not exactly… It was without counting the bad implementation landscape of browsers. What about Opera?</p>
<pre style="font-family: Courier, fixed;">text/html, application/xml;q=0.9, application/xhtml+xml, application/x-obml2d, image/png, image/jpeg, image/gif, image/x-xbitmap, */*;q=0.1</pre>
<p>and Webkit? like Internet Explorer… worse.</p>
<pre style="font-family: Courier, fixed;">*/*</pre>
<p>Accept header is then not the solution for blocking this case of bad markup. We are still exploring an elegant and flexible solution.</p>
]]></content:encoded>
			<wfw:commentRss>http://lab.pheromone.ca/2009/11/16/http-accept-header-implementatio/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Une éclaircie à l&#8217;horizon des navigateurs</title>
		<link>http://lab.pheromone.ca/2009/07/03/futur-navigateurs/</link>
		<comments>http://lab.pheromone.ca/2009/07/03/futur-navigateurs/#comments</comments>
		<pubDate>Fri, 03 Jul 2009 13:12:42 +0000</pubDate>
		<dc:creator>karl</dc:creator>
				<category><![CDATA[Affaires]]></category>
		<category><![CDATA[Tech]]></category>
		<category><![CDATA[firefox]]></category>
		<category><![CDATA[html5]]></category>
		<category><![CDATA[ie]]></category>
		<category><![CDATA[navigateur]]></category>
		<category><![CDATA[opera]]></category>
		<category><![CDATA[safari]]></category>

		<guid isPermaLink="false">http://www.vdl2.ca/lelab/?p=26</guid>
		<description><![CDATA[IE6 en perte de vitesse, de nouveaux navigateurs plus interopérables, enfin la possibilité de réaliser des développements Web concrets.]]></description>
			<content:encoded><![CDATA[<p>Finalement les <a href="http://weblogs.mozillazine.org/asa/archives/2009/07/internet_explorer_6.html">statistiques</a> montrent que IE6 est en déclin. Tous développeurs Web vous le dira, ce navigateur est aujourd&#8217;hui une épine dans le pied de la créativité. Il maintient toute la communauté Web, et donc les possibilités d&#8217;utiliser le Web intelligemment, en arrière. Cela limite également la capacité des entreprises à <a href="http://www.openweb.eu.org/">réaliser des affaires</a>. IE8 est un progrès notable, mais pas encore suffisant.</p>
<p>Si Microsoft continue à publier souvent de nouvelles versions de son navigateur, il sera possible de tous évoluer de façon douce vers un <a href="http://www.w3.org/html/">Web moderne</a>. Aujourd&#8217;hui pour bénéficier de tout l&#8217;arsenal des technologies, vous pouvez utiliser un navigateur tel que <a href="http://www.getfirefox.com/">Firefox</a>, <a href="http://www.opera.com/browser/">Opera</a> ou <a href="http://www.apple.com/safari/">Safari</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://lab.pheromone.ca/2009/07/03/futur-navigateurs/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

