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)>
This commit is contained in:
Lars Hjemli 2007-01-04 16:53:03 +01:00
parent 05b13194b4
commit 52e605caf5
3 changed files with 36 additions and 0 deletions

View file

@ -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;
}