xref: /php-src/ext/standard/url.h (revision 8109d210)
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 
17 #ifndef URL_H
18 #define URL_H
19 
20 typedef struct php_url {
21 	zend_string *scheme;
22 	zend_string *user;
23 	zend_string *pass;
24 	zend_string *host;
25 	unsigned short port;
26 	zend_string *path;
27 	zend_string *query;
28 	zend_string *fragment;
29 } php_url;
30 
31 PHPAPI void php_url_free(php_url *theurl);
32 PHPAPI php_url *php_url_parse(char const *str);
33 PHPAPI php_url *php_url_parse_ex(char const *str, size_t length);
34 PHPAPI php_url *php_url_parse_ex2(char const *str, size_t length, bool *has_port);
35 PHPAPI size_t php_url_decode(char *str, size_t len); /* return value: length of decoded string */
36 PHPAPI size_t php_raw_url_decode(char *str, size_t len); /* return value: length of decoded string */
37 PHPAPI zend_string *php_url_encode(char const *s, size_t len);
38 PHPAPI zend_string *php_raw_url_encode(char const *s, size_t len);
39 
40 #define PHP_URL_SCHEME 0
41 #define PHP_URL_HOST 1
42 #define PHP_URL_PORT 2
43 #define PHP_URL_USER 3
44 #define PHP_URL_PASS 4
45 #define PHP_URL_PATH 5
46 #define PHP_URL_QUERY 6
47 #define PHP_URL_FRAGMENT 7
48 
49 #define PHP_QUERY_RFC1738 1
50 #define PHP_QUERY_RFC3986 2
51 
52 #endif /* URL_H */
53