| 1 | // SPDX-License-Identifier: GPL-3.0-or-later |
| 2 | |
| 3 | #ifndef NETDATA_URL_H |
| 4 | #define NETDATA_URL_H 1 |
| 5 | |
| 6 | #include "../libnetdata.h" |
| 7 | |
| 8 | // ---------------------------------------------------------------------------- |
| 9 | // URL encode / decode |
| 10 | // code from: http://www.geekhideout.com/urlcode.shtml |
| 11 | |
| 12 | /* Converts a hex character to its integer value */ |
| 13 | char from_hex(char ch); |
| 14 | |
| 15 | /* Converts an integer value to its hex character*/ |
| 16 | char to_hex(char code); |
| 17 | |
| 18 | /* Returns a url-encoded version of str */ |
| 19 | /* IMPORTANT: be sure to free() the returned string after use */ |
| 20 | char *url_encode(const char *str); |
| 21 | |
| 22 | char *url_decode_r(char *to, const char *url, size_t size); |
| 23 | |
| 24 | bool url_is_request_complete_and_extract_payload(const char *begin, const char *end, size_t length, BUFFER **post_payload); |
| 25 | char *url_find_protocol(char *s); |
| 26 | |
| 27 | #endif /* NETDATA_URL_H */ |