<?xml version="1.0" encoding="UTF-8"?>
<commit>
  <added type="array"/>
  <modified type="array">
    <modified>
      <diff>@@ -150,121 +150,122 @@ module OpenWFE
 
     private
 
-      def self.to_httpdate (t)
+    def self.to_httpdate (t)
 
-        return &quot;&quot; unless t
-        t.httpdate
-      end
-
-      def self.from_httpdate (s)
+      return '' unless t
+      t = Time.parse(t) if t.is_a?(String) # :(
+      t.httpdate
+    end
 
-        return nil unless s
-        return nil if s.strip == &quot;&quot;
+    def self.from_httpdate (s)
 
-        Time.httpdate s
-      end
+      return nil unless s
+      return nil if s.strip == ''
 
-      #--
-      # OUT
-      #++
-
-      def self.to_element (xml, root_name=nil)
+      Time.httpdate(s)
+    end
 
-        xml = if xml.is_a?(REXML::Element)
-          xml
-        elsif xml.is_a?(REXML::Document)
-          xml.root
-        else
-          REXML::Document.new(xml).root
-        end
+    #--
+    # OUT
+    #++
 
-        #raise &quot;not the XML of a #{root_name} ('#{xml.name}')&quot; \
-        #  if root_name and (xml.name != root_name)
-        return nil if root_name and (xml.name != root_name)
+    def self.to_element (xml, root_name=nil)
 
+      xml = if xml.is_a?(REXML::Element)
         xml
+      elsif xml.is_a?(REXML::Document)
+        xml.root
+      else
+        REXML::Document.new(xml).root
       end
 
-      def self.hash_to_xml (h, options={})
+      #raise &quot;not the XML of a #{root_name} ('#{xml.name}')&quot; \
+      #  if root_name and (xml.name != root_name)
+      return nil if root_name and (xml.name != root_name)
+
+      xml
+    end
+
+    def self.hash_to_xml (h, options={})
 
-        tagname = options.delete(:tag) || 'hash'
+      tagname = options.delete(:tag) || 'hash'
 
-        builder(options) do |xml|
-          xml.tag!(tagname) do
-            h.each do |k, v|
-              xml.entry do
-                object_to_xml(k, options)
-                object_to_xml(v, options)
-              end
+      builder(options) do |xml|
+        xml.tag!(tagname) do
+          h.each do |k, v|
+            xml.entry do
+              object_to_xml(k, options)
+              object_to_xml(v, options)
             end
           end
         end
       end
+    end
 
-      def self.array_to_xml (a, options={})
+    def self.array_to_xml (a, options={})
 
-        builder(options) do |xml|
-          xml.array do
-            a.each { |o| object_to_xml(o, options) }
-          end
+      builder(options) do |xml|
+        xml.array do
+          a.each { |o| object_to_xml(o, options) }
         end
       end
+    end
 
-      #--
-      # IN
-      #++
+    #--
+    # IN
+    #++
 
-      #
-      # Returns the text wrapped in the child elt with the given
-      # name.
-      #
-      def self.text (parent, elt_name)
+    #
+    # Returns the text wrapped in the child elt with the given
+    # name.
+    #
+    def self.text (parent, elt_name)
 
-        elt = parent.elements[elt_name]
-        elt ? elt.text : nil
-      end
+      elt = parent.elements[elt_name]
+      elt ? elt.text : nil
+    end
 
-      def self.object_from_xml (elt)
+    def self.object_from_xml (elt)
 
-        name = elt.name
-        text = elt.text
+      name = elt.name
+      text = elt.text
 
-        return true if name == 'true'
-        return false if name == 'false'
-        return nil if name == 'null'
+      return true if name == 'true'
+      return false if name == 'false'
+      return nil if name == 'null'
 
-        if name == 'number'
-          return text.to_f if text.index('.')
-          return text.to_i
-        end
+      if name == 'number'
+        return text.to_f if text.index('.')
+        return text.to_i
+      end
 
-        return hash_from_xml(elt) if name == 'hash'
-        return array_from_xml(elt) if name == 'array'
+      return hash_from_xml(elt) if name == 'hash'
+      return array_from_xml(elt) if name == 'array'
 
-        text # string / object
-      end
+      text # string / object
+    end
 
-      def self.hash_from_xml (elt)
+    def self.hash_from_xml (elt)
 
-        elt.owfe_elt_children.inject({}) do |r, e|
+      elt.owfe_elt_children.inject({}) do |r, e|
 
-          children = e.owfe_elt_children
+        children = e.owfe_elt_children
 
-          k = object_from_xml children[0]
-          v = object_from_xml children[1]
+        k = object_from_xml children[0]
+        v = object_from_xml children[1]
 
-          r[k] = v
+        r[k] = v
 
-          r
-        end
+        r
       end
+    end
 
-      def self.array_from_xml (elt)
+    def self.array_from_xml (elt)
 
-        elt.owfe_elt_children.inject([]) do |r, e|
-          r &lt;&lt; object_from_xml(e)
-        end
+      elt.owfe_elt_children.inject([]) do |r, e|
+        r &lt;&lt; object_from_xml(e)
       end
+    end
   end
 end
 </diff>
      <filename>lib/openwfe/util/xml.rb</filename>
    </modified>
  </modified>
  <removed type="array"/>
  <parents type="array">
    <parent>
      <id>5348d68477c619f29e89032a1e3efae889f5722c</id>
    </parent>
  </parents>
  <author>
    <name>John Mettraux</name>
    <email>jmettraux@gmail.com</email>
  </author>
  <url>http://github.com/jmettraux/ruote/commit/53a147f3f2b3893d555f9b0e579e01bb18053ecc</url>
  <id>53a147f3f2b3893d555f9b0e579e01bb18053ecc</id>
  <committed-date>2009-06-24T20:59:04-07:00</committed-date>
  <authored-date>2009-06-24T20:59:04-07:00</authored-date>
  <message>being more lax in #to_httpdate (fixes ruote-rest issue)</message>
  <tree>99c493361aab81c49c5ec8f6c59228cd3e19a207</tree>
  <committer>
    <name>John Mettraux</name>
    <email>jmettraux@gmail.com</email>
  </committer>
</commit>
