diff -r 51d9a15eac98 -r d7a186cf87f6 src/server/daemon/request.c --- a/src/server/daemon/request.c Sat Oct 22 11:27:39 2016 +0200 +++ b/src/server/daemon/request.c Sun Oct 23 10:52:54 2016 +0200 @@ -123,6 +123,33 @@ return s; } +int request_set_path(sstr_t root, sstr_t path, pblock *vars) { + // TODO: maybe replace this code with request_set_path from req.cpp + + // concat path + size_t length = root.length + path.length; + char *translated_path = alloca(length + 1); + memcpy(translated_path, root.ptr, root.length); + if(root.ptr[root.length-1] == '/') { + memcpy(translated_path + root.length, path.ptr, path.length); + } else { + translated_path[root.length] = '/'; + memcpy(translated_path + root.length + 1, path.ptr, path.length); + length++; + } + + // add path to specified pblock + pblock_kvinsert( + pb_key_ppath, + translated_path, + length, + vars); + + pblock_kvinsert(pb_key_ntrans_base, root.ptr, root.length, vars); + + return REQ_PROCEED; +} + void request_free(Request *rq) { // TODO: implement }