Skip to content
Snippets Groups Projects
Commit 6c5d2f1c authored by daurnimator's avatar daurnimator Committed by Ondřej Surý
Browse files

Use coroutine friendly pcall

parent 9dfd8f67
No related branches found
No related tags found
1 merge request!102Lua http 0.1
......@@ -13,6 +13,7 @@ local cqueues = require('cqueues')
local server = require('http.server')
local headers = require('http.headers')
local websocket = require('http.websocket')
local http_util = require "http.util"
local x509, pkey = require('openssl.x509'), require('openssl.pkey')
local has_mmdb, mmdb = pcall(require, 'mmdb')
......@@ -172,7 +173,7 @@ local function route(endpoints)
ws:close()
return
else
local ok, err, reason = pcall(serve, h, stream)
local ok, err, reason = http_util.yieldable_pcall(serve, h, stream)
if not ok or err then
if err ~= '404' then
log('[http] %s %s: %s (%s)', m, path, err or '500', reason)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment