<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/css" href="/stylesheets/rss.css"?>
<rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:trackback="http://madskills.com/public/xml/rss/module/trackback/">
  <channel>
    <title>Wolfmans Howlings: metaWeblog api in typo fails on some posts</title>
    <link>http://blog.wolfman.com/articles/2006/06/03/metaweblog-api-in-typo-fails-on-some-posts</link>
    <language>en-us</language>
    <ttl>40</ttl>
    <description>A programmers Blog about Ruby, Rails and a few other issues</description>
    <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&amp;#8230;&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&amp;#8217;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="http://technorati.com/tag/typo" rel="tag"&gt;Typo&lt;/a&gt; ticket is &lt;a href="http://www.typosphere.org/trac/ticket/538"&gt;#538&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;The relevant rails ticket is &lt;a href="http://dev.rubyonrails.org/ticket/4955"&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&amp;#8230;&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>
      <pubDate>Sat, 03 Jun 2006 23:32:00 -0700</pubDate>
      <guid isPermaLink="false">urn:uuid:40802b201ac322b4167e3c9fc7259b6a</guid>
      <author>Jim Morris</author>
      <link>http://blog.wolfman.com/articles/2006/06/03/metaweblog-api-in-typo-fails-on-some-posts</link>
      <category>Rails</category>
      <category>Ruby</category>
      <category>typo</category>
      <category>metaweblog</category>
      <trackback:ping>http://blog.wolfman.com/articles/trackback/26</trackback:ping>
    </item>
    <item>
      <title>"metaWeblog api in typo fails on some posts" by wolfman</title>
      <description>&lt;p&gt;Update, even with the latest typo edge, rails still needs to be patched, but it seems they are not on edge rails either.&lt;/p&gt;</description>
      <pubDate>Tue, 12 Sep 2006 23:21:29 -0700</pubDate>
      <guid isPermaLink="false">urn:uuid:fd71aa74-6a4f-4560-9244-9f29e3897c60</guid>
      <link>http://blog.wolfman.com/articles/2006/06/03/metaweblog-api-in-typo-fails-on-some-posts#comment-37</link>
    </item>
  </channel>
</rss>
