3#include "AudioTools/CoreAudio/AudioBasic/Str.h" 
    4#include "AudioTools/CoreAudio/AudioLogger.h" 
   28  Url(
const char* url) {
 
 
   33  const char* url() { 
return urlStr.
c_str(); }
 
   34  const char* path() { 
return pathStr.
c_str(); }
 
   35  const char* host() { 
return hostStr.
c_str(); }
 
   36  const char* protocol() { 
return protocolStr.
c_str(); }
 
   37  const char* urlRoot() {
 
   38    return urlRootStr.
c_str();
 
   40  int port() { 
return portInt; }
 
   42  bool isSecure() { 
return portInt == 443 || protocolStr.
startsWith(
"https"); }
 
   44  void setUrl(
const char* url) {
 
   45    LOGD(
"setUrl %s", url);
 
   61    int protocolEnd = urlStr.
indexOf(
"://");
 
   62    if (protocolEnd == -1) {
 
   65    protocolStr.
substring(urlStr, 0, protocolEnd);
 
   66    int pathStart = urlStr.
indexOf(
"/", protocolEnd + 4);
 
   67    int portStart = urlStr.
indexOf(
":", protocolEnd + 3);
 
   69    if (pathStart>=0) portStart = portStart < pathStart ? portStart : -1;
 
   70    int hostEnd = portStart != -1 ? portStart : pathStart;
 
   75    hostStr.
substring(urlStr, protocolEnd + 3, hostEnd);
 
   77      portInt = atoi(urlStr.
c_str() + portStart + 1);
 
   95      urlRootStr.
substring(urlStr, 0, pathStart);
 
   97    LOGI(
"url->%s", url());
 
   98    LOGI(
"host->%s", host());
 
   99    LOGI(
"protocol->%s", protocol());
 
  100    LOGI(
"path->%s", path());
 
  101    LOGI(
"port->%d", port());