@@ -17,11 +17,11 @@ #import "OFSocket.h" #import "OFString.h" OF_ASSUME_NONNULL_BEGIN -@class OFURL; +@class OFURI; @class OFDictionary OF_GENERIC(KeyType, ObjectType); @class OFData; @class OFString; /** @file */ @@ -63,33 +63,41 @@ /** * @class OFHTTPRequest OFHTTPRequest.h ObjFW/OFHTTPRequest.h * * @brief A class for storing HTTP requests. */ +OF_SUBCLASSING_RESTRICTED @interface OFHTTPRequest: OFObject { - OFURL *_URL; + OFURI *_URI; OFHTTPRequestMethod _method; OFHTTPRequestProtocolVersion _protocolVersion; OFDictionary OF_GENERIC(OFString *, OFString *) *_Nullable _headers; OFSocketAddress _remoteAddress; bool _hasRemoteAddress; - OF_RESERVE_IVARS(OFHTTPRequest, 4) } /** - * @brief The URL of the HTTP request. + * @brief The URI of the HTTP request. */ -@property (copy, nonatomic) OFURL *URL; +@property (copy, nonatomic) OFURI *URI; /** * @brief The protocol version of the HTTP request. + * + * @throw OFUnsupportedVersionException The specified version cannot be set + * because it is not supported */ @property (nonatomic) OFHTTPRequestProtocolVersion protocolVersion; /** * @brief The protocol version of the HTTP request as a string. + * + * @throw OFUnsupportedVersionException The specified version cannot be set + * because it is not supported + * @throw OFInvalidFormatException The specified version cannot be set because + * it is not in a valid format */ @property (copy, nonatomic) OFString *protocolVersionString; /** * @brief The request method of the HTTP request. @@ -108,24 +116,24 @@ * @note The setter creates a copy of the remote address. */ @property OF_NULLABLE_PROPERTY (nonatomic) const OFSocketAddress *remoteAddress; /** - * @brief Creates a new OFHTTPRequest with the specified URL. + * @brief Creates a new OFHTTPRequest with the specified URI. * - * @param URL The URL for the request + * @param URI The URI for the request * @return A new, autoreleased OFHTTPRequest */ -+ (instancetype)requestWithURL: (OFURL *)URL; ++ (instancetype)requestWithURI: (OFURI *)URI; /** - * @brief Initializes an already allocated OFHTTPRequest with the specified URL. + * @brief Initializes an already allocated OFHTTPRequest with the specified URI. * - * @param URL The URL for the request + * @param URI The URI for the request * @return An initialized OFHTTPRequest */ -- (instancetype)initWithURL: (OFURL *)URL; +- (instancetype)initWithURI: (OFURI *)URI; - (instancetype)init OF_UNAVAILABLE; @end #ifdef __cplusplus @@ -143,12 +151,14 @@ /** * @brief Returns the request method for the specified string. * * @param string The string for which the request method should be returned * @return The request method for the specified string + * @throw OFInvalidFormatException The specified string is not a valid HTTP + * request method */ extern OFHTTPRequestMethod OFHTTPRequestMethodParseName(OFString *string); #ifdef __cplusplus } #endif OF_ASSUME_NONNULL_END