<?xml version="1.0" encoding="UTF-8"?>
<commit>
  <added type="array"/>
  <modified type="array">
    <modified>
      <diff>@@ -10,7 +10,8 @@ class BotFilter::LinkTitle &lt; BotFilter::Template
     title = data[:name]
     unless title
       begin
-        open(data[:url]) do |f|
+        open(data[:url], { 'User-Agent' =&gt; 'Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 5.1)',
+                           'Referer' =&gt; data[:url].sub(%r{^([a-z]+:/+[^/]+)/.*$}, '\1/') }) do |f|
           title = f.read.match(/&lt;title&gt;(.*?)&lt;\/title&gt;/mi)[1].strip.gsub(/\s+/, ' ')
         end
       rescue</diff>
      <filename>lib/filters/link_title.rb</filename>
    </modified>
    <modified>
      <diff>@@ -44,10 +44,21 @@ describe BotFilter::LinkTitle do
   end
   
   it 'should use open to fetch URL' do
-    @filter.expects(:open).with(@url)
+    @filter.expects(:open).with(@url, anything)
     @filter.process({:url =&gt; @url, :type =&gt; :link})
   end
   
+  it 'should specify a common browser as the user agent when opening' do
+    @filter.expects(:open).with(@url, has_entry('User-Agent', 'Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 5.1)'))
+    @filter.process({:url =&gt; @url, :type =&gt; :link})
+  end
+  
+  it 'should use the protocol and domain of the link as the HTTP referer when opening' do
+    url = 'http://bp1.blogspot.com/foo/bar/baz/dontlinkthisimage.jpg'
+    @filter.expects(:open).with(url, has_entry('Referer', 'http://bp1.blogspot.com/'))    
+    @filter.process({:url =&gt; url, :type =&gt; :link})
+  end
+    
   it 'should do nothing for non-links' do
     @filter.expects(:open).never
     data = {:url =&gt; @url}</diff>
      <filename>spec/bot_filter_link_title_spec.rb</filename>
    </modified>
  </modified>
  <removed type="array"/>
  <parents type="array">
    <parent>
      <id>f97a3d87ca4584799c07a7cf0f5cb0657f7b7182</id>
    </parent>
  </parents>
  <author>
    <name>Rick Bradley</name>
    <email>rick@rickbradley.com</email>
  </author>
  <url>http://github.com/flogic/nihilist_bot/commit/c67a6184200e783d10d48148452408cf73c2ff0c</url>
  <id>c67a6184200e783d10d48148452408cf73c2ff0c</id>
  <committed-date>2009-05-23T08:53:55-07:00</committed-date>
  <authored-date>2009-05-23T08:53:55-07:00</authored-date>
  <message>Forge REFERER and User-Agent when fetching links</message>
  <tree>a2e883846f53fe43952e5041c960f83292a83225</tree>
  <committer>
    <name>Rick Bradley</name>
    <email>rick@rickbradley.com</email>
  </committer>
</commit>
