Numeric port. Returns the explicit port if present, otherwise the well-known default for the scheme (80 for http, 443 for https, etc.).
| 53 | /// Numeric port. Returns the explicit port if present, otherwise the |
| 54 | /// well-known default for the scheme (80 for http, 443 for https, etc.). |
| 55 | fl::u16 port() const FL_NOEXCEPT { |
| 56 | fl::string_view p = port_str(); |
| 57 | if (p.empty()) { |
| 58 | return defaultPort(); |
| 59 | } |
| 60 | fl::u16 result = 0; |
| 61 | for (fl::size i = 0; i < p.size(); ++i) { |
| 62 | result = static_cast<fl::u16>(result * 10 + |
| 63 | static_cast<fl::u16>(p[i] - '0')); |
| 64 | } |
| 65 | return result; |
| 66 | } |
| 67 | |
| 68 | // ---- Whole-URL access ---- |
| 69 | fl::string_view str() const FL_NOEXCEPT { |