author | Stefan Bühler <source@stbuehler.de> | 2009-09-14 21:37:13 (UTC) |
---|---|---|
committer | Lars Hjemli <hjemli@gmail.com> | 2009-10-06 16:56:43 (UTC) |
commit | 121898e73d6e28656c2d451effc6d9907ebdc5ba (patch) (unidiff) | |
tree | d83e9d57cfc5b20d55b10502b832d077ae3ee076 | |
parent | 9735835c0e9f2c4a0caf5a431fc455d5855472aa (diff) | |
download | cgit-121898e73d6e28656c2d451effc6d9907ebdc5ba.zip cgit-121898e73d6e28656c2d451effc6d9907ebdc5ba.tar.gz cgit-121898e73d6e28656c2d451effc6d9907ebdc5ba.tar.bz2 |
Skip leading "/" in url querystring value
Makes it easier to rewrite :)
lighttpd-sandbox: rewrite "/cgit.cgi?url=%{enc:request.path}&%{request.query}";
Signed-off-by: Stefan Bühler <source@stbuehler.de>
Signed-off-by: Lars Hjemli <hjemli@gmail.com>
-rw-r--r-- | cgit.c | 2 |
1 files changed, 2 insertions, 0 deletions
@@ -188,48 +188,50 @@ void config_cb(const char *name, const char *value) | |||
188 | ctx.cfg.renamelimit = atoi(value); | 188 | ctx.cfg.renamelimit = atoi(value); |
189 | else if (!strcmp(name, "robots")) | 189 | else if (!strcmp(name, "robots")) |
190 | ctx.cfg.robots = xstrdup(value); | 190 | ctx.cfg.robots = xstrdup(value); |
191 | else if (!strcmp(name, "clone-prefix")) | 191 | else if (!strcmp(name, "clone-prefix")) |
192 | ctx.cfg.clone_prefix = xstrdup(value); | 192 | ctx.cfg.clone_prefix = xstrdup(value); |
193 | else if (!strcmp(name, "local-time")) | 193 | else if (!strcmp(name, "local-time")) |
194 | ctx.cfg.local_time = atoi(value); | 194 | ctx.cfg.local_time = atoi(value); |
195 | else if (!prefixcmp(name, "mimetype.")) | 195 | else if (!prefixcmp(name, "mimetype.")) |
196 | add_mimetype(name + 9, value); | 196 | add_mimetype(name + 9, value); |
197 | else if (!strcmp(name, "include")) | 197 | else if (!strcmp(name, "include")) |
198 | parse_configfile(value, config_cb); | 198 | parse_configfile(value, config_cb); |
199 | } | 199 | } |
200 | 200 | ||
201 | static void querystring_cb(const char *name, const char *value) | 201 | static void querystring_cb(const char *name, const char *value) |
202 | { | 202 | { |
203 | if (!value) | 203 | if (!value) |
204 | value = ""; | 204 | value = ""; |
205 | 205 | ||
206 | if (!strcmp(name,"r")) { | 206 | if (!strcmp(name,"r")) { |
207 | ctx.qry.repo = xstrdup(value); | 207 | ctx.qry.repo = xstrdup(value); |
208 | ctx.repo = cgit_get_repoinfo(value); | 208 | ctx.repo = cgit_get_repoinfo(value); |
209 | } else if (!strcmp(name, "p")) { | 209 | } else if (!strcmp(name, "p")) { |
210 | ctx.qry.page = xstrdup(value); | 210 | ctx.qry.page = xstrdup(value); |
211 | } else if (!strcmp(name, "url")) { | 211 | } else if (!strcmp(name, "url")) { |
212 | if (*value == '/') | ||
213 | value++; | ||
212 | ctx.qry.url = xstrdup(value); | 214 | ctx.qry.url = xstrdup(value); |
213 | cgit_parse_url(value); | 215 | cgit_parse_url(value); |
214 | } else if (!strcmp(name, "qt")) { | 216 | } else if (!strcmp(name, "qt")) { |
215 | ctx.qry.grep = xstrdup(value); | 217 | ctx.qry.grep = xstrdup(value); |
216 | } else if (!strcmp(name, "q")) { | 218 | } else if (!strcmp(name, "q")) { |
217 | ctx.qry.search = xstrdup(value); | 219 | ctx.qry.search = xstrdup(value); |
218 | } else if (!strcmp(name, "h")) { | 220 | } else if (!strcmp(name, "h")) { |
219 | ctx.qry.head = xstrdup(value); | 221 | ctx.qry.head = xstrdup(value); |
220 | ctx.qry.has_symref = 1; | 222 | ctx.qry.has_symref = 1; |
221 | } else if (!strcmp(name, "id")) { | 223 | } else if (!strcmp(name, "id")) { |
222 | ctx.qry.sha1 = xstrdup(value); | 224 | ctx.qry.sha1 = xstrdup(value); |
223 | ctx.qry.has_sha1 = 1; | 225 | ctx.qry.has_sha1 = 1; |
224 | } else if (!strcmp(name, "id2")) { | 226 | } else if (!strcmp(name, "id2")) { |
225 | ctx.qry.sha2 = xstrdup(value); | 227 | ctx.qry.sha2 = xstrdup(value); |
226 | ctx.qry.has_sha1 = 1; | 228 | ctx.qry.has_sha1 = 1; |
227 | } else if (!strcmp(name, "ofs")) { | 229 | } else if (!strcmp(name, "ofs")) { |
228 | ctx.qry.ofs = atoi(value); | 230 | ctx.qry.ofs = atoi(value); |
229 | } else if (!strcmp(name, "path")) { | 231 | } else if (!strcmp(name, "path")) { |
230 | ctx.qry.path = trim_end(value, '/'); | 232 | ctx.qry.path = trim_end(value, '/'); |
231 | } else if (!strcmp(name, "name")) { | 233 | } else if (!strcmp(name, "name")) { |
232 | ctx.qry.name = xstrdup(value); | 234 | ctx.qry.name = xstrdup(value); |
233 | } else if (!strcmp(name, "mimetype")) { | 235 | } else if (!strcmp(name, "mimetype")) { |
234 | ctx.qry.mimetype = xstrdup(value); | 236 | ctx.qry.mimetype = xstrdup(value); |
235 | } else if (!strcmp(name, "s")){ | 237 | } else if (!strcmp(name, "s")){ |