@@ -28,53 +28,53 @@ #import "OFInvalidFormatException.h" #import "OFOutOfRangeException.h" #import "OFUnsupportedVersionException.h" const char * -of_http_request_method_to_string(of_http_request_method_t method) +OFHTTPRequestMethodName(OFHTTPRequestMethod method) { switch (method) { - case OF_HTTP_REQUEST_METHOD_OPTIONS: + case OFHTTPRequestMethodOptions: return "OPTIONS"; - case OF_HTTP_REQUEST_METHOD_GET: + case OFHTTPRequestMethodGet: return "GET"; - case OF_HTTP_REQUEST_METHOD_HEAD: + case OFHTTPRequestMethodHead: return "HEAD"; - case OF_HTTP_REQUEST_METHOD_POST: + case OFHTTPRequestMethodPost: return "POST"; - case OF_HTTP_REQUEST_METHOD_PUT: + case OFHTTPRequestMethodPut: return "PUT"; - case OF_HTTP_REQUEST_METHOD_DELETE: + case OFHTTPRequestMethodDelete: return "DELETE"; - case OF_HTTP_REQUEST_METHOD_TRACE: + case OFHTTPRequestMethodTrace: return "TRACE"; - case OF_HTTP_REQUEST_METHOD_CONNECT: + case OFHTTPRequestMethodConnect: return "CONNECT"; } return NULL; } -of_http_request_method_t -of_http_request_method_from_string(OFString *string) +OFHTTPRequestMethod +OFHTTPRequestMethodParseName(OFString *string) { if ([string isEqual: @"OPTIONS"]) - return OF_HTTP_REQUEST_METHOD_OPTIONS; + return OFHTTPRequestMethodOptions; if ([string isEqual: @"GET"]) - return OF_HTTP_REQUEST_METHOD_GET; + return OFHTTPRequestMethodGet; if ([string isEqual: @"HEAD"]) - return OF_HTTP_REQUEST_METHOD_HEAD; + return OFHTTPRequestMethodHead; if ([string isEqual: @"POST"]) - return OF_HTTP_REQUEST_METHOD_POST; + return OFHTTPRequestMethodPost; if ([string isEqual: @"PUT"]) - return OF_HTTP_REQUEST_METHOD_PUT; + return OFHTTPRequestMethodPut; if ([string isEqual: @"DELETE"]) - return OF_HTTP_REQUEST_METHOD_DELETE; + return OFHTTPRequestMethodDelete; if ([string isEqual: @"TRACE"]) - return OF_HTTP_REQUEST_METHOD_TRACE; + return OFHTTPRequestMethodTrace; if ([string isEqual: @"CONNECT"]) - return OF_HTTP_REQUEST_METHOD_CONNECT; + return OFHTTPRequestMethodConnect; @throw [OFInvalidArgumentException exception]; } @implementation OFHTTPRequest @@ -92,11 +92,11 @@ - (instancetype)init { self = [super init]; - _method = OF_HTTP_REQUEST_METHOD_GET; + _method = OFHTTPRequestMethodGet; _protocolVersion.major = 1; _protocolVersion.minor = 1; return self; } @@ -200,11 +200,11 @@ OF_HASH_FINALIZE(hash); return hash; } -- (void)setProtocolVersion: (of_http_request_protocol_version_t)protocolVersion +- (void)setProtocolVersion: (OFHTTPRequestProtocolVersion)protocolVersion { if (protocolVersion.major != 1 || protocolVersion.minor > 1) @throw [OFUnsupportedVersionException exceptionWithVersion: [OFString stringWithFormat: @"%hhu.%hhu", protocolVersion.major, @@ -211,21 +211,21 @@ protocolVersion.minor]]; _protocolVersion = protocolVersion; } -- (of_http_request_protocol_version_t)protocolVersion +- (OFHTTPRequestProtocolVersion)protocolVersion { return _protocolVersion; } - (void)setProtocolVersionString: (OFString *)string { void *pool = objc_autoreleasePoolPush(); OFArray *components = [string componentsSeparatedByString: @"."]; unsigned long long major, minor; - of_http_request_protocol_version_t protocolVersion; + OFHTTPRequestProtocolVersion protocolVersion; if (components.count != 2) @throw [OFInvalidFormatException exception]; major = [components.firstObject unsignedLongLongValue]; @@ -250,11 +250,11 @@ } - (OFString *)description { void *pool = objc_autoreleasePoolPush(); - const char *method = of_http_request_method_to_string(_method); + const char *method = OFHTTPRequestMethodName(_method); OFString *indentedHeaders, *remoteAddress, *ret; indentedHeaders = [_headers.description stringByReplacingOccurrencesOfString: @"\n" withString: @"\n\t"];