bare-url 2.0.8 → 2.0.9
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/CMakeLists.txt +3 -7
- package/package.json +3 -6
- 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/win32-arm64/bare-url.bare +0 -0
- package/prebuilds/win32-x64/bare-url.bare +0 -0
- package/vendor/liburl/CMakeLists.txt +0 -81
- package/vendor/liburl/include/url/character-set.h +0 -41
- package/vendor/liburl/include/url/idna.h +0 -14
- package/vendor/liburl/include/url/infra.h +0 -141
- package/vendor/liburl/include/url/parse.h +0 -1406
- package/vendor/liburl/include/url/percent-encode.h +0 -567
- package/vendor/liburl/include/url/punycode.h +0 -21
- package/vendor/liburl/include/url/serialize.h +0 -91
- package/vendor/liburl/include/url/type.h +0 -61
- package/vendor/liburl/include/url.h +0 -147
- package/vendor/liburl/src/url.c +0 -42
- package/vendor/libutf/CMakeLists.txt +0 -93
- package/vendor/libutf/include/utf/string.h +0 -786
- package/vendor/libutf/include/utf.h +0 -132
- package/vendor/libutf/src/ascii/validate.c +0 -47
- package/vendor/libutf/src/endianness.c +0 -19
- package/vendor/libutf/src/endianness.h +0 -54
- package/vendor/libutf/src/latin1/convert-to-utf16.c +0 -37
- package/vendor/libutf/src/latin1/convert-to-utf32.c +0 -34
- package/vendor/libutf/src/latin1/convert-to-utf8.c +0 -58
- package/vendor/libutf/src/latin1/length-from-utf16.c +0 -26
- package/vendor/libutf/src/latin1/length-from-utf32.c +0 -26
- package/vendor/libutf/src/latin1/length-from-utf8.c +0 -34
- package/vendor/libutf/src/utf16/convert-to-latin1.c +0 -41
- package/vendor/libutf/src/utf16/convert-to-utf32.c +0 -56
- package/vendor/libutf/src/utf16/convert-to-utf8.c +0 -75
- package/vendor/libutf/src/utf16/length-from-latin1.c +0 -26
- package/vendor/libutf/src/utf16/length-from-utf32.c +0 -33
- package/vendor/libutf/src/utf16/length-from-utf8.c +0 -38
- package/vendor/libutf/src/utf16/validate.c +0 -53
- package/vendor/libutf/src/utf32/convert-to-latin1.c +0 -40
- package/vendor/libutf/src/utf32/convert-to-utf16.c +0 -56
- package/vendor/libutf/src/utf32/convert-to-utf8.c +0 -71
- package/vendor/libutf/src/utf32/length-from-latin1.c +0 -26
- package/vendor/libutf/src/utf32/length-from-utf16.c +0 -35
- package/vendor/libutf/src/utf32/length-from-utf8.c +0 -35
- package/vendor/libutf/src/utf32/validate.c +0 -39
- package/vendor/libutf/src/utf8/convert-to-latin1.c +0 -70
- package/vendor/libutf/src/utf8/convert-to-utf16.c +0 -95
- package/vendor/libutf/src/utf8/convert-to-utf32.c +0 -110
- package/vendor/libutf/src/utf8/length-from-latin1.c +0 -32
- package/vendor/libutf/src/utf8/length-from-utf16.c +0 -44
- package/vendor/libutf/src/utf8/length-from-utf32.c +0 -35
- package/vendor/libutf/src/utf8/string.c +0 -149
- package/vendor/libutf/src/utf8/validate.c +0 -107
|
@@ -1,61 +0,0 @@
|
|
|
1
|
-
#ifndef URL_TYPE_H
|
|
2
|
-
#define URL_TYPE_H
|
|
3
|
-
|
|
4
|
-
#include <utf.h>
|
|
5
|
-
#include <utf/string.h>
|
|
6
|
-
|
|
7
|
-
#include "../url.h"
|
|
8
|
-
|
|
9
|
-
static inline url_type_t
|
|
10
|
-
url__type (const utf8_string_view_t scheme) {
|
|
11
|
-
size_t len = scheme.len;
|
|
12
|
-
const utf8_t *data = scheme.data;
|
|
13
|
-
|
|
14
|
-
// ftp | file
|
|
15
|
-
if (len >= 3 && data[0] == 'f') {
|
|
16
|
-
if (len == 3 && data[1] == 't' && data[2] == 'p') return url_type_ftp;
|
|
17
|
-
if (len == 4 && data[1] == 'i' && data[2] == 'l' && data[3] == 'e') return url_type_file;
|
|
18
|
-
return url_type_opaque;
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
// http(s)
|
|
22
|
-
if (len >= 4 && data[0] == 'h' && data[1] == 't' && data[2] == 't' && data[3] == 'p') {
|
|
23
|
-
if (len == 4) return url_type_http;
|
|
24
|
-
if (len == 5 && data[4] == 's') return url_type_https;
|
|
25
|
-
return url_type_opaque;
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
// ws(s)
|
|
29
|
-
if (len >= 2 && data[0] == 'w' && data[1] == 's') {
|
|
30
|
-
if (len == 2) return url_type_ws;
|
|
31
|
-
if (len == 3 && data[2] == 's') return url_type_https;
|
|
32
|
-
return url_type_opaque;
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
return url_type_opaque;
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
// https://url.spec.whatwg.org/#default-port
|
|
39
|
-
static inline uint32_t
|
|
40
|
-
url__default_port (url_type_t type) {
|
|
41
|
-
switch (type) {
|
|
42
|
-
case url_type_ftp:
|
|
43
|
-
return 21;
|
|
44
|
-
case url_type_http:
|
|
45
|
-
case url_type_ws:
|
|
46
|
-
return 80;
|
|
47
|
-
case url_type_https:
|
|
48
|
-
case url_type_wss:
|
|
49
|
-
return 443;
|
|
50
|
-
default:
|
|
51
|
-
return (uint32_t) -1;
|
|
52
|
-
}
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
// https://url.spec.whatwg.org/#is-special
|
|
56
|
-
static inline bool
|
|
57
|
-
url__is_special (const url_t *url) {
|
|
58
|
-
return url->type != url_type_opaque;
|
|
59
|
-
}
|
|
60
|
-
|
|
61
|
-
#endif // URL_TYPE_H
|
|
@@ -1,147 +0,0 @@
|
|
|
1
|
-
#ifndef URL_H
|
|
2
|
-
#define URL_H
|
|
3
|
-
|
|
4
|
-
#ifdef __cplusplus
|
|
5
|
-
extern "C" {
|
|
6
|
-
#endif
|
|
7
|
-
|
|
8
|
-
#include <stddef.h>
|
|
9
|
-
#include <utf.h>
|
|
10
|
-
#include <utf/string.h>
|
|
11
|
-
|
|
12
|
-
typedef struct url_s url_t;
|
|
13
|
-
typedef uint32_t url_component_t;
|
|
14
|
-
|
|
15
|
-
#define url_component_unset ((url_component_t) - 1);
|
|
16
|
-
|
|
17
|
-
enum {
|
|
18
|
-
url_has_opaque_path = 0x1,
|
|
19
|
-
};
|
|
20
|
-
|
|
21
|
-
typedef enum {
|
|
22
|
-
url_type_opaque,
|
|
23
|
-
url_type_http,
|
|
24
|
-
url_type_https,
|
|
25
|
-
url_type_ws,
|
|
26
|
-
url_type_wss,
|
|
27
|
-
url_type_ftp,
|
|
28
|
-
url_type_file,
|
|
29
|
-
} url_type_t;
|
|
30
|
-
|
|
31
|
-
struct url_s {
|
|
32
|
-
uint8_t flags;
|
|
33
|
-
|
|
34
|
-
url_type_t type;
|
|
35
|
-
|
|
36
|
-
/**
|
|
37
|
-
* The normalized serialization of the URL. This is used as the canonical
|
|
38
|
-
* representation to both minimize memory allocation and also provide fast,
|
|
39
|
-
* immutable views over the various URL components.
|
|
40
|
-
*/
|
|
41
|
-
utf8_string_t href;
|
|
42
|
-
|
|
43
|
-
/**
|
|
44
|
-
* https://user:pass@example.com:1234/foo/bar?baz#quux
|
|
45
|
-
* | | | |^^^^| | |
|
|
46
|
-
* | | | || | | `---- fragment_start
|
|
47
|
-
* | | | || | `-------- query_start
|
|
48
|
-
* | | | || `----------------- path_start
|
|
49
|
-
* | | | |`--------------------- port
|
|
50
|
-
* | | | `---------------------- host_end
|
|
51
|
-
* | | `--------------------------------- host_start
|
|
52
|
-
* | `--------------------------------------- username_end
|
|
53
|
-
* `---------------------------------------------- scheme_end
|
|
54
|
-
*/
|
|
55
|
-
struct {
|
|
56
|
-
url_component_t scheme_end;
|
|
57
|
-
url_component_t username_end;
|
|
58
|
-
url_component_t host_start;
|
|
59
|
-
url_component_t host_end;
|
|
60
|
-
url_component_t port;
|
|
61
|
-
url_component_t path_start;
|
|
62
|
-
url_component_t query_start;
|
|
63
|
-
url_component_t fragment_start;
|
|
64
|
-
} components;
|
|
65
|
-
};
|
|
66
|
-
|
|
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
|
-
}
|
|
88
|
-
|
|
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
|
-
}
|
|
93
|
-
|
|
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
|
-
}
|
|
103
|
-
|
|
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
|
-
}
|
|
108
|
-
|
|
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
|
-
}
|
|
113
|
-
|
|
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
|
-
}
|
|
118
|
-
|
|
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
|
-
}
|
|
123
|
-
|
|
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
|
-
}
|
|
128
|
-
|
|
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
|
-
}
|
|
133
|
-
|
|
134
|
-
#include "url/parse.h"
|
|
135
|
-
|
|
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);
|
|
139
|
-
|
|
140
|
-
return url__parse(url, utf8_string_view_init(input, len), base);
|
|
141
|
-
}
|
|
142
|
-
|
|
143
|
-
#ifdef __cplusplus
|
|
144
|
-
}
|
|
145
|
-
#endif
|
|
146
|
-
|
|
147
|
-
#endif // URL_H
|
package/vendor/liburl/src/url.c
DELETED
|
@@ -1,42 +0,0 @@
|
|
|
1
|
-
#include <stddef.h>
|
|
2
|
-
#include <string.h>
|
|
3
|
-
#include <utf.h>
|
|
4
|
-
#include <utf/string.h>
|
|
5
|
-
|
|
6
|
-
#include "../include/url.h"
|
|
7
|
-
|
|
8
|
-
extern void
|
|
9
|
-
url_init (url_t *url);
|
|
10
|
-
|
|
11
|
-
extern void
|
|
12
|
-
url_destroy (url_t *url);
|
|
13
|
-
|
|
14
|
-
extern utf8_string_view_t
|
|
15
|
-
url_get_href (const url_t *url);
|
|
16
|
-
|
|
17
|
-
extern utf8_string_view_t
|
|
18
|
-
url_get_scheme (const url_t *url);
|
|
19
|
-
|
|
20
|
-
extern utf8_string_view_t
|
|
21
|
-
url_get_username (const url_t *url);
|
|
22
|
-
|
|
23
|
-
extern utf8_string_view_t
|
|
24
|
-
url_get_password (const url_t *url);
|
|
25
|
-
|
|
26
|
-
extern utf8_string_view_t
|
|
27
|
-
url_get_host (const url_t *url);
|
|
28
|
-
|
|
29
|
-
extern utf8_string_view_t
|
|
30
|
-
url_get_port (const url_t *url);
|
|
31
|
-
|
|
32
|
-
extern utf8_string_view_t
|
|
33
|
-
url_get_path (const url_t *url);
|
|
34
|
-
|
|
35
|
-
extern utf8_string_view_t
|
|
36
|
-
url_get_query (const url_t *url);
|
|
37
|
-
|
|
38
|
-
extern utf8_string_view_t
|
|
39
|
-
url_get_fragment (const url_t *url);
|
|
40
|
-
|
|
41
|
-
extern int
|
|
42
|
-
url_parse (url_t *url, const utf8_t *input, size_t len, const url_t *base);
|
|
@@ -1,93 +0,0 @@
|
|
|
1
|
-
cmake_minimum_required(VERSION 3.25)
|
|
2
|
-
|
|
3
|
-
project(utf C)
|
|
4
|
-
|
|
5
|
-
add_library(utf OBJECT)
|
|
6
|
-
|
|
7
|
-
set_target_properties(
|
|
8
|
-
utf
|
|
9
|
-
PROPERTIES
|
|
10
|
-
C_STANDARD 99
|
|
11
|
-
POSITION_INDEPENDENT_CODE ON
|
|
12
|
-
)
|
|
13
|
-
|
|
14
|
-
target_sources(
|
|
15
|
-
utf
|
|
16
|
-
INTERFACE
|
|
17
|
-
include/utf.h
|
|
18
|
-
include/utf/string.h
|
|
19
|
-
PRIVATE
|
|
20
|
-
src/endianness.c
|
|
21
|
-
src/endianness.h
|
|
22
|
-
src/ascii/validate.c
|
|
23
|
-
src/utf8/convert-to-latin1.c
|
|
24
|
-
src/utf8/convert-to-utf16.c
|
|
25
|
-
src/utf8/convert-to-utf32.c
|
|
26
|
-
src/utf8/length-from-latin1.c
|
|
27
|
-
src/utf8/length-from-utf16.c
|
|
28
|
-
src/utf8/length-from-utf32.c
|
|
29
|
-
src/utf8/string.c
|
|
30
|
-
src/utf8/validate.c
|
|
31
|
-
src/utf16/convert-to-latin1.c
|
|
32
|
-
src/utf16/convert-to-utf8.c
|
|
33
|
-
src/utf16/convert-to-utf32.c
|
|
34
|
-
src/utf16/length-from-latin1.c
|
|
35
|
-
src/utf16/length-from-utf8.c
|
|
36
|
-
src/utf16/length-from-utf32.c
|
|
37
|
-
src/utf16/validate.c
|
|
38
|
-
src/utf32/convert-to-latin1.c
|
|
39
|
-
src/utf32/convert-to-utf8.c
|
|
40
|
-
src/utf32/convert-to-utf16.c
|
|
41
|
-
src/utf32/length-from-latin1.c
|
|
42
|
-
src/utf32/length-from-utf8.c
|
|
43
|
-
src/utf32/length-from-utf16.c
|
|
44
|
-
src/utf32/validate.c
|
|
45
|
-
)
|
|
46
|
-
|
|
47
|
-
target_include_directories(
|
|
48
|
-
utf
|
|
49
|
-
PUBLIC
|
|
50
|
-
include
|
|
51
|
-
)
|
|
52
|
-
|
|
53
|
-
add_library(utf_shared SHARED)
|
|
54
|
-
|
|
55
|
-
set_target_properties(
|
|
56
|
-
utf_shared
|
|
57
|
-
PROPERTIES
|
|
58
|
-
OUTPUT_NAME utf
|
|
59
|
-
WINDOWS_EXPORT_ALL_SYMBOLS ON
|
|
60
|
-
)
|
|
61
|
-
|
|
62
|
-
target_link_libraries(
|
|
63
|
-
utf_shared
|
|
64
|
-
PUBLIC
|
|
65
|
-
utf
|
|
66
|
-
)
|
|
67
|
-
|
|
68
|
-
add_library(utf_static STATIC)
|
|
69
|
-
|
|
70
|
-
set_target_properties(
|
|
71
|
-
utf_static
|
|
72
|
-
PROPERTIES
|
|
73
|
-
OUTPUT_NAME utf
|
|
74
|
-
PREFIX lib
|
|
75
|
-
)
|
|
76
|
-
|
|
77
|
-
target_link_libraries(
|
|
78
|
-
utf_static
|
|
79
|
-
PUBLIC
|
|
80
|
-
utf
|
|
81
|
-
)
|
|
82
|
-
|
|
83
|
-
install(TARGETS utf_shared utf_static)
|
|
84
|
-
|
|
85
|
-
install(FILES include/utf.h DESTINATION include)
|
|
86
|
-
|
|
87
|
-
install(DIRECTORY include/utf DESTINATION include)
|
|
88
|
-
|
|
89
|
-
if(PROJECT_IS_TOP_LEVEL)
|
|
90
|
-
enable_testing()
|
|
91
|
-
|
|
92
|
-
add_subdirectory(test)
|
|
93
|
-
endif()
|