<?xml version="1.0" encoding="UTF-8"?>
<commit>
  <added type="array"/>
  <modified type="array">
    <modified>
      <diff>@@ -16,7 +16,8 @@ module HoptoadNotifier
   IGNORE_DEFAULT.freeze
   
   class &lt;&lt; self
-    attr_accessor :host, :port, :secure, :api_key
+    attr_accessor :host, :port, :secure, :api_key, :http_open_timeout, :http_read_timeout,
+                  :proxy_host, :proxy_port, :proxy_user, :proxy_pass
     attr_reader   :backtrace_filters
 
     # Takes a block and adds it to the list of backtrace filters. When the filters
@@ -37,6 +38,16 @@ module HoptoadNotifier
       @host ||= 'hoptoadapp.com'
     end
     
+    # The HTTP open timeout (defaults to 2 seconds).
+    def http_open_timeout
+      @http_open_timeout ||= 2
+    end
+    
+    # The HTTP read timeout (defaults to 5 seconds).
+    def http_read_timeout
+      @http_read_timeout ||= 5
+    end
+    
     # Returns the list of errors that are being ignored. The array can be appended to.
     def ignore
       @ignore ||= (HoptoadNotifier::IGNORE_DEFAULT.dup)
@@ -222,13 +233,20 @@ module HoptoadNotifier
 
     def send_to_hoptoad data #:nodoc:
       url = HoptoadNotifier.url
-      Net::HTTP.start(url.host, url.port) do |http|
+      
+      Net::HTTP::Proxy(
+        HoptoadNotifier.proxy_host, 
+        HoptoadNotifier.proxy_port, 
+        HoptoadNotifier.proxy_user, 
+        HoptoadNotifier.proxy_pass).start(url.host, url.port) do |http|
+        
         headers = {
           'Content-type' =&gt; 'application/x-yaml',
           'Accept' =&gt; 'text/xml, application/xml'
         }
-        http.read_timeout = 5 # seconds
-        http.open_timeout = 2 # seconds
+        
+        http.read_timeout = HoptoadNotifier.http_read_timeout
+        http.open_timeout = HoptoadNotifier.http_open_timeout
         http.use_ssl = !!HoptoadNotifier.secure 
         response = begin
                      http.post(url.path, stringify_keys(data).to_yaml, headers)</diff>
      <filename>lib/hoptoad_notifier.rb</filename>
    </modified>
    <modified>
      <diff>@@ -84,12 +84,24 @@ class HoptoadNotifierTest &lt; Test::Unit::TestCase
         config.secure = true
         config.api_key = &quot;1234567890abcdef&quot;
         config.ignore &lt;&lt; [ RuntimeError ]
+        config.proxy_host = 'proxyhost1'
+        config.proxy_port = '80'
+        config.proxy_user = 'user'
+        config.proxy_pass = 'secret'
+        config.http_open_timeout = 2
+        config.http_read_timeout = 5
       end
       
       assert_equal &quot;host&quot;,              HoptoadNotifier.host
       assert_equal 3333,                HoptoadNotifier.port
       assert_equal true,                HoptoadNotifier.secure
       assert_equal &quot;1234567890abcdef&quot;,  HoptoadNotifier.api_key
+      assert_equal 'proxyhost1',        HoptoadNotifier.proxy_host
+      assert_equal '80',                HoptoadNotifier.proxy_port
+      assert_equal 'user',              HoptoadNotifier.proxy_user
+      assert_equal 'secret',            HoptoadNotifier.proxy_pass
+      assert_equal 2,                   HoptoadNotifier.http_open_timeout
+      assert_equal 5,                   HoptoadNotifier.http_read_timeout
       assert_equal (HoptoadNotifier::IGNORE_DEFAULT + [RuntimeError]), HoptoadNotifier.ignore
     end
 
@@ -352,6 +364,39 @@ class HoptoadNotifierTest &lt; Test::Unit::TestCase
         HoptoadNotifier::Sender.expects(:new).returns(@sender)
         @sender.stubs(:public_environment?).returns(true)
       end
+      
+      context &quot;when using an HTTP Proxy&quot; do
+        setup do
+          @body = 'body'
+          @response = stub(:body =&gt; @body)
+          @http = stub(:post =&gt; @response, :read_timeout= =&gt; nil, :open_timeout= =&gt; nil, :use_ssl= =&gt; nil)
+          @sender.stubs(:logger).returns(stub(:error =&gt; nil, :info =&gt; nil))
+          @proxy = stub          
+          @proxy.stubs(:start).yields(@http)
+          
+          HoptoadNotifier.port = nil
+          HoptoadNotifier.host = nil
+          HoptoadNotifier.secure = false
+                    
+          Net::HTTP.expects(:Proxy).with(
+            HoptoadNotifier.proxy_host, 
+            HoptoadNotifier.proxy_port, 
+            HoptoadNotifier.proxy_user, 
+            HoptoadNotifier.proxy_pass
+          ).returns(@proxy)
+        end
+        
+        context &quot;on notify&quot; do
+          setup { HoptoadNotifier.notify(@exception) }
+
+          before_should &quot;post to Hoptoad&quot; do            
+            url = &quot;http://hoptoadapp.com:80/notices/&quot;
+            uri = URI.parse(url)
+            URI.expects(:parse).with(url).returns(uri)
+            @http.expects(:post).with(uri.path, anything, anything).returns(@response)
+          end
+        end  
+      end
 
       context &quot;when stubbing out Net::HTTP&quot; do
         setup do
@@ -362,6 +407,7 @@ class HoptoadNotifierTest &lt; Test::Unit::TestCase
           Net::HTTP.stubs(:start).yields(@http)
           HoptoadNotifier.port = nil
           HoptoadNotifier.host = nil
+          HoptoadNotifier.proxy_host = nil
         end
 
         context &quot;on notify&quot; do
@@ -383,13 +429,25 @@ class HoptoadNotifierTest &lt; Test::Unit::TestCase
             @sender.expects(:send_to_hoptoad)
           end
 
-          before_should &quot;set the open timeout to 2 seconds&quot; do
+          before_should &quot;default the open timeout to 2 seconds&quot; do
+            HoptoadNotifier.http_open_timeout = nil
             @http.expects(:open_timeout=).with(2)
           end
 
-          before_should &quot;set the read timeout to 5 seconds&quot; do
+          before_should &quot;default the read timeout to 5 seconds&quot; do
+            HoptoadNotifier.http_read_timeout = nil
             @http.expects(:read_timeout=).with(5)
           end
+          
+          before_should &quot;allow override of the open timeout&quot; do
+            HoptoadNotifier.http_open_timeout = 4
+            @http.expects(:open_timeout=).with(4)
+          end
+          
+          before_should &quot;allow override of the read timeout&quot; do
+            HoptoadNotifier.http_read_timeout = 10
+            @http.expects(:read_timeout=).with(10)
+          end
 
           before_should &quot;connect to the right port for ssl&quot; do
             HoptoadNotifier.secure = true</diff>
      <filename>test/hoptoad_notifier_test.rb</filename>
    </modified>
  </modified>
  <removed type="array"/>
  <parents type="array">
    <parent>
      <id>38056601e3cc15a086df0e19d2ffcb585127a0fe</id>
    </parent>
  </parents>
  <author>
    <name>Christian Romney</name>
    <login>xmlblog</login>
    <email>christian@kipdigitalmedia.com</email>
  </author>
  <url>http://github.com/thoughtbot/hoptoad_notifier/commit/86e78b1983ac49651884360f608c6573ff44f813</url>
  <id>86e78b1983ac49651884360f608c6573ff44f813</id>
  <committed-date>2008-11-25T14:02:30-08:00</committed-date>
  <authored-date>2008-11-25T14:02:30-08:00</authored-date>
  <message>Added proxy support and configuration of timeouts</message>
  <tree>d662b7cf76478b3a0afcc87ea7b456f919c6a28c</tree>
  <committer>
    <name>Christian Romney</name>
    <login>xmlblog</login>
    <email>christian@kipdigitalmedia.com</email>
  </committer>
</commit>
