koreader-sync/rootfs/app/gin.patch

47 lines
1.5 KiB
Diff
Raw Normal View History

2016-08-16 08:48:34 +00:00
diff --git a/gin-0.2.0-1.rockspec b/gin-0.2.0-1.rockspec
index b9601ec..55f4469 100644
--- a/gin-0.2.0-1.rockspec
+++ b/gin-0.2.0-1.rockspec
@@ -18,8 +18,9 @@ dependencies = {
"busted = 2.0.rc10-0",
"lua-cjson = 2.1.0-1",
"luasocket = 3.0rc1-2",
+ "luasec = 0.5-2",
"luafilesystem = 1.6.3-1",
- "luaposix = 33.3.1-1",
+ "luaposix = 33.4.0",
"penlight = 1.3.2-2",
"luadbi = 0.5-1"
}
diff --git a/gin/spec/runners/integration.lua b/gin/spec/runners/integration.lua
index 5ef537a..21ec8f9 100644
--- a/gin/spec/runners/integration.lua
+++ b/gin/spec/runners/integration.lua
@@ -1,5 +1,6 @@
-- dep
local http = require 'socket.http'
+local https = require 'ssl.https'
local url = require 'socket.url'
local json = require 'cjson'
local ltn12 = require 'ltn12'
@@ -82,8 +83,9 @@ local function set_accept_header(request, api_version)
end
local function hit_server(request)
+ local scheme = request.scheme or 'http'
local full_url = url.build({
- scheme = 'http',
+ scheme = scheme,
host = '127.0.0.1',
port = Gin.settings.port,
path = request.path,
@@ -91,7 +93,8 @@ local function hit_server(request)
})
local response_body = {}
- local ok, response_status, response_headers = http.request({
+ local http_request = (scheme == 'https') and https.request or http.request
+ local ok, response_status, response_headers = http_request({
method = request.method,
url = full_url,
source = ltn12.source.string(request.body),