diff options
author | Vincent Douillet <vincent@vdouillet.fr> | 2024-09-11 11:20:31 +0200 |
---|---|---|
committer | Vincent Douillet <vincent@vdouillet.fr> | 2024-09-11 11:20:31 +0200 |
commit | 19e47daa9c1fb55f2cb9e639d5a6ef16b5bc4e88 (patch) | |
tree | 2b98ac0700a11cb142625d8355019c44b49c1850 /url.h | |
parent | 4e921ffa31fdca2425d326efda1c6d9ad190359a (diff) |
url: fix encoding for use in http context
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. |