104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
|
if ((str_c2 = strdup([str cString])) == NULL)
@throw [OFOutOfMemoryException
newWithClass: isa
requestedSize: [str cStringLength]];
str_c = str_c2;
if (!strncmp(str_c, "http://", 7)) {
scheme = @"http";
str_c += 7;
} else if (!strncmp(str_c, "https://", 8)) {
scheme = @"https";
str_c += 8;
} else
@throw [OFInvalidFormatException newWithClass: isa];
|
>
>
>
>
|
|
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
|
if ((str_c2 = strdup([str cString])) == NULL)
@throw [OFOutOfMemoryException
newWithClass: isa
requestedSize: [str cStringLength]];
str_c = str_c2;
if (!strncmp(str_c, "file://", 7)) {
scheme = @"file";
path = [[OFString alloc] initWithCString: str_c + 7];
return self;
} else if (!strncmp(str_c, "http://", 7)) {
scheme = @"http";
str_c += 7;
} else if (!strncmp(str_c, "https://", 8)) {
scheme = @"https";
str_c += 8;
} else
@throw [OFInvalidFormatException newWithClass: isa];
|
479
480
481
482
483
484
485
486
487
488
489
490
491
492
|
}
- (OFString*)description
{
OFMutableString *desc = [OFMutableString stringWithFormat: @"%@://",
scheme];
BOOL needPort = YES;
if (user != nil && password != nil)
[desc appendFormat: @"%@:%@@", user, password];
else if (user != nil)
[desc appendFormat: @"%@@", user];
[desc appendString: host];
|
>
>
>
>
>
|
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
|
}
- (OFString*)description
{
OFMutableString *desc = [OFMutableString stringWithFormat: @"%@://",
scheme];
BOOL needPort = YES;
if ([scheme isEqual: @"file"]) {
[desc appendString: path];
return desc;
}
if (user != nil && password != nil)
[desc appendFormat: @"%@:%@@", user, password];
else if (user != nil)
[desc appendFormat: @"%@@", user];
[desc appendString: host];
|