36 #ifdef R__COMPLETE_MEM_TERMINATION
42 TUrlCleanup(
TObjArray **protocols,
THashList **hosts) : fSpecialProtocols(protocols),fHostFQDNs(hosts) {}
44 if (*fSpecialProtocols) (*fSpecialProtocols)->Delete();
45 delete *fSpecialProtocols;
46 *fSpecialProtocols = 0;
47 if (*fHostFQDNs) (*fHostFQDNs)->Delete();
76 SetUrl(url, defaultIsFile);
78 #ifdef R__COMPLETE_MEM_TERMINATION
79 static TUrlCleanup
cleanup(&fgSpecialProtocols,&fgHostFQDNs);
112 if (!url || !url[0]) {
132 defaultIsFile =
kTRUE;
137 char *u, *u0 =
Strip(url);
152 if (!strncmp(u, s1, l)) {
153 if (
s1(0) ==
'/' &&
s1(l-1) ==
'/') {
164 if (!strncmp(u+l,
"//", 2))
181 if ((s = strstr(u,
":/")) && u+1 != s) {
183 Error(
"TUrl",
"%s malformed, URL must contain \"://\"", u0);
195 char *newu =
new char [strlen(
"file:") + strlen(u0) + 1];
196 sprintf(newu,
"file:%s", u0);
208 if ((s = strchr(t,
'@')) && (
209 ((x = strchr(t,
'/')) && s < x) ||
210 ((x = strchr(t,
'?')) && s < x) ||
211 ((x = strchr(t,
'#')) && s < x) ||
214 if (*(s-1) ==
'\\') {
220 if ((s2 = strchr(u,
':'))) {
238 if ((s = strchr(u,
':')) || (s = strchr(u,
'/')) || (s = strchr(u,
'?')) || (s = strchr(u,
'#'))) {
239 if ((strchr (u,
':') > strchr(u,
'/')) && (strchr (u,
'/')))
253 if ((s = strchr(u,
'/')) || (s = strchr(u,
'?')) || (s = strchr(u,
'#'))) {
289 char *opt = strchr(u,
'?');
290 char *anc = strchr(u,
'#');
293 if (opt && anc && opt > anc) {
298 if ((s = opt) || (s = anc)) {
302 if (stripDoubleSlash)
313 if ((s = strchr(u,
'#'))) {
330 if (stripDoubleSlash)
443 if (!deflt || withDeflt) {
445 sprintf(p,
"%d",
fPort);
521 if (setDefaultPort) {
547 if (
this == obj)
return 0;
592 const char *protos =
gEnv->
GetValue(
"Url.Special",
"file: rfio: hpss: castor: dcache: dcap:");
689 for (
int l = slash-1;
l >=0;
l--) {
virtual const char * GetTitle() const
Returns title of object.
Bool_t HasOption(const char *key) const
Returns true if the given key appears in the URL options list.
static THashList * fgHostFQDNs
void SetProtocol(const char *proto, Bool_t setDefaultPort=kFALSE)
Set protocol and, optionally, change the port accordingly.
Collectable string class.
virtual void Delete(Option_t *option="")
Remove all objects from the array AND delete all heap based objects.
TObject * FindObject(const char *name) const
Find object using its name.
This class represents a WWW compatible URL.
TString & ReplaceAll(const TString &s1, const TString &s2)
virtual void SetOwner(Bool_t enable=kTRUE)
Set whether this collection is the owner (enable==true) of its content.
void SetUrl(const char *url, Bool_t defaultIsFile=kFALSE)
Parse url character string and split in its different subcomponents.
This class represents an Internet Protocol (IP) address.
This class implements a mutex interface.
void Add(TObject *obj)
This function may not be used (but we need to provide it since it is a pure virtual in TCollection)...
Int_t GetEntriesFast() const
const char * GetOptions() const
Bool_t BeginsWith(const char *s, ECaseCompare cmp=kExact) const
TString fHostFQ
file with option and anchor
ClassImp(TUrl) TUrl
Parse url character string and split in its different subcomponents.
THashList implements a hybrid collection class consisting of a hash table and a list to store TObject...
The TNamed class is the base class for all named ROOT classes.
UChar_t mod R__LOCKGUARD2(gSrvAuthenticateMutex)
Int_t GetIntValueFromOptions(const char *key) const
Return a value for a given key from the URL options as an Int_t, a missing key returns -1...
TObject * GetValue(const char *keyname) const
Returns a pointer to the value associated with keyname as name of the key.
TObject & operator=(const TObject &rhs)
TObject assignment operator.
virtual void Error(const char *method, const char *msgfmt,...) const
Issue error message.
virtual TInetAddress GetHostByName(const char *server)
Get Internet Protocol (IP) address of host.
TObject * FindObject(const char *keyname) const
Check if a (key,value) pair exists with keyname as name of the key.
TObject * UncheckedAt(Int_t i) const
virtual void SetOwnerKeyValue(Bool_t ownkeys=kTRUE, Bool_t ownvals=kTRUE)
Set ownership for keys and values.
const char * GetValueFromOptions(const char *key) const
Return a value for a given key from the URL options.
TString GetString() const
Bool_t EndsWith(const char *pat, ECaseCompare cmp=kExact) const
Return true if string ends with the specified string.
R__EXTERN TSystem * gSystem
TUrl & operator=(const TUrl &rhs)
TUrl assignment operator.
virtual Int_t GetValue(const char *name, Int_t dflt)
Returns the integer value for a resource.
char * Strip(const char *str, char c= ' ')
Strip leading and trailing c (blanks by default) from a string.
const char * GetHostFQDN() const
Return fully qualified domain name of url host.
Bool_t TestBit(UInt_t f) const
const char * GetFileAndOptions() const
Return the file and its options (the string specified behind the ?).
Int_t fPort
fully qualified host name
TSubString Strip(EStripType s=kTrailing, char c= ' ') const
Return a substring of self stripped at beginning and/or end.
static TObjArray * GetSpecialProtocols()
Read the list of special protocols from the rootrc files.
TObjArray * Tokenize(const TString &delim) const
This function is used to isolate sequential tokens in a TString.
char * StrDup(const char *str)
Duplicate the string str.
const char * GetUrl(Bool_t withDeflt=kFALSE) const
Return full URL.
TString & Remove(Ssiz_t pos)
virtual const char * GetName() const
Returns name of object.
TMap implements an associative array of (key,value) pairs using a THashTable for efficient retrieval ...
Int_t GetEntries() const
Return the number of objects in array (i.e.
Mother of all ROOT objects.
virtual void Add(TObject *obj)
void Print(Option_t *option="") const
Print URL on stdout.
static TObjArray * fgSpecialProtocols
map containing options key/value pairs
void ParseOptions() const
Parse URL options into a key/value map.
void FindFile(char *u, Bool_t stripDoubleSlash=kTRUE)
Find file and optionally anchor and options.
TObject * At(Int_t idx) const
Ssiz_t Index(const char *pat, Ssiz_t i=0, ECaseCompare cmp=kExact) const
void CleanRelativePath()
Recompute the path removing all relative directory jumps via '..'.
Int_t Compare(const TObject *obj) const
Compare two urls as strings.
int CompareTo(const char *cs, ECaseCompare cmp=kExact) const
Compare a string to char *cs2.