bare-url 2.0.7 → 2.0.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/prebuilds/android-arm/bare-url.bare +0 -0
- package/prebuilds/android-arm64/bare-url.bare +0 -0
- package/prebuilds/android-ia32/bare-url.bare +0 -0
- package/prebuilds/android-x64/bare-url.bare +0 -0
- package/prebuilds/darwin-arm64/bare-url.bare +0 -0
- package/prebuilds/darwin-x64/bare-url.bare +0 -0
- package/prebuilds/ios-arm64/bare-url.bare +0 -0
- package/prebuilds/ios-arm64-simulator/bare-url.bare +0 -0
- package/prebuilds/ios-x64-simulator/bare-url.bare +0 -0
- package/prebuilds/linux-arm64/bare-url.bare +0 -0
- package/prebuilds/linux-x64/bare-url.bare +0 -0
- package/prebuilds/win32-arm64/bare-url.bare +0 -0
- package/prebuilds/win32-x64/bare-url.bare +0 -0
- package/vendor/liburl/CMakeLists.txt +8 -6
- package/vendor/liburl/{src → include/url}/parse.h +1 -1
- package/vendor/liburl/{src → include/url}/type.h +1 -1
- package/vendor/liburl/include/url.h +65 -25
- package/vendor/liburl/src/url.c +24 -63
- /package/vendor/liburl/{src → include/url}/character-set.h +0 -0
- /package/vendor/liburl/{src → include/url}/idna.h +0 -0
- /package/vendor/liburl/{src → include/url}/infra.h +0 -0
- /package/vendor/liburl/{src → include/url}/percent-encode.h +0 -0
- /package/vendor/liburl/{src → include/url}/punycode.h +0 -0
- /package/vendor/liburl/{src → include/url}/serialize.h +0 -0
package/package.json
CHANGED
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
@@ -19,13 +19,13 @@ target_sources(
|
|
|
19
19
|
url
|
|
20
20
|
INTERFACE
|
|
21
21
|
include/url.h
|
|
22
|
+
include/url/character-set.h
|
|
23
|
+
include/url/infra.h
|
|
24
|
+
include/url/parse.h
|
|
25
|
+
include/url/percent-encode.h
|
|
26
|
+
include/url/serialize.h
|
|
27
|
+
include/url/type.h
|
|
22
28
|
PRIVATE
|
|
23
|
-
src/character-set.h
|
|
24
|
-
src/infra.h
|
|
25
|
-
src/parse.h
|
|
26
|
-
src/percent-encode.h
|
|
27
|
-
src/serialize.h
|
|
28
|
-
src/type.h
|
|
29
29
|
src/url.c
|
|
30
30
|
)
|
|
31
31
|
|
|
@@ -72,6 +72,8 @@ install(TARGETS url_shared url_static)
|
|
|
72
72
|
|
|
73
73
|
install(FILES include/url.h DESTINATION include)
|
|
74
74
|
|
|
75
|
+
install(DIRECTORY include/url DESTINATION include)
|
|
76
|
+
|
|
75
77
|
if(PROJECT_IS_TOP_LEVEL)
|
|
76
78
|
enable_testing()
|
|
77
79
|
add_subdirectory(bench)
|
|
@@ -12,7 +12,7 @@ extern "C" {
|
|
|
12
12
|
typedef struct url_s url_t;
|
|
13
13
|
typedef uint32_t url_component_t;
|
|
14
14
|
|
|
15
|
-
|
|
15
|
+
#define url_component_unset ((url_component_t) - 1);
|
|
16
16
|
|
|
17
17
|
enum {
|
|
18
18
|
url_has_opaque_path = 0x1,
|
|
@@ -64,41 +64,81 @@ struct url_s {
|
|
|
64
64
|
} components;
|
|
65
65
|
};
|
|
66
66
|
|
|
67
|
-
void
|
|
68
|
-
url_init (url_t *url)
|
|
67
|
+
inline void
|
|
68
|
+
url_init (url_t *url) {
|
|
69
|
+
url->flags = 0;
|
|
70
|
+
url->type = url_type_opaque;
|
|
71
|
+
|
|
72
|
+
url->components.scheme_end = 0;
|
|
73
|
+
url->components.username_end = 0;
|
|
74
|
+
url->components.host_start = 0;
|
|
75
|
+
url->components.host_end = 0;
|
|
76
|
+
url->components.port = url_component_unset;
|
|
77
|
+
url->components.path_start = 0;
|
|
78
|
+
url->components.query_start = url_component_unset;
|
|
79
|
+
url->components.fragment_start = url_component_unset;
|
|
80
|
+
|
|
81
|
+
utf8_string_init(&url->href);
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
inline void
|
|
85
|
+
url_destroy (url_t *url) {
|
|
86
|
+
utf8_string_destroy(&url->href);
|
|
87
|
+
}
|
|
69
88
|
|
|
70
|
-
|
|
71
|
-
|
|
89
|
+
inline utf8_string_view_t
|
|
90
|
+
url_get_href (const url_t *url) {
|
|
91
|
+
return utf8_string_substring(&url->href, 0, url->href.len);
|
|
92
|
+
}
|
|
72
93
|
|
|
73
|
-
|
|
74
|
-
|
|
94
|
+
inline utf8_string_view_t
|
|
95
|
+
url_get_scheme (const url_t *url) {
|
|
96
|
+
return utf8_string_substring(&url->href, 0, url->components.scheme_end);
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
inline utf8_string_view_t
|
|
100
|
+
url_get_username (const url_t *url) {
|
|
101
|
+
return utf8_string_substring(&url->href, url->components.scheme_end + 3 /* :// */, url->components.username_end);
|
|
102
|
+
}
|
|
75
103
|
|
|
76
|
-
utf8_string_view_t
|
|
77
|
-
|
|
104
|
+
inline utf8_string_view_t
|
|
105
|
+
url_get_password (const url_t *url) {
|
|
106
|
+
return utf8_string_substring(&url->href, url->components.username_end + 1 /* : */, url->components.host_start - 1 /* @ */);
|
|
107
|
+
}
|
|
78
108
|
|
|
79
|
-
utf8_string_view_t
|
|
80
|
-
|
|
109
|
+
inline utf8_string_view_t
|
|
110
|
+
url_get_host (const url_t *url) {
|
|
111
|
+
return utf8_string_substring(&url->href, url->components.host_start, url->components.host_end);
|
|
112
|
+
}
|
|
81
113
|
|
|
82
|
-
utf8_string_view_t
|
|
83
|
-
|
|
114
|
+
inline utf8_string_view_t
|
|
115
|
+
url_get_port (const url_t *url) {
|
|
116
|
+
return utf8_string_substring(&url->href, url->components.host_end + 1 /* : */, url->components.path_start);
|
|
117
|
+
}
|
|
84
118
|
|
|
85
|
-
utf8_string_view_t
|
|
86
|
-
|
|
119
|
+
inline utf8_string_view_t
|
|
120
|
+
url_get_path (const url_t *url) {
|
|
121
|
+
return utf8_string_substring(&url->href, url->components.path_start, url->components.query_start - 1 /* ? */);
|
|
122
|
+
}
|
|
87
123
|
|
|
88
|
-
utf8_string_view_t
|
|
89
|
-
|
|
124
|
+
inline utf8_string_view_t
|
|
125
|
+
url_get_query (const url_t *url) {
|
|
126
|
+
return utf8_string_substring(&url->href, url->components.query_start, url->components.fragment_start - 1 /* # */);
|
|
127
|
+
}
|
|
90
128
|
|
|
91
|
-
utf8_string_view_t
|
|
92
|
-
|
|
129
|
+
inline utf8_string_view_t
|
|
130
|
+
url_get_fragment (const url_t *url) {
|
|
131
|
+
return utf8_string_substring(&url->href, url->components.fragment_start, url->href.len);
|
|
132
|
+
}
|
|
93
133
|
|
|
94
|
-
|
|
95
|
-
url_get_path (const url_t *url);
|
|
134
|
+
#include "url/parse.h"
|
|
96
135
|
|
|
97
|
-
|
|
98
|
-
|
|
136
|
+
inline int
|
|
137
|
+
url_parse (url_t *url, const utf8_t *input, size_t len, const url_t *base) {
|
|
138
|
+
if (len == (size_t) -1) len = strlen((char *) input);
|
|
99
139
|
|
|
100
|
-
|
|
101
|
-
|
|
140
|
+
return url__parse(url, utf8_string_view_init(input, len), base);
|
|
141
|
+
}
|
|
102
142
|
|
|
103
143
|
#ifdef __cplusplus
|
|
104
144
|
}
|
package/vendor/liburl/src/url.c
CHANGED
|
@@ -4,78 +4,39 @@
|
|
|
4
4
|
#include <utf/string.h>
|
|
5
5
|
|
|
6
6
|
#include "../include/url.h"
|
|
7
|
-
#include "parse.h"
|
|
8
7
|
|
|
9
|
-
void
|
|
10
|
-
url_init (url_t *url)
|
|
11
|
-
url->flags = 0;
|
|
12
|
-
url->type = url_type_opaque;
|
|
8
|
+
extern void
|
|
9
|
+
url_init (url_t *url);
|
|
13
10
|
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
url->components.host_start = 0;
|
|
17
|
-
url->components.host_end = 0;
|
|
18
|
-
url->components.port = url_component_unset;
|
|
19
|
-
url->components.path_start = 0;
|
|
20
|
-
url->components.query_start = url_component_unset;
|
|
21
|
-
url->components.fragment_start = url_component_unset;
|
|
11
|
+
extern void
|
|
12
|
+
url_destroy (url_t *url);
|
|
22
13
|
|
|
23
|
-
|
|
24
|
-
|
|
14
|
+
extern utf8_string_view_t
|
|
15
|
+
url_get_href (const url_t *url);
|
|
25
16
|
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
utf8_string_destroy(&url->href);
|
|
29
|
-
}
|
|
17
|
+
extern utf8_string_view_t
|
|
18
|
+
url_get_scheme (const url_t *url);
|
|
30
19
|
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
if (len == (size_t) -1) len = strlen((char *) input);
|
|
20
|
+
extern utf8_string_view_t
|
|
21
|
+
url_get_username (const url_t *url);
|
|
34
22
|
|
|
35
|
-
|
|
36
|
-
|
|
23
|
+
extern utf8_string_view_t
|
|
24
|
+
url_get_password (const url_t *url);
|
|
37
25
|
|
|
38
|
-
utf8_string_view_t
|
|
39
|
-
|
|
40
|
-
return utf8_string_substring(&url->href, 0, url->href.len);
|
|
41
|
-
}
|
|
26
|
+
extern utf8_string_view_t
|
|
27
|
+
url_get_host (const url_t *url);
|
|
42
28
|
|
|
43
|
-
utf8_string_view_t
|
|
44
|
-
|
|
45
|
-
return utf8_string_substring(&url->href, 0, url->components.scheme_end);
|
|
46
|
-
}
|
|
29
|
+
extern utf8_string_view_t
|
|
30
|
+
url_get_port (const url_t *url);
|
|
47
31
|
|
|
48
|
-
utf8_string_view_t
|
|
49
|
-
|
|
50
|
-
return utf8_string_substring(&url->href, url->components.scheme_end + 3 /* :// */, url->components.username_end);
|
|
51
|
-
}
|
|
32
|
+
extern utf8_string_view_t
|
|
33
|
+
url_get_path (const url_t *url);
|
|
52
34
|
|
|
53
|
-
utf8_string_view_t
|
|
54
|
-
|
|
55
|
-
return utf8_string_substring(&url->href, url->components.username_end + 1 /* : */, url->components.host_start - 1 /* @ */);
|
|
56
|
-
}
|
|
35
|
+
extern utf8_string_view_t
|
|
36
|
+
url_get_query (const url_t *url);
|
|
57
37
|
|
|
58
|
-
utf8_string_view_t
|
|
59
|
-
|
|
60
|
-
return utf8_string_substring(&url->href, url->components.host_start, url->components.host_end);
|
|
61
|
-
}
|
|
38
|
+
extern utf8_string_view_t
|
|
39
|
+
url_get_fragment (const url_t *url);
|
|
62
40
|
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
return utf8_string_substring(&url->href, url->components.host_end + 1 /* : */, url->components.path_start);
|
|
66
|
-
}
|
|
67
|
-
|
|
68
|
-
utf8_string_view_t
|
|
69
|
-
url_get_path (const url_t *url) {
|
|
70
|
-
return utf8_string_substring(&url->href, url->components.path_start, url->components.query_start - 1 /* ? */);
|
|
71
|
-
}
|
|
72
|
-
|
|
73
|
-
utf8_string_view_t
|
|
74
|
-
url_get_query (const url_t *url) {
|
|
75
|
-
return utf8_string_substring(&url->href, url->components.query_start, url->components.fragment_start - 1 /* # */);
|
|
76
|
-
}
|
|
77
|
-
|
|
78
|
-
utf8_string_view_t
|
|
79
|
-
url_get_fragment (const url_t *url) {
|
|
80
|
-
return utf8_string_substring(&url->href, url->components.fragment_start, url->href.len);
|
|
81
|
-
}
|
|
41
|
+
extern int
|
|
42
|
+
url_parse (url_t *url, const utf8_t *input, size_t len, const url_t *base);
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|