Force HTTP if HTTPS isn't enabled

Change-Id: I52c7b4ae4025e599be138bbbe71dcb9eb4da74a0
diff --git a/mojo/services/network/url_loader_impl.cc b/mojo/services/network/url_loader_impl.cc
index bbba168..2bfce84 100644
--- a/mojo/services/network/url_loader_impl.cc
+++ b/mojo/services/network/url_loader_impl.cc
@@ -130,6 +130,17 @@
       redirect = false;
     }
 
+#ifndef NETWORK_SERVICE_USE_HTTPS
+    if (proto == "https") {
+      std::cerr << "WARNING: network_service was built without HTTPS; "
+        "Forcing HTTP instead." << std::endl;
+      proto = "http";
+      if (port == "443" || port == "https" || port == "") {
+        port = "80";
+      }
+    }
+#endif
+
     if (proto == "https") {
 #ifdef NETWORK_SERVICE_USE_HTTPS
       asio::ssl::context ctx(asio::ssl::context::sslv23);
@@ -143,11 +154,6 @@
         redirect = true;
         url = c.redirect_location_;
       }
-#else
-      std::cout << "https is not built-in. "
-        "please build with NETWORK_SERVICE_USE_HTTPS" << std::endl;
-      error_code = ERR_INVALID_ARGUMENT;
-      break;
 #endif
     } else if (proto == "http") {
       HTTPClient<tcp::socket> c(this, io_service, host, port, path);