25 #ifndef _SMING_CORE_NETWORK_URL_H_ 26 #define _SMING_CORE_NETWORK_URL_H_ 29 #include "Http/HttpParams.h" 37 #define URI_SCHEME_MAP(XX) \ 39 XX(HTTP_SECURE, https, 443) \ 40 XX(WEBSOCKET, ws, 80) \ 41 XX(WEBSOCKET_SECURE, wss, 443) \ 42 XX(MQTT, mqtt, 1883) \ 43 XX(MQTT_SECURE, mqtts, 8883) \ 45 XX(SMTP_SECURE, smtps, 465) \ 47 XX(MAIL_TO, mailto, 0) \ 54 #define XX(name, str, port) DECLARE_FSTR(URI_SCHEME_##name) 71 Url(
const Url& url) =
default;
89 const String& path =
nullptr,
const String& query =
nullptr,
const String& fragment =
nullptr)
90 :
Scheme(scheme), User(user), Password(password),
Host(host),
Port(port),
Path(path), Query(query),
110 *
this =
String(urlString);
Url & operator=(const char *urlString)
Copy assignment operator, for C-style strings.
Definition: Url.h:108
Class to manage URL instance.
Definition: Url.h:66
Definition: HttpParams.h:32
String Scheme
without ":" and "//"
Definition: Url.h:170
The string class.
Definition: WString.h:104
String Path
with leading "/"
Definition: Url.h:175
Url URL SMING_DEPRECATED
Definition: Url.h:180
Provides formatted output to stream.
Definition: Print.h:31
#define XX(name, str, port)
Common URI scheme strings.
Definition: Url.h:54
static int getDefaultPort(const String &scheme)
Obtain the default port for a given scheme.
Url(const char *urlString)
Construct a URL object from a regular null-terminated escaped string Escaped URL.
Definition: Url.h:84
int getPort() const
Obtain the actual port number to be used.
Definition: Url.h:133
void debugPrintTo(Print &p) const
Printable output for debugging.
Url & operator=(String urlString)
Copy assignment operator.
String getRelativePath() const
Get path without leading separator.
Definition: Url.h:147
Url(const String &urlString)
Construct a URL object from a regular escaped string Escaped URL.
Definition: Url.h:76
String toString() const
Get escaped URL.
String getPathWithQuery() const
Get path with any query parameters attached.
int Port
Undefined by default.
Definition: Url.h:174
String getFileName() const
Obtain the filename part of the URL path.
String getHostWithPort() const
Get hostname+port part of URL string.
String Fragment
Without '#'.
Definition: Url.h:177
String Host
hostname or IP address
Definition: Url.h:173