aboutsummaryrefslogtreecommitdiff
path: root/src/daemon/internal.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/daemon/internal.c')
-rw-r--r--src/daemon/internal.c23
1 files changed, 23 insertions, 0 deletions
diff --git a/src/daemon/internal.c b/src/daemon/internal.c
index 0407cfa9..85c17b16 100644
--- a/src/daemon/internal.c
+++ b/src/daemon/internal.c
@@ -42,3 +42,26 @@ MHD_DLOG (const struct MHD_Daemon *daemon, const char *format, ...)
42 VFPRINTF (stderr, format, va); 42 VFPRINTF (stderr, format, va);
43 va_end (va); 43 va_end (va);
44} 44}
45
46/**
47 * Process escape sequences ('+'=space, %HH)
48 */
49void
50MHD_http_unescape (char *val)
51{
52 char *esc;
53 unsigned int num;
54
55 while (NULL != (esc = strstr (val, "+")))
56 *esc = ' ';
57 while (NULL != (esc = strstr (val, "%")))
58 {
59 if ((1 == sscanf (&esc[1],
60 "%2x", &num)) || (1 == sscanf (&esc[1], "%2X", &num)))
61 {
62 esc[0] = (unsigned char) num;
63 memmove (&esc[1], &esc[3], strlen (&esc[3]));
64 }
65 val = esc + 1;
66 }
67}