| line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
|
1
|
|
|
|
|
|
|
MODE: INLINE |
|
2
|
|
|
|
|
|
|
|
|
3
|
|
|
|
|
|
|
static U32 uxs_hashval; |
|
4
|
|
|
|
|
|
|
|
|
5
|
|
|
|
|
|
|
MODULE = URI::XS PACKAGE = URI::XS |
|
6
|
|
|
|
|
|
|
PROTOTYPES: DISABLE |
|
7
|
|
|
|
|
|
|
|
|
8
|
|
|
|
|
|
|
BOOT { |
|
9
|
26
|
50
|
|
|
|
|
Stash stash(__PACKAGE__); |
|
10
|
13
|
|
|
|
|
|
PERL_HASH(uxs_hashval, "URI::XS", 7); |
|
11
|
|
|
|
|
|
|
|
|
12
|
91
|
50
|
|
|
|
|
xs::exp::create_constants(stash, { |
|
|
|
50
|
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
|
100
|
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
{"ALLOW_SUFFIX_REFERENCE", URI::Flags::allow_suffix_reference}, |
|
14
|
|
|
|
|
|
|
{"QUERY_PARAM_SEMICOLON", URI::Flags::query_param_semicolon}, |
|
15
|
|
|
|
|
|
|
{"ALLOW_EXTENDED_CHARS", URI::Flags::allow_extended_chars}, |
|
16
|
|
|
|
|
|
|
|
|
17
|
|
|
|
|
|
|
// deprecated names |
|
18
|
|
|
|
|
|
|
{"ALLOW_LEADING_AUTHORITY", URI::Flags::allow_suffix_reference}, |
|
19
|
|
|
|
|
|
|
{"PARAM_DELIM_SEMICOLON", URI::Flags::query_param_semicolon}, |
|
20
|
78
|
50
|
|
|
|
|
}); |
|
21
|
13
|
50
|
|
|
|
|
xs::exp::autoexport(stash); |
|
|
|
50
|
|
|
|
|
|
|
22
|
|
|
|
|
|
|
} |
|
23
|
|
|
|
|
|
|
|
|
24
|
|
|
|
|
|
|
URI* new (SV* CLASS, string url = string(), int flags = 0) { |
|
25
|
192
|
|
|
|
|
|
PROTO = CLASS; |
|
26
|
96
|
50
|
|
|
|
|
RETVAL = make_backref(url, flags); |
|
27
|
96
|
50
|
|
|
|
|
} |
|
28
|
96
|
50
|
|
|
|
|
|
|
29
|
|
|
|
|
|
|
string URI::url (SV* newval = NULL, int flags = 0) { |
|
30
|
59
|
50
|
|
|
|
|
if (newval) { |
|
31
|
0
|
0
|
|
|
|
|
THIS->assign(SvOK(newval) ? xs::in(newval) : "", flags); |
|
|
|
0
|
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
32
|
0
|
|
|
|
|
|
XSRETURN_UNDEF; |
|
33
|
|
|
|
|
|
|
} |
|
34
|
59
|
50
|
|
|
|
|
RETVAL = THIS->to_string(); |
|
|
|
50
|
|
|
|
|
|
|
35
|
|
|
|
|
|
|
} |
|
36
|
|
|
|
|
|
|
|
|
37
|
|
|
|
|
|
|
string URI::scheme (SV* newval = NULL) : ALIAS(proto=1, protocol=2) { |
|
38
|
79
|
100
|
|
|
|
|
if (newval) { |
|
39
|
12
|
50
|
|
|
|
|
THIS->scheme(SvOK(newval) ? xs::in(newval) : ""); |
|
|
|
0
|
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
|
100
|
|
|
|
|
|
|
40
|
7
|
|
|
|
|
|
XSRETURN_UNDEF; |
|
41
|
|
|
|
|
|
|
} |
|
42
|
67
|
50
|
|
|
|
|
RETVAL = THIS->scheme(); |
|
43
|
|
|
|
|
|
|
PERL_UNUSED_VAR(ix); |
|
44
|
|
|
|
|
|
|
} |
|
45
|
|
|
|
|
|
|
|
|
46
|
|
|
|
|
|
|
string URI::user_info (SV* newval = NULL) { |
|
47
|
59
|
50
|
|
|
|
|
if (newval) { |
|
48
|
0
|
0
|
|
|
|
|
THIS->user_info(SvOK(newval) ? xs::in(newval) : ""); |
|
|
|
0
|
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
49
|
0
|
|
|
|
|
|
XSRETURN_UNDEF; |
|
50
|
|
|
|
|
|
|
} |
|
51
|
59
|
50
|
|
|
|
|
RETVAL = THIS->user_info(); |
|
52
|
|
|
|
|
|
|
} |
|
53
|
|
|
|
|
|
|
|
|
54
|
|
|
|
|
|
|
string URI::host (SV* newval = NULL) { |
|
55
|
67
|
100
|
|
|
|
|
if (newval) { |
|
56
|
3
|
50
|
|
|
|
|
THIS->host(SvOK(newval) ? xs::in(newval) : ""); |
|
|
|
0
|
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
57
|
3
|
|
|
|
|
|
XSRETURN_UNDEF; |
|
58
|
|
|
|
|
|
|
} |
|
59
|
64
|
50
|
|
|
|
|
RETVAL = THIS->host(); |
|
60
|
|
|
|
|
|
|
} |
|
61
|
|
|
|
|
|
|
|
|
62
|
|
|
|
|
|
|
int URI::port (SV* newval = NULL) { |
|
63
|
19
|
100
|
|
|
|
|
if (newval) { |
|
64
|
2
|
50
|
|
|
|
|
THIS->port(SvIV(newval)); |
|
|
|
0
|
|
|
|
|
|
|
65
|
19
|
|
|
|
|
|
XSRETURN_UNDEF; |
|
66
|
|
|
|
|
|
|
} |
|
67
|
17
|
|
|
|
|
|
RETVAL = THIS->port(); |
|
68
|
|
|
|
|
|
|
} |
|
69
|
|
|
|
|
|
|
|
|
70
|
|
|
|
|
|
|
string URI::path (SV* newval = NULL) { |
|
71
|
65
|
100
|
|
|
|
|
if (newval) { |
|
72
|
2
|
50
|
|
|
|
|
THIS->path(SvOK(newval) ? xs::in(newval) : ""); |
|
|
|
0
|
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
73
|
2
|
|
|
|
|
|
XSRETURN_UNDEF; |
|
74
|
|
|
|
|
|
|
} |
|
75
|
63
|
50
|
|
|
|
|
RETVAL = THIS->path(); |
|
76
|
|
|
|
|
|
|
} |
|
77
|
|
|
|
|
|
|
|
|
78
|
0
|
0
|
|
|
|
|
string URI::path_info () |
|
|
|
0
|
|
|
|
|
|
|
79
|
|
|
|
|
|
|
|
|
80
|
|
|
|
|
|
|
string URI::query_string (SV* newval = NULL) { |
|
81
|
76
|
100
|
|
|
|
|
if (newval) { |
|
82
|
4
|
50
|
|
|
|
|
THIS->query_string(SvOK(newval) ? xs::in(newval) : ""); |
|
|
|
0
|
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
83
|
4
|
|
|
|
|
|
XSRETURN_UNDEF; |
|
84
|
|
|
|
|
|
|
} |
|
85
|
72
|
50
|
|
|
|
|
RETVAL = THIS->query_string(); |
|
|
|
50
|
|
|
|
|
|
|
86
|
|
|
|
|
|
|
} |
|
87
|
|
|
|
|
|
|
|
|
88
|
|
|
|
|
|
|
string URI::raw_query (SV* newval = NULL) { |
|
89
|
1
|
50
|
|
|
|
|
if (newval) { |
|
90
|
0
|
0
|
|
|
|
|
THIS->raw_query(SvOK(newval) ? xs::in(newval) : ""); |
|
|
|
0
|
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
91
|
0
|
|
|
|
|
|
XSRETURN_UNDEF; |
|
92
|
|
|
|
|
|
|
} |
|
93
|
1
|
50
|
|
|
|
|
RETVAL = THIS->raw_query(); |
|
|
|
50
|
|
|
|
|
|
|
94
|
|
|
|
|
|
|
} |
|
95
|
|
|
|
|
|
|
|
|
96
|
|
|
|
|
|
|
Ref URI::query (...) { |
|
97
|
8
|
100
|
|
|
|
|
if (items > 1) { |
|
98
|
2
|
50
|
|
|
|
|
add_query_args(THIS, MARK+2, items-1, true); |
|
99
|
2
|
|
|
|
|
|
XSRETURN_UNDEF; |
|
100
|
|
|
|
|
|
|
} |
|
101
|
6
|
50
|
|
|
|
|
auto data = data_get(ST(0)); |
|
102
|
6
|
50
|
|
|
|
|
RETVAL = data->query_hash(THIS); |
|
103
|
|
|
|
|
|
|
} |
|
104
|
|
|
|
|
|
|
|
|
105
|
|
|
|
|
|
|
void URI::add_query (...) { |
|
106
|
3
|
|
|
|
|
|
add_query_args(THIS, MARK+2, items-1); |
|
107
|
|
|
|
|
|
|
} |
|
108
|
|
|
|
|
|
|
|
|
109
|
|
|
|
|
|
|
string URI::param (string_view name, SV* val = NULL) : ALIAS(multiparam = 1) { |
|
110
|
17
|
100
|
|
|
|
|
if (val) { |
|
111
|
1
|
50
|
|
|
|
|
add_param(THIS, string(name), val, true); |
|
|
|
50
|
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
112
|
1
|
|
|
|
|
|
XSRETURN_UNDEF; |
|
113
|
|
|
|
|
|
|
} |
|
114
|
16
|
100
|
|
|
|
|
if (ix == 0) { // param method |
|
115
|
13
|
50
|
|
|
|
|
auto it = THIS->query().find(name); |
|
|
|
50
|
|
|
|
|
|
|
116
|
13
|
50
|
|
|
|
|
if (it == THIS->query().cend()) XSRETURN_UNDEF; |
|
|
|
100
|
|
|
|
|
|
|
117
|
12
|
50
|
|
|
|
|
RETVAL = it->second; |
|
118
|
|
|
|
|
|
|
} else { // multiparam method |
|
119
|
3
|
50
|
|
|
|
|
size_t nvals = THIS->query().count(name); |
|
|
|
50
|
|
|
|
|
|
|
120
|
3
|
|
|
|
|
|
switch (nvals) { |
|
121
|
|
|
|
|
|
|
case 0: |
|
122
|
3
|
|
|
|
|
|
XSRETURN_EMPTY; break; |
|
123
|
|
|
|
|
|
|
case 1: |
|
124
|
1
|
50
|
|
|
|
|
RETVAL = THIS->query().find(name)->second; break; |
|
|
|
50
|
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
125
|
|
|
|
|
|
|
default: |
|
126
|
2
|
|
|
|
|
|
SP -= items; |
|
127
|
2
|
50
|
|
|
|
|
EXTEND(SP, (int)nvals); |
|
|
|
50
|
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
128
|
2
|
50
|
|
|
|
|
const auto& query = THIS->query(); |
|
129
|
2
|
50
|
|
|
|
|
auto pair = query.equal_range(name); |
|
130
|
6
|
100
|
|
|
|
|
for (auto it = pair.first; it != pair.second; ++it) mPUSHp(it->second.data(), it->second.length()); |
|
|
|
50
|
|
|
|
|
|
|
131
|
2
|
|
|
|
|
|
XSRETURN(nvals); |
|
132
|
|
|
|
|
|
|
} |
|
133
|
|
|
|
|
|
|
} |
|
134
|
|
|
|
|
|
|
} |
|
135
|
|
|
|
|
|
|
|
|
136
|
|
|
|
|
|
|
int URI::nparam () { |
|
137
|
1
|
50
|
|
|
|
|
RETVAL = THIS->query().size(); |
|
138
|
|
|
|
|
|
|
} |
|
139
|
|
|
|
|
|
|
|
|
140
|
|
|
|
|
|
|
size_t URI::remove_param (string name) { |
|
141
|
0
|
0
|
|
|
|
|
RETVAL = THIS->query().erase(name); |
|
|
|
0
|
|
|
|
|
|
|
142
|
|
|
|
|
|
|
} |
|
143
|
|
|
|
|
|
|
|
|
144
|
|
|
|
|
|
|
string URI::fragment (SV* newval = NULL) : ALIAS(hash=1) { |
|
145
|
122
|
100
|
|
|
|
|
if (newval) { |
|
146
|
2
|
50
|
|
|
|
|
THIS->fragment(SvOK(newval) ? xs::in(newval) : ""); |
|
|
|
0
|
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
147
|
2
|
|
|
|
|
|
XSRETURN_UNDEF; |
|
148
|
|
|
|
|
|
|
} |
|
149
|
120
|
50
|
|
|
|
|
RETVAL = THIS->fragment(); |
|
150
|
|
|
|
|
|
|
PERL_UNUSED_VAR(ix); |
|
151
|
|
|
|
|
|
|
} |
|
152
|
|
|
|
|
|
|
|
|
153
|
|
|
|
|
|
|
string URI::location (SV* newval = NULL) { |
|
154
|
8
|
100
|
|
|
|
|
if (newval) { |
|
155
|
2
|
50
|
|
|
|
|
THIS->location(SvOK(newval) ? xs::in(newval) : ""); |
|
|
|
0
|
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
156
|
2
|
|
|
|
|
|
XSRETURN_UNDEF; |
|
157
|
|
|
|
|
|
|
} |
|
158
|
6
|
50
|
|
|
|
|
RETVAL = THIS->location(); |
|
|
|
50
|
|
|
|
|
|
|
159
|
|
|
|
|
|
|
} |
|
160
|
|
|
|
|
|
|
|
|
161
|
63
|
|
|
|
|
|
uint16_t URI::explicit_port () |
|
162
|
|
|
|
|
|
|
|
|
163
|
0
|
|
|
|
|
|
uint16_t URI::default_port () |
|
164
|
|
|
|
|
|
|
|
|
165
|
2
|
50
|
|
|
|
|
string URI::explicit_location () |
|
|
|
50
|
|
|
|
|
|
|
166
|
|
|
|
|
|
|
|
|
167
|
|
|
|
|
|
|
string URI::relative () : ALIAS(rel=1) { |
|
168
|
2
|
50
|
|
|
|
|
RETVAL = THIS->relative(); |
|
|
|
50
|
|
|
|
|
|
|
169
|
|
|
|
|
|
|
PERL_UNUSED_VAR(ix); |
|
170
|
|
|
|
|
|
|
} |
|
171
|
|
|
|
|
|
|
|
|
172
|
|
|
|
|
|
|
string URI::to_string (...) : ALIAS(as_string=1) { |
|
173
|
243
|
50
|
|
|
|
|
RETVAL = THIS->to_string(); |
|
|
|
50
|
|
|
|
|
|
|
174
|
|
|
|
|
|
|
PERL_UNUSED_VAR(ix); |
|
175
|
|
|
|
|
|
|
} |
|
176
|
|
|
|
|
|
|
|
|
177
|
13
|
|
|
|
|
|
bool URI::secure () |
|
178
|
|
|
|
|
|
|
|
|
179
|
|
|
|
|
|
|
void URI::set (Sv source, int flags = 0) : ALIAS(assign=1) { |
|
180
|
|
|
|
|
|
|
PERL_UNUSED_VAR(ix); |
|
181
|
15
|
100
|
|
|
|
|
if (source.is_string()) THIS->assign(xs::in(source), flags); |
|
|
|
50
|
|
|
|
|
|
|
|
|
100
|
|
|
|
|
|
|
182
|
4
|
50
|
|
|
|
|
else THIS->assign(*xs::in>(source)); |
|
|
|
100
|
|
|
|
|
|
|
183
|
|
|
|
|
|
|
} |
|
184
|
|
|
|
|
|
|
|
|
185
|
|
|
|
|
|
|
bool URI::equals (Sv other, ...) { |
|
186
|
30
|
50
|
|
|
|
|
if (other.is_string()) RETVAL = THIS->to_string() == xs::in(other); |
|
|
|
50
|
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
187
|
|
|
|
|
|
|
else { |
|
188
|
0
|
0
|
|
|
|
|
Object obj = other; |
|
189
|
0
|
0
|
|
|
|
|
if (obj && obj.stash().isa("URI::XS")) RETVAL = THIS->equals(*xs::in(obj)); |
|
|
|
0
|
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
190
|
0
|
|
|
|
|
|
else RETVAL = false; |
|
191
|
|
|
|
|
|
|
} |
|
192
|
|
|
|
|
|
|
} |
|
193
|
|
|
|
|
|
|
|
|
194
|
|
|
|
|
|
|
URISP URI::clone () { |
|
195
|
4
|
|
|
|
|
|
PROTO = Object(ST(0)).stash(); |
|
196
|
2
|
50
|
|
|
|
|
if (dynamic_cast(THIS)) RETVAL = URI::create(*THIS); |
|
|
|
50
|
|
|
|
|
|
|
197
|
2
|
50
|
|
|
|
|
else RETVAL = new URI(*THIS); |
|
|
|
100
|
|
|
|
|
|
|
|
|
100
|
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
198
|
1
|
50
|
|
|
|
|
} |
|
|
|
50
|
|
|
|
|
|
|
199
|
|
|
|
|
|
|
|
|
200
|
|
|
|
|
|
|
void URI::path_segments (...) { |
|
201
|
8
|
100
|
|
|
|
|
if (items > 1) { |
|
202
|
6
|
|
|
|
|
|
std::vector list; |
|
203
|
3
|
50
|
|
|
|
|
list.reserve(items-1); |
|
204
|
10
|
100
|
|
|
|
|
for (I32 i = 1; i < items; ++i) list.push_back(xs::in(ST(i))); |
|
|
|
50
|
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
205
|
3
|
50
|
|
|
|
|
THIS->path_segments(list.cbegin(), list.cend()); |
|
206
|
3
|
|
|
|
|
|
XSRETURN_EMPTY; |
|
207
|
|
|
|
|
|
|
} |
|
208
|
13
|
50
|
|
|
|
|
const std::vector list = THIS->path_segments(); |
|
209
|
5
|
50
|
|
|
|
|
EXTEND(SP, (int)list.size()); |
|
|
|
50
|
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
210
|
11
|
100
|
|
|
|
|
for (auto it = list.begin(); it != list.end(); ++it) mPUSHp(it->data(), it->length()); |
|
|
|
50
|
|
|
|
|
|
|
211
|
|
|
|
|
|
|
} |
|
212
|
|
|
|
|
|
|
|
|
213
|
|
|
|
|
|
|
bool URI::to_bool (...) { |
|
214
|
14
|
50
|
|
|
|
|
RETVAL = THIS->scheme().length() || THIS->host().length() || THIS->path().length() || THIS->query_string().length() || |
|
|
|
50
|
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
215
|
7
|
|
|
|
|
|
THIS->fragment().length(); |
|
216
|
|
|
|
|
|
|
} |
|
217
|
|
|
|
|
|
|
|
|
218
|
|
|
|
|
|
|
string URI::user (SV* newval = NULL) { |
|
219
|
0
|
0
|
|
|
|
|
if (newval) { |
|
220
|
0
|
0
|
|
|
|
|
THIS->user(xs::in(newval)); |
|
|
|
0
|
|
|
|
|
|
|
221
|
0
|
|
|
|
|
|
XSRETURN_UNDEF; |
|
222
|
|
|
|
|
|
|
} |
|
223
|
0
|
0
|
|
|
|
|
RETVAL = THIS->user(); |
|
|
|
0
|
|
|
|
|
|
|
224
|
|
|
|
|
|
|
} |
|
225
|
|
|
|
|
|
|
|
|
226
|
|
|
|
|
|
|
string URI::password (SV* newval = NULL) { |
|
227
|
0
|
0
|
|
|
|
|
if (newval) { |
|
228
|
0
|
0
|
|
|
|
|
THIS->password(xs::in(newval)); |
|
|
|
0
|
|
|
|
|
|
|
229
|
0
|
|
|
|
|
|
XSRETURN_UNDEF; |
|
230
|
|
|
|
|
|
|
} |
|
231
|
0
|
0
|
|
|
|
|
RETVAL = THIS->password(); |
|
|
|
0
|
|
|
|
|
|
|
232
|
|
|
|
|
|
|
} |