url.h 1.0 KB

1234567891011121314151617181920212223242526272829303132333435
  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, char *url, size_t size);
  19. #define WEB_FIELDS_MAX 400
  20. int url_map_query_string(char **out, char *url);
  21. int url_parse_query_string(char *output, size_t max, char **map, int total);
  22. int url_is_request_complete(char *begin,char *end,size_t length);
  23. char *url_find_protocol(char *s);
  24. #endif /* NETDATA_URL_H */