<?xml version='1.0' encoding='utf-8' ?>
<rss version='2.0' xmlns:dc='http://purl.org/dc/elements/1.1/'>
  <channel>
    <title>Wolfmans Howlings: metaWeblog api in typo fails on some posts</title>
    <link>http://blog.wolfman.com/articles/2006/6/3/metaweblog-api-in-typo-fails-on-some-posts</link>
    <description>A programmers Blog about Ruby, Rails and a few other issue</description>
    <language>en-us</language>
    <ttl>40</ttl>
    <item>
      <title>metaWeblog api in typo fails on some posts</title>
      <description>
        &lt;p&gt;I was using a ruby script to post my blogs from the command line, and
        it used the xmlrpc/client which would occasionally fail with this
        error...&lt;/p&gt;
        
        &lt;pre&gt;&lt;code&gt;/usr/local/lib/ruby/1.8/xmlrpc/client.rb:546:in `do_rpc': HTTP-Error: 500 Internal Server Error  (RuntimeError)
            from /usr/local/lib/ruby/1.8/xmlrpc/client.rb:420:in `call2'
            from /usr/local/lib/ruby/1.8/xmlrpc/client.rb:410:in `call'
            from send2blog.rb:103
        &lt;/code&gt;&lt;/pre&gt;
        
        &lt;p&gt;This was annoying, so I did some sleuthing and it turns out there were
        various apparently unrelated bugs posted about this in the typo trac,
        and in rails. I noticed it seemed to be fixed in Rails edge so I found
        the patch and applied it locally to my typo's version of rails, and
        now I can post all my blogs from the command line again.&lt;/p&gt;
        
        &lt;p&gt;The problem was with posts containing &lt;code&gt;&amp;amp;&amp;amp;&lt;/code&gt; or &lt;code&gt;&amp;lt;&amp;lt;&lt;/code&gt; etc which seeing as
        I was posting a lot of ruby code most of my blogs had.&lt;/p&gt;
        
        &lt;ul&gt;
        &lt;li&gt;The relevant &lt;a href=&quot;http://technorati.com/tag/typo&quot; rel=&quot;tag&quot;&gt;Typo&lt;/a&gt; ticket is &lt;a href=&quot;http://www.typosphere.org/trac/ticket/538&quot;&gt;#538&lt;/a&gt;&lt;/li&gt;
        &lt;li&gt;The relevant rails ticket is &lt;a href=&quot;http://dev.rubyonrails.org/ticket/4955&quot;&gt;#4955&lt;/a&gt;&lt;/li&gt;
        &lt;/ul&gt;
        
        &lt;p&gt;The fix is a one line addition to vendor/rails/actionpack/lib/action_controller/cgi_ext/cgi_methods.rb on line 48 the patch is...&lt;/p&gt;
        
        &lt;pre&gt;&lt;code&gt;Index: actionpack/lib/action_controller/cgi_ext/cgi_methods.rb
        ===================================================================
        --- actionpack/lib/action_controller/cgi_ext/cgi_methods.rb     (revision 4324)
        +++ actionpack/lib/action_controller/cgi_ext/cgi_methods.rb     (working copy)
        @@ -45,6 +45,7 @@
               parsed_params = {}
        
               for key, value in params
        +        next if key.nil?
             value = [value] if key =~ /.*[]$/
             unless key.include?('[')
               # much faster to test for the most common case first (GET)
        &lt;/code&gt;&lt;/pre&gt;
        
        &lt;p&gt;This seems to work for rails versions &gt;= 1.0, although it is already patched in edge rails.&lt;/p&gt;
      </description>
      <author>Jim Morris</author>
      <pubDate>Sat, 03 Jun 2006 23:32:02 -0700</pubDate>
      <link>http://blog.wolfman.com/articles/2006/6/3/metaweblog-api-in-typo-fails-on-some-posts</link>
      <guid isPermaLink='false'>urn:uuid:40802b201ac322b4167e3c9fc7259b6a</guid>
    </item>
    <item>
      <title>"metaWeblog api in typo fails on some posts" by wolfman</title>
      <description>Update, even with the latest typo edge, rails still needs to be patched, but it seems they are not on edge rails either.</description>
      <pubDate>Tue, 12 Sep 2006 23:21:29 -0700</pubDate>
      <link>http://blog.wolfman.com/posts/5#comment-25</link>
      <guid isPermaLink='false'>urn:uuid:fd71aa74-6a4f-4560-9244-9f29e3897c60</guid>
    </item>
  </channel>
</rss>
