From 4d8e5008f6656a15f80e590cc78cf7e7ab964c7f Mon Sep 17 00:00:00 2001
From: Iustin Pop <iustin@google.com>
Date: Wed, 5 Jan 2011 11:14:19 +0100
Subject: [PATCH] Rapi: move the curl options list to a separate var

A small cleanup, this just moves the options to a separate list to
avoid instantiation at every call.

Signed-off-by: Iustin Pop <iustin@google.com>
Reviewed-by: Balazs Lecz <leczb@google.com>
---
 Ganeti/HTools/Rapi.hs | 16 ++++++++++------
 1 file changed, 10 insertions(+), 6 deletions(-)

diff --git a/Ganeti/HTools/Rapi.hs b/Ganeti/HTools/Rapi.hs
index 7f40f21bf..28bfe89ef 100644
--- a/Ganeti/HTools/Rapi.hs
+++ b/Ganeti/HTools/Rapi.hs
@@ -4,7 +4,7 @@
 
 {-
 
-Copyright (C) 2009, 2010 Google Inc.
+Copyright (C) 2009, 2010, 2011 Google Inc.
 
 This program is free software; you can redistribute it and/or modify
 it under the terms of the GNU General Public License as published by
@@ -44,14 +44,18 @@ import qualified Ganeti.HTools.Group as Group
 import qualified Ganeti.HTools.Node as Node
 import qualified Ganeti.HTools.Instance as Instance
 
+-- | The curl options we use
+curlOpts :: [CurlOption]
+curlOpts = [ CurlSSLVerifyPeer False
+           , CurlSSLVerifyHost 0
+           , CurlTimeout (fromIntegral queryTimeout)
+           , CurlConnectTimeout (fromIntegral connTimeout)
+           ]
+
 -- | Read an URL via curl and return the body if successful.
 getUrl :: (Monad m) => String -> IO (m String)
 getUrl url = do
-  (code, body) <- curlGetString url [CurlSSLVerifyPeer False,
-                                     CurlSSLVerifyHost 0,
-                                     CurlTimeout (fromIntegral queryTimeout),
-                                     CurlConnectTimeout
-                                     (fromIntegral connTimeout)]
+  (code, body) <- curlGetString url curlOpts
   return (case code of
             CurlOK -> return body
             _ -> fail $ printf "Curl error for '%s', error %s"
-- 
GitLab