21 #include "utl/UtlDefs.h" 22 #include "utl/UtlString.h" 23 #include "utl/UtlRegex.h" 121 Url(
const char* urlString = NULL,
122 UtlBoolean isAddrSpec = FALSE
146 UtlBoolean isAddrSpec = FALSE
152 void toString(UtlString& urlString)
const;
179 void getUrlType(UtlString& urlProtocol)
const;
236 UtlBoolean
getPath(UtlString& path,
237 UtlBoolean getStyle = FALSE
247 void setPath(
const char* path);
320 UtlString& headerName,
321 UtlString& headerValue);
356 UtlBoolean
getHeaderParameters(
int iMaxReturn, UtlString *pNames, UtlString *pValues,
int& iActualReturn);
368 int index = 0)
const;
433 void getUri(UtlString& Uri);
442 static UtlBoolean
isDigitString(
const char* dialedCharacters);
446 int impliedPort = PORT_NONE
517 void parseString(
const char* urlString,
518 UtlBoolean isAddrSpec = FALSE
525 UtlString mDisplayName;
528 UtlBoolean mPasswordSet;
529 UtlString mHostAddress;
533 UtlString mRawUrlParameters;
534 bool parseUrlParameters();
535 UtlDList* mpUrlParameters;
537 UtlString mRawHeaderOrQueryParameters;
538 bool parseHeaderOrQueryParameters();
539 UtlDList* mpHeaderOrQueryParameters;
541 UtlString mRawFieldParameters;
542 bool parseFieldParameters();
543 UtlDList* mpFieldParameters;
545 UtlBoolean mAngleBracketsIncluded;
Scheme getScheme() const
Get the enumerator for the URL scheme type (more convenient than getUrlType).
Definition: Url.cpp:351
https: (RFC 2818)
Definition: Url.h:102
void includeAngleBrackets()
Forces the presence of angle brackets (i.e. <>) in the URL when serialized.
Definition: Url.cpp:1075
void reset()
Clear the contents of this URL.
Definition: Url.cpp:250
void removeFieldParameter(const char *name)
Removes all of the field parameters with the given name.
Definition: Url.cpp:1059
UtlBoolean getPassword(UtlString &userId) const
Get the users password if present in the URL.
Definition: Url.cpp:434
void setScheme(Scheme scheme)
Set the scheme to be used (also see setUrlType).
Definition: Url.cpp:361
Url(const char *urlString=NULL, UtlBoolean isAddrSpec=FALSE)
Default constructor from string.
Definition: Url.cpp:206
void getHostWithPort(UtlString &domain) const
Get the host and port together as a string "host:port".
Definition: Url.cpp:459
UtlBoolean getUrlParameters(int iMaxReturn, UtlString *pNames, UtlString *pValues, int &iActualReturn)
Gets all of the URL parameters and values.
Definition: Url.cpp:598
UtlBoolean getFieldParameter(const char *name, UtlString &value, int index=0) const
Get the named field parameter value.
Definition: Url.cpp:943
UtlBoolean isUserHostPortEqual(const Url &uri, int impliedPort=PORT_NONE) const
Compare two URLs to see if the have the same user, host and port.
Definition: Url.cpp:1562
void removeHeaderParameters()
Removes all of the header parameters.
Definition: Url.cpp:916
void dump()
Debug dump to STDOUT.
Definition: Url.cpp:1168
mailto: (RFC 2368)
Definition: Url.h:105
Url & operator=(const Url &rhs)
Assignment operator.
Definition: Url.cpp:268
void setPath(const char *path)
Set the file path.
Definition: Url.cpp:470
void getDisplayName(UtlString &displayName) const
Get the URL display name if present.
Definition: Url.cpp:390
UtlBoolean isIncludeAngleBracketsSet() const
Are angle brackets explicitly included.
Definition: Url.cpp:1234
void setHostPort(int port)
Set the URL host port.
Definition: Url.cpp:542
const char * schemeName(Scheme scheme)
Get the canonical (lowercase) name constant for a supported Scheme.
Definition: Url.cpp:1629
static UtlBoolean isDigitString(const char *dialedCharacters)
Is string all digits.
Definition: Url.cpp:1226
void removeParameters()
Remove all of the URL, header and field parameters and values.
Definition: Url.cpp:243
void setPassword(const char *userId)
Set the users password in the URL.
Definition: Url.cpp:440
void fromString(const UtlString &urlString, UtlBoolean isAddrSpec=FALSE)
set the value of this url by parsing the given string.
Definition: Url.cpp:218
void setHeaderParameter(const char *name, const char *value)
Set the named header parameter to the given value.
Definition: Url.cpp:869
UtlBoolean getUrlParameter(const char *name, UtlString &value, int index=0)
Get the named URL parameter value.
Definition: Url.cpp:547
void setUrlType(const char *urlProtocol)
Set the URL application layer protocol using the scheme name string.
Definition: Url.cpp:366
void setHostAddress(const char *address)
Set the URL host name or IP address.
Definition: Url.cpp:529
UtlBoolean getFieldParameters(int iMaxReturn, UtlString *pNames, UtlString *pValues, int &iActualReturn)
Gets all of the Header parameters.
Definition: Url.cpp:994
invalid or unset scheme
Definition: Url.h:98
void setDisplayName(const char *displayName)
Set the URL display name.
Definition: Url.cpp:399
void removeHeaderParameter(const char *name)
Removes all of the header parameters with the given name.
Definition: Url.cpp:927
void removeAngleBrackets()
Remove the angle brackets (i.e. <>) from the URL.
Definition: Url.cpp:1080
Definition: NameValuePair.h:35
rtsp: (RFC 2326)
Definition: Url.h:106
UtlBoolean isUserHostEqual(const Url &uri) const
Compare two URLs to see if the have the same user and host.
Definition: Url.cpp:1584
Scheme
Identifiers for all supported URI schemes.
Definition: Url.h:96
UtlString toString() const
Serialize this URL to a string in name-addr format, suitable for use.
Definition: Url.cpp:1085
UtlBoolean getHeaderParameter(const char *name, UtlString &value, int index=0)
Get the named header parameter value.
Definition: Url.cpp:650
static void gen_value_unescape(UtlString &escapedText)
Un-escape a string as a gen_value, which is what field-parameters use for values. ...
Definition: Url.cpp:1695
void getUri(UtlString &Uri)
Gets the serialized URL as a string (with no display name or field parameters)
Definition: Url.cpp:739
sip: (RFC 3261)
Definition: Url.h:99
void getUserId(UtlString &userId) const
Get the URL user identity if present.
Definition: Url.cpp:417
void setUserId(const char *userId)
Set the URL user identity.
Definition: Url.cpp:422
void removeUrlParameter(const char *name)
Removes all of the URL parameters with the given name.
Definition: Url.cpp:723
void removeFieldParameters()
Removes all of the field parameters.
Definition: Url.cpp:1048
void getIdentity(UtlString &identity) const
Construct the cannonical identity.
Definition: Url.cpp:1592
void setFieldParameter(const char *name, const char *value)
Set the named field parameter to the given value.
Definition: Url.cpp:1024
UtlBoolean getHeaderParameters(int iMaxReturn, UtlString *pNames, UtlString *pValues, int &iActualReturn)
Gets all of the Header parameters.
Definition: Url.cpp:680
virtual ~Url()
Destructor.
Definition: Url.cpp:238
ftp: (RFC 1738)
Definition: Url.h:103
void removeUrlParameters()
Removes all of the URL parameters.
Definition: Url.cpp:709
file: (RFC 1738)
Definition: Url.h:104
http: (RFC 2616)
Definition: Url.h:101
Scheme scheme(const UtlString &schemeName)
Translate a scheme string (not including the terminating colon) to a Scheme enum. ...
Definition: Url.cpp:1611
static void gen_value_escape(UtlString &escapedText)
Escape a string as a gen_value, which is what field-parameters use for values.
Definition: Url.cpp:1782
URL parser and constructor.
Definition: Url.h:90
void getHostAddress(UtlString &address) const
Get the URL host name or IP address.
Definition: Url.cpp:454
void setUrlParameter(const char *name, const char *value)
Set the named URL parameter to the given value.
Definition: Url.cpp:626
int getHostPort() const
Get the URL host port.
Definition: Url.cpp:537
void getUrlType(UtlString &urlProtocol) const
Get the URL application layer protocol scheme string.
Definition: Url.cpp:356
sips: (RFC 3261)
Definition: Url.h:100
UtlBoolean getPath(UtlString &path, UtlBoolean getStyle=FALSE)
Get the file path from the URL.
Definition: Url.cpp:482