Differences From Artifact [b38122cc28]:
- File
src/OFHTTPResponse.m
— part of check-in
[b6ee372b98]
at
2020-08-11 19:45:36
on branch trunk
— OFString: Rework number parsing API
This solves the old signed vs. unsigned problem and allows for more
bases than just 8, 10 and 16, as well as auto-detection of the base (if
base is 0). (user: js, size: 8310) [annotate] [blame] [check-ins using] [more...]
To Artifact [4e1a4b346b]:
- File src/OFHTTPResponse.m — part of check-in [ac004e624d] at 2020-10-10 21:54:38 on branch trunk — More type cleanups (user: js, size: 8331) [annotate] [blame] [check-ins using] [more...]
| ︙ | ︙ | |||
251 252 253 254 255 256 257 |
[super dealloc];
}
- (void)setProtocolVersion: (of_http_request_protocol_version_t)protocolVersion
{
if (protocolVersion.major != 1 || protocolVersion.minor > 1)
@throw [OFUnsupportedVersionException exceptionWithVersion:
| | | 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 |
[super dealloc];
}
- (void)setProtocolVersion: (of_http_request_protocol_version_t)protocolVersion
{
if (protocolVersion.major != 1 || protocolVersion.minor > 1)
@throw [OFUnsupportedVersionException exceptionWithVersion:
[OFString stringWithFormat: @"%hhu.%hhu",
protocolVersion.major,
protocolVersion.minor]];
_protocolVersion = protocolVersion;
}
- (of_http_request_protocol_version_t)protocolVersion
|
| ︙ | ︙ | |||
276 277 278 279 280 281 282 | if (components.count != 2) @throw [OFInvalidFormatException exception]; major = [components.firstObject unsignedLongLongValue]; minor = [components.lastObject unsignedLongLongValue]; | | | | | | 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 |
if (components.count != 2)
@throw [OFInvalidFormatException exception];
major = [components.firstObject unsignedLongLongValue];
minor = [components.lastObject unsignedLongLongValue];
if (major > UCHAR_MAX || minor > UCHAR_MAX)
@throw [OFOutOfRangeException exception];
protocolVersion.major = (unsigned char)major;
protocolVersion.minor = (unsigned char)minor;
self.protocolVersion = protocolVersion;
objc_autoreleasePoolPop(pool);
}
- (OFString *)protocolVersionString
{
return [OFString stringWithFormat: @"%hhu.%hhu",
_protocolVersion.major,
_protocolVersion.minor];
}
- (OFString *)string
{
return [self stringWithEncoding: OF_STRING_ENCODING_AUTODETECT];
|
| ︙ | ︙ | |||
346 347 348 349 350 351 352 | indentedHeaders = [_headers.description stringByReplacingOccurrencesOfString: @"\n" withString: @"\n\t"]; ret = [[OFString alloc] initWithFormat: @"<%@:\n" | | | 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 | indentedHeaders = [_headers.description stringByReplacingOccurrencesOfString: @"\n" withString: @"\n\t"]; ret = [[OFString alloc] initWithFormat: @"<%@:\n" @"\tStatus code = %hd\n" @"\tHeaders = %@\n" @">", self.class, _statusCode, indentedHeaders]; objc_autoreleasePoolPop(pool); return [ret autorelease]; } @end |