diff options
Diffstat (limited to 'url.h')
-rw-r--r-- | url.h | 10 |
1 files changed, 8 insertions, 2 deletions
@@ -32,7 +32,6 @@ #define URL_H #include <stdbool.h> -#include <stdio.h> /* * Checks that the path can be safely processed. Namely, it should not contain @@ -42,13 +41,20 @@ */ bool check_request_path(const char *, const char *); +/* + * Encode a string to use in an HTTP context. + * Returns NULL in case of error, or the encoded string in case of success. + */ +char * +url_encode(const char *); /* * Build an URL from the provided components. * The first argument is the destination buffer where the URL will be written. * It is required. * The second argument is the size of the destination buffer. It is required. - * The remaining arguments are the url parts + * The remaining arguments are the url parts which should end with a NULL + * component. * Returns the number of characters written to the destination buffer. If it * is equal to the destination buffer size, it means the buffer was too small * and the resulting URL has been truncated. |