url.h 952 B

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