diff options
author | Lars Hjemli <larsh@hal-2004.(none)> | 2007-01-04 16:53:03 +0100 |
---|---|---|
committer | Lars Hjemli <larsh@hal-2004.(none)> | 2007-01-04 16:57:00 +0100 |
commit | 52e605caf573fa20fdd4fbac5e1cc69b7740b1f5 (patch) | |
tree | 62c7bfb147f93a850f430185961a89ee51b8470a /shared.c | |
parent | Handle '+' in querystring (diff) | |
download | cgit-pink-52e605caf573fa20fdd4fbac5e1cc69b7740b1f5.tar.gz cgit-pink-52e605caf573fa20fdd4fbac5e1cc69b7740b1f5.zip |
Handle %xx encoding in querystring
Convert valid %xx expressions in querystring to ascii, ignore invalid expressions (i.e. eat the three characters %xx). Signed-off-by: Lars Hjemli <larsh@hal-2004.(none)>
Diffstat (limited to 'shared.c')
-rw-r--r-- | shared.c | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/shared.c b/shared.c index 7def51a..e4595fa 100644 --- a/shared.c +++ b/shared.c @@ -113,3 +113,16 @@ void *cgit_free_commitinfo(struct commitinfo *info) free(info); return NULL; } + +int hextoint(char c) +{ + if (c >= 'a' && c <= 'f') + return 10 + c - 'a'; + else if (c >= 'A' && c <= 'F') + return 10 + c - 'A'; + else if (c >= '0' && c <= '9') + return c - '0'; + else + return -1; +} + |