FastLED 3.9.15
Loading...
Searching...
No Matches

◆ parseAuthority()

void fl::url::parseAuthority ( fl::string_view auth,
fl::size baseOff )
inlineprivate

Definition at line 194 of file url.h.

194 {
195 fl::size pos = 0;
196
197 // userinfo — everything before '@'
198 fl::size at = auth.find('@');
199 if (at != fl::string_view::npos) {
200 mUserinfo = makeSpan(baseOff + pos, at);
201 pos = at + 1; // skip '@'
202 }
203
204 // host (with IPv6 bracket support) and optional port
205 if (pos < auth.size() && auth[pos] == '[') {
206 // IPv6 literal
207 fl::size closeBracket = auth.find(']', pos);
208 if (closeBracket == fl::string_view::npos) {
209 // Malformed, take rest as host
210 mHost = makeSpan(baseOff + pos, auth.size() - pos);
211 return;
212 }
213 // Include brackets in host
214 mHost = makeSpan(baseOff + pos, closeBracket - pos + 1);
215 pos = closeBracket + 1;
216 if (pos < auth.size() && auth[pos] == ':') {
217 ++pos;
218 mPort = makeSpan(baseOff + pos, auth.size() - pos);
219 }
220 } else {
221 // Regular host — find last ':' that separates host:port
222 fl::size colon = auth.find(':', pos);
223 if (colon != fl::string_view::npos) {
224 mHost = makeSpan(baseOff + pos, colon - pos);
225 fl::size portStart = colon + 1;
226 mPort = makeSpan(baseOff + portStart, auth.size() - portStart);
227 } else {
228 mHost = makeSpan(baseOff + pos, auth.size() - pos);
229 }
230 }
231 }
uint8_t pos
Definition Blur.ino:11
static constexpr fl::size npos
Definition string_view.h:35
constexpr fl::size size() const FL_NOEXCEPT
Definition string_view.h:99
fl::size find(char ch, fl::size pos=0) const FL_NOEXCEPT
Span mUserinfo
Definition url.h:237
static Span makeSpan(fl::size off, fl::size len) FL_NOEXCEPT
Definition url.h:103
Span mPort
Definition url.h:239
Span mHost
Definition url.h:238

References FL_NOEXCEPT, makeSpan(), mHost, mPort, mUserinfo, fl::string_view::npos, and pos.

Referenced by parse().

+ Here is the call graph for this function:
+ Here is the caller graph for this function: