[TxMt] [PATCH] blogging with ssl

Grant Hollingworth grant at antiflux.org
Mon Mar 19 02:50:57 UTC 2007


When connecting to a blog over SSL, various blogging commands (e.g., Fetch Post) will include "warning: peer certificate won't be verified in this SSL session" in their output.  Net::HTTP generates this warning when its verify_mode hasn't been set.  It then defaults to OpenSSL::SSL::VERIFY_NONE.  My patch sets it explicitly to avoid the warning.
-------------- next part --------------
Index: /Users/grant/Library/Application Support/TextMate/Bundles/Blogging.tmbundle/Support/lib/metaweblog.rb
===================================================================
--- /Users/grant/Library/Application Support/TextMate/Bundles/Blogging.tmbundle/Support/lib/metaweblog.rb	(revision 6842)
+++ /Users/grant/Library/Application Support/TextMate/Bundles/Blogging.tmbundle/Support/lib/metaweblog.rb	(working copy)
@@ -1,6 +1,10 @@
 require 'xmlrpc/client'
 
 class MetaWeblogClient < XMLRPC::Client
+  def initialize(*args)
+    super(*args)
+    @http.verify_mode = OpenSSL::SSL::VERIFY_NONE # squelch Net::HTTP warning
+  end
   def get_post(post_id, username, password)
     call("metaWeblog.getPost", "#{post_id}", "#{username}", "#{password}")
   end


More information about the textmate mailing list