xref: /PHP-8.1/ext/standard/url.h (revision 01b3fc03)
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 PHPAPI char *php_replace_controlchars_ex(char *str, size_t len);
40 
41 #define PHP_URL_SCHEME 0
42 #define PHP_URL_HOST 1
43 #define PHP_URL_PORT 2
44 #define PHP_URL_USER 3
45 #define PHP_URL_PASS 4
46 #define PHP_URL_PATH 5
47 #define PHP_URL_QUERY 6
48 #define PHP_URL_FRAGMENT 7
49 
50 #define PHP_QUERY_RFC1738 1
51 #define PHP_QUERY_RFC3986 2
52 
53 #endif /* URL_H */
54