Diff

net/http.lua @ 5453:116971a751d3

Merge 0.9->trunk
author Matthew Wild <mwild1@gmail.com>
date Mon, 08 Apr 2013 17:22:15 +0100
parent 5448:cbe9fa2d3787
child 5458:84162b81c863
line wrap: on
line diff
--- a/net/http.lua	Mon Apr 08 15:32:51 2013 +0100
+++ b/net/http.lua	Mon Apr 08 17:22:15 2013 +0100
@@ -11,6 +11,8 @@
 local url = require "socket.url"
 local httpstream_new = require "util.httpstream".new;
 
+local ssl_available = pcall(require, "ssl");
+
 local server = require "net.server"
 
 local t_insert, t_concat = table.insert, table.concat;
@@ -177,6 +179,9 @@
 	req.method, req.headers, req.body = method, headers, body;
 	
 	local using_https = req.scheme == "https";
+	if using_https and not ssl_available then
+		error("SSL not available, unable to contact https URL");
+	end
 	local port = tonumber(req.port) or (using_https and 443 or 80);
 	
 	-- Connect the socket, and wrap it with net.server