<?xml version="1.0" encoding="UTF-8"?>
<commit>
  <added type="array"/>
  <modified type="array">
    <modified>
      <diff>@@ -36,47 +36,47 @@ class Server
   # You can pass in multiple paths, and it will try each one until it gets a 200
   def fetch(*paths)
     paths.each do |path|
-      begin
-        Merb.logger.debug(&quot;loading... &quot; + base_url + path)
+      result = nil
 
-        result = fetch_from_web(path)
+      Merb.logger.debug(&quot;loading... &quot; + base_url + path)
 
-        compressed_size = result.downloaded_content_length
+      result = fetch_from_web(path)
+      
 
-        Merb.logger.debug(&quot;loaded #{result.downloaded_content_length} compressed characters&quot;)
+      compressed_size = result.downloaded_content_length
 
-        if result.response_code == 200
-          
-          if result.header_str.include?(&quot;Cache-Lookup: HIT&quot;)
-            Merb.logger.debug(&quot;Spider HIT&quot;)
-          else
-            Merb.logger.debug(&quot;Spider MISS&quot;)
-          end
+      Merb.logger.debug(&quot;loaded #{result.downloaded_content_length} compressed characters&quot;)
 
-          body = nil
-          
+      if result.response_code == 200
+        
+        if result.header_str.include?(&quot;Cache-Lookup: HIT&quot;)
+          Merb.logger.debug(&quot;Spider HIT&quot;)
+        else
+          Merb.logger.debug(&quot;Spider MISS&quot;)
+        end
+
+        body = nil
+        
+        
+        time_to &quot;decompress&quot; do
           
-          time_to &quot;decompress&quot; do
-            
-            begin 
-              gz = Zlib::GzipReader.new( StringIO.new( result.body_str ) )
-              body = gz.read
-            rescue Zlib::GzipFile::Error
-              # If its not looking gzipped, just display it
-              body = result.body_str
-            end
-            
-            body = body.force_encoding(&quot;UTF-8&quot;)
+          begin 
+            gz = Zlib::GzipReader.new( StringIO.new( result.body_str ) )
+            body = gz.read
+          rescue Zlib::GzipFile::Error
+            # If its not looking gzipped, just display it
+            body = result.body_str
           end
           
-          Merb.logger.debug(&quot;Decompressed to #{body.size} characters&quot;)
-          
-          return {:url =&gt; result.last_effective_url, :body =&gt; body} 
+          body = body.force_encoding(&quot;UTF-8&quot;)
         end
-      
-      rescue Curl::Err::HostResolutionError, Curl::Err::GotNothingError, Curl::Err::ConnectionFailedError,  Curl::Err::PartialFileError
-        Merb.logger.error(&quot;Could not connect to &quot; + base_url + path)
+        
+        Merb.logger.debug(&quot;Decompressed to #{body.size} characters&quot;)
+        
+        return {:url =&gt; result.last_effective_url, :body =&gt; body} 
       end
+      
+      
     end
     
     return {}
@@ -85,11 +85,21 @@ class Server
   # :api: private
   def fetch_from_web(path)
     time_to &quot;fetch&quot; do
-      Curl::Easy.perform(base_url + path) do |curl|
-        # This configures Curl::Easy to follow redirects
-        curl.follow_location = true
-        curl.headers = {&quot;Accept-Encoding&quot; =&gt; &quot;compress, gzip&quot;}
-      end    
+      if defined?(Curl)
+        begin
+          Curl::Easy.perform(base_url + path) do |curl|
+            # This configures Curl::Easy to follow redirects
+            curl.follow_location = true
+            curl.headers = {&quot;Accept-Encoding&quot; =&gt; &quot;compress, gzip&quot;}
+          end
+        rescue Curl::Err::HostResolutionError, Curl::Err::GotNothingError, Curl::Err::ConnectionFailedError,  Curl::Err::PartialFileError
+          Merb.logger.error(&quot;Could not connect to &quot; + base_url + path)
+        end
+      else
+        # This is for if we are using a non-curl supported version of Ruby
+        require 'open-uri'
+        open(base_url + path).read
+      end
     end
   end
 end
\ No newline at end of file</diff>
      <filename>app/models/server.rb</filename>
    </modified>
    <modified>
      <diff>@@ -8,11 +8,16 @@ end
 
 require 'sass'
 require 'cgi'
-require 'curb'
 require 'merb-haml'
 require 'nokogiri'
 require 'mime/types'
 
+begin 
+  require 'curb'
+rescue 
+  puts &quot;no curb installed.. using open-uri&quot;
+end
+
 if is19?
   Encoding.default_internal = Encoding.default_external = &quot;UTF-8&quot;
   require Merb.root / 'merb' / 'monkey' / 'haml_fix'</diff>
      <filename>config/init.rb</filename>
    </modified>
    <modified>
      <diff>@@ -4,7 +4,12 @@ describe Article do
   
   before(:all) do
     # Stub out the device
-    @device = Device.new(nil)
+    request = mock(&quot;request&quot;)
+    request.stub!(&quot;preferred_format&quot;).and_return nil
+    request.stub!(&quot;accept&quot;).and_return &quot;xhtml&quot;
+    
+    
+    @device = Device.new(request)
     @device.instance_eval(&quot;@user_agent = 'Webkit'&quot;)
     
     # Stubs out networking</diff>
      <filename>spec/models/article_spec.rb</filename>
    </modified>
  </modified>
  <removed type="array"/>
  <parents type="array">
    <parent>
      <id>14b1f34ad408d144eb2bf65104b1e0fc5e12cc69</id>
    </parent>
  </parents>
  <author>
    <name>Hampton Catlin</name>
    <email>hcatlin@gmail.com</email>
  </author>
  <url>http://github.com/hcatlin/wikimedia-mobile/commit/2bba31f7ffdd7a1740955c97ec470b6f85837e25</url>
  <id>2bba31f7ffdd7a1740955c97ec470b6f85837e25</id>
  <committed-date>2009-10-25T04:59:55-07:00</committed-date>
  <authored-date>2009-10-25T04:59:55-07:00</authored-date>
  <message>refactoring the server object to not require curb, but use it if its installed... should help with non-MRI-based interpreters</message>
  <tree>1ae30c1b213740db92cfc03b3f866d3e4439369a</tree>
  <committer>
    <name>Hampton Catlin</name>
    <email>hcatlin@gmail.com</email>
  </committer>
</commit>
