Skip to content

Instantly share code, notes, and snippets.

location /foo {
content_by_lua_block {
ngx.header["foo"] = "bar"
ngx.header["Set-Cookie"] = "this is a cookie"
ngx.redirect("/somewhere-else")
}
}
location /bar {
content_by_lua_block {
ngx.status = 301
ngx.header["Set-Cookie"] = "this is a cookie"
ngx.header["Location"] = "/somewhere-else"
}
}
location /foo {
content_by_lua_block {
2016/09/22 13:23:02 [debug] 25295#0: epoll: fd:6 ev:0001 d:00007FADB94FE220
2016/09/22 13:23:02 [debug] 25295#0: accept on 0.0.0.0:80, ready: 0
2016/09/22 13:23:02 [debug] 25295#0: posix_memalign: 00007FADB94F7500:512 @16
2016/09/22 13:23:02 [debug] 25295#0: *1 accept: 127.0.0.1:45967 fd:3
2016/09/22 13:23:02 [debug] 25295#0: *1 event timer add: 3: 60000:1474575842609
2016/09/22 13:23:02 [debug] 25295#0: *1 reusable connection: 1
2016/09/22 13:23:02 [debug] 25295#0: *1 epoll add event: fd:3 op:1 ev:80002001
2016/09/22 13:23:02 [debug] 25295#0: timer delta: 1078
2016/09/22 13:23:02 [debug] 25295#0: worker cycle
2016/09/22 13:23:02 [debug] 25295#0: epoll timer: 60000
libtool: compile: g++ -DHAVE_CONFIG_H -I. -std=c++11 -I.. -g -fPIC -O3 -I ../headers -DWITH_GEOIP -I/usr/include/ -DWITH_YAJL -I/usr/include/yajl -DWITH_LMDB -I/usr/include -DPCRE_HAVE_JIT -I/usr/include/libxml2 -DWITH_LIBXML2 -g -O2 -MT collection/backend/libmodsecurity_la-lmdb.lo -MD -MP -MF collection/backend/.deps/libmodsecurity_la-lmdb.Tpo -c collection/backend/lmdb.cc -fPIC -DPIC -o collection/backend/.libs/libmodsecurity_la-lmdb.o
collection/backend/lmdb.cc: In member function 'virtual void modsecurity::collection::backend::LMDB::resolveMultiMatches(const string&, std::vector<const modsecurity::collection::Variable*>*)':
collection/backend/lmdb.cc:543:44: error: 'strncmp' was not declared in this scope
if (strncmp(var.c_str(), a, keySize) != 0) {
^
function profile_fw() {
pushd `pwd`
cd ~poprocks/code/Lua/lua-resty-waf
make
popd
title=$1
OPATH=$PATH
s=$(date +%s)
pid=$(pgrep nginx | tail -1)
pushd /home/poprocks/code/tools/stapxx
$ cat kong/utils/public.lua
local pcall = pcall
local ngx_log = ngx.log
local ERR = ngx.ERR
local _M = {}
do
vagrant@precise64:/kong$ git diff
diff --git a/spec/02-integration/05-proxy/01-router_spec.lua b/spec/02-integration/05-proxy/01-router_spec.lua
index e990926..1fb40ae 100644
--- a/spec/02-integration/05-proxy/01-router_spec.lua
+++ b/spec/02-integration/05-proxy/01-router_spec.lua
@@ -266,9 +266,9 @@ describe("Router", function()
headers = { ["Host"] = "preserved.com" },
})
- assert.res_status(200, res)
$ cat t.lua
local c = require "cjson"
local d = c.decode
local e = c.encode
local j1 = [[
[
{
"weight": 0,
"id": "38b4ab34-f6da-4f88-9e03-aa53f75ed9f7",
2017/03/23 09:46:16 [debug] 32392#0: malloc: 00007F71909F8A70:6144
2017/03/23 09:46:16 [debug] 32392#0: malloc: 00007F7190A31910:237568
2017/03/23 09:46:16 [debug] 32392#0: malloc: 00007F7190A6B920:98304
2017/03/23 09:46:16 [debug] 32392#0: malloc: 00007F7190A83930:98304
2017/03/23 09:46:16 [debug] 32392#0: epoll add event: fd:5 op:1 ev:00002001
2017/03/23 09:46:16 [debug] 32392#0: epoll add event: fd:6 op:1 ev:00002001
2017/03/23 09:46:16 [debug] 32392#0: epoll add event: fd:7 op:1 ev:00002001
2017/03/23 09:46:16 [debug] 32392#0: setproctitle: "nginx: worker process"
2017/03/23 09:46:16 [debug] 32392#0: worker cycle
2017/03/23 09:46:16 [debug] 32392#0: epoll timer: -1
┌──[poprocks@soter]─[~]
└── $ cat x.lua
ffi = require("ffi")
ffi.cdef[[
typedef long time_t;
typedef struct timeval {
time_t tv_sec;
time_t tv_usec;
} timeval;