[libgovirt] Add GOVIRT_DISABLE_HTTPS debug environment variable



commit a560ea191a884c09c834e3bb810dd10bfdc00347
Author: Christophe Fergeau <cfergeau redhat com>
Date:   Fri Apr 3 17:40:36 2015 +0200

    Add GOVIRT_DISABLE_HTTPS debug environment variable
    
    During development or for debugging, it might be insteresting to access
    the oVirt REST API without encrypting the connection. The
    GOVIRT_DISABLE_HTTPS environment variable can be used to achieve this.

 govirt/ovirt-proxy.c |    7 ++++++-
 1 files changed, 6 insertions(+), 1 deletions(-)
---
diff --git a/govirt/ovirt-proxy.c b/govirt/ovirt-proxy.c
index 85b2038..6593c71 100644
--- a/govirt/ovirt-proxy.c
+++ b/govirt/ovirt-proxy.c
@@ -861,7 +861,12 @@ OvirtProxy *ovirt_proxy_new(const char *hostname)
     int i;
 
     if (!g_str_has_prefix(hostname, "http://";) && !g_str_has_prefix(hostname, "https://";)) {
-        uri = g_strconcat("https://";, hostname, NULL);
+        if (g_getenv("GOVIRT_DISABLE_HTTPS") != NULL) {
+            g_warning("Using plain text HTTP connection");
+            uri = g_strconcat("http://";, hostname, NULL);
+        } else {
+            uri = g_strconcat("https://";, hostname, NULL);
+        }
     } else {
         /* Fallback code for backwards API compat, early libgovirt versions
          * expected a full fledged URI */


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]