00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017 #import "OFObject.h"
00018
00019 @class OFString;
00020 @class OFDictionary;
00021 @class OFURL;
00022 @class OFHTTPRequestResult;
00023 @class OFDataArray;
00024
00025 typedef enum of_http_request_type_t {
00026 OF_HTTP_REQUEST_TYPE_GET,
00027 OF_HTTP_REQUEST_TYPE_POST,
00028 OF_HTTP_REQUEST_TYPE_HEAD
00029 } of_http_request_type_t;
00030
00034 @interface OFHTTPRequest: OFObject
00035 {
00036 OFURL *URL;
00037 of_http_request_type_t requestType;
00038 OFString *queryString;
00039 OFDictionary *headers;
00040 BOOL redirectsFromHTTPSToHTTPAllowed;
00041 }
00042
00043 #ifdef OF_HAVE_PROPERTIES
00044 @property (copy) OFURL *URL;
00045 @property (assign) of_http_request_type_t requestType;
00046 @property (copy) OFString *queryString;
00047 @property (copy) OFDictionary *headers;
00048 @property (assign) BOOL redirectsFromHTTPSToHTTPAllowed;
00049 #endif
00050
00054 + request;
00055
00060 + requestWithURL: (OFURL*)url;
00061
00068 - initWithURL: (OFURL*)url;
00069
00075 - (void)setURL: (OFURL*)url;
00076
00080 - (OFURL*)URL;
00081
00087 - (void)setRequestType: (of_http_request_type_t)type;
00088
00092 - (of_http_request_type_t)requestType;
00093
00099 - (void)setQueryString: (OFString*)qs;
00100
00104 - (OFString*)queryString;
00105
00111 - (void)setHeaders: (OFDictionary*)headers;
00112
00116 - (OFDictionary*)headers;
00117
00123 - (void)setRedirectsFromHTTPSToHTTPAllowed: (BOOL)allowed;
00124
00128 - (BOOL)redirectsFromHTTPSToHTTPAllowed;
00129
00135 - (OFHTTPRequestResult*)perform;
00136
00145 - (OFHTTPRequestResult*)performWithRedirects: (size_t)redirects;
00146 @end
00147
00151 @interface OFHTTPRequestResult: OFObject
00152 {
00153 short statusCode;
00154 OFDataArray *data;
00155 OFDictionary *headers;
00156 }
00157
00158 #ifdef OF_HAVE_PROPERTIES
00159 @property (readonly) short statusCode;
00160 @property (readonly, copy) OFDictionary *headers;
00161 @property (readonly, retain) OFDataArray *data;
00162 #endif
00163
00165 - initWithStatusCode: (short)status
00166 headers: (OFDictionary*)headers
00167 data: (OFDataArray*)data;
00169
00173 - (short)statusCode;
00174
00178 - (OFDictionary*)headers;
00179
00183 - (OFDataArray*)data;
00184 @end
00185
00186 extern Class of_http_request_tls_socket_class;