]> git.ipfire.org Git - thirdparty/knot-resolver.git/commitdiff
log: fix kr_log_fmt SIGSEGV crash
authorLukáš Ježek <lukas.jezek@nic.cz>
Fri, 2 Jul 2021 13:15:01 +0000 (15:15 +0200)
committerTomas Krizek <tomas.krizek@nic.cz>
Thu, 29 Jul 2021 09:42:32 +0000 (11:42 +0200)
modules/http/http.lua.in

index 1f374ffce4a46f7a80477663102dda4c5c86b32e..56baab1718e9022301b68da77332002d5990f378 100644 (file)
@@ -224,8 +224,8 @@ local function route(endpoints)
                -- Upgrade connection to WebSocket
                local ws = http_websocket.new_from_stream(stream, h)
                if ws then
-                       log_info(ffi.C.LOG_GRP_DOH, '%s %s HTTP/%d web socket open',
-                               m, path, connection.version)
+                       log_info(ffi.C.LOG_GRP_DOH, '%s %s HTTP/%s web socket open',
+                               m, path, tostring(connection.version))
                        assert(ws:accept { protocols = {'json'} })
                        -- Continue streaming results to client
                        local ep = endpoints[path]
@@ -234,15 +234,15 @@ local function route(endpoints)
                                cb(h, ws)
                        end
                        ws:close()
-                       log_info(ffi.C.LOG_GRP_DOH, '%s %s HTTP/%d web socket closed',
-                               m, path, connection.version)
+                       log_info(ffi.C.LOG_GRP_DOH, '%s %s HTTP/%s web socket closed',
+                               m, path, tostring(connection.version))
                        return
                else
                        local ok, err, reason = http_util.yieldable_pcall(serve, endpoints, h, stream)
                        if not ok or err then
                                err = err or '500'
-                               log_info(ffi.C.LOG_GRP_DOH, '%s %s HTTTP/%d %s %s',
-                                       m, path, connection.version, err, reason or '')
+                               log_info(ffi.C.LOG_GRP_DOH, '%s %s HTTTP/%s %s %s',
+                                       m, path, tostring(connection.version), err, reason or '')
                                -- Method is not supported
                                local hsend = http_headers.new()
                                hsend:append(':status', err)
@@ -253,8 +253,8 @@ local function route(endpoints)
                                        assert(stream:write_headers(hsend, true))
                                end
                        else
-                               log_info(ffi.C.LOG_GRP_DOH, '%s %s HTTP/%d 200',
-                                       m, path, connection.version)
+                               log_info(ffi.C.LOG_GRP_DOH, '%s %s HTTP/%s 200',
+                                       m, path, tostring(connection.version))
                        end
 
                end