url.h 2.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  1. /*
  2. +----------------------------------------------------------------------+
  3. | Copyright (c) The PHP Group |
  4. +----------------------------------------------------------------------+
  5. | This source file is subject to version 3.01 of the PHP license, |
  6. | that is bundled with this package in the file LICENSE, and is |
  7. | available through the world-wide-web at the following url: |
  8. | https://www.php.net/license/3_01.txt |
  9. | If you did not receive a copy of the PHP license and are unable to |
  10. | obtain it through the world-wide-web, please send a note to |
  11. | license@php.net so we can mail you a copy immediately. |
  12. +----------------------------------------------------------------------+
  13. | Author: Jim Winstead <jimw@php.net> |
  14. +----------------------------------------------------------------------+
  15. */
  16. #ifndef URL_H
  17. #define URL_H
  18. typedef struct php_url {
  19. zend_string *scheme;
  20. zend_string *user;
  21. zend_string *pass;
  22. zend_string *host;
  23. unsigned short port;
  24. zend_string *path;
  25. zend_string *query;
  26. zend_string *fragment;
  27. } php_url;
  28. PHPAPI void php_url_free(php_url *theurl);
  29. PHPAPI php_url *php_url_parse(char const *str);
  30. PHPAPI php_url *php_url_parse_ex(char const *str, size_t length);
  31. PHPAPI php_url *php_url_parse_ex2(char const *str, size_t length, bool *has_port);
  32. PHPAPI size_t php_url_decode(char *str, size_t len); /* return value: length of decoded string */
  33. PHPAPI size_t php_raw_url_decode(char *str, size_t len); /* return value: length of decoded string */
  34. PHPAPI zend_string *php_url_encode(char const *s, size_t len);
  35. PHPAPI zend_string *php_raw_url_encode(char const *s, size_t len);
  36. PHPAPI char *php_replace_controlchars_ex(char *str, size_t len);
  37. #define PHP_URL_SCHEME 0
  38. #define PHP_URL_HOST 1
  39. #define PHP_URL_PORT 2
  40. #define PHP_URL_USER 3
  41. #define PHP_URL_PASS 4
  42. #define PHP_URL_PATH 5
  43. #define PHP_URL_QUERY 6
  44. #define PHP_URL_FRAGMENT 7
  45. #define PHP_QUERY_RFC1738 1
  46. #define PHP_QUERY_RFC3986 2
  47. #endif /* URL_H */