src/server/daemon/request.c

changeset 116
d7a186cf87f6
parent 84
afd57ce39ec9
child 121
a881dc866e23
equal deleted inserted replaced
115:51d9a15eac98 116:d7a186cf87f6
121 // TODO: statpath and staterror 121 // TODO: statpath and staterror
122 rq->finfo = s; 122 rq->finfo = s;
123 return s; 123 return s;
124 } 124 }
125 125
126 int request_set_path(sstr_t root, sstr_t path, pblock *vars) {
127 // TODO: maybe replace this code with request_set_path from req.cpp
128
129 // concat path
130 size_t length = root.length + path.length;
131 char *translated_path = alloca(length + 1);
132 memcpy(translated_path, root.ptr, root.length);
133 if(root.ptr[root.length-1] == '/') {
134 memcpy(translated_path + root.length, path.ptr, path.length);
135 } else {
136 translated_path[root.length] = '/';
137 memcpy(translated_path + root.length + 1, path.ptr, path.length);
138 length++;
139 }
140
141 // add path to specified pblock
142 pblock_kvinsert(
143 pb_key_ppath,
144 translated_path,
145 length,
146 vars);
147
148 pblock_kvinsert(pb_key_ntrans_base, root.ptr, root.length, vars);
149
150 return REQ_PROCEED;
151 }
152
126 void request_free(Request *rq) { 153 void request_free(Request *rq) {
127 // TODO: implement 154 // TODO: implement
128 } 155 }
129 156
130 Request* request_restart_internal(const char *uri, Request *rq) { 157 Request* request_restart_internal(const char *uri, Request *rq) {

mercurial