ObjFW  Check-in [020cedb44b]

Overview
Comment:Make creating OFHTTPRequestResults public.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA3-256: 020cedb44bacebfe19b2f3813c84f08f0db183630ef7bf55d5136a5bebb7589d
User & Date: js on 2012-12-11 12:12:22
Other Links: manifest | tags
Context
2012-12-11
12:12
OFTCPSocket: Use a backlog of SOMAXCONN. check-in: d39260c358 user: js tags: trunk
12:12
Make creating OFHTTPRequestResults public. check-in: 020cedb44b user: js tags: trunk
11:54
Coding style. check-in: e2877b3d28 user: js tags: trunk
Changes

Modified src/OFHTTPClient.m from [f50e1c393f] to [0b0b833434].

467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
	if (status == 200 && contentLengthHeader != nil &&
	    contentLength != bytesReceived)
		@throw [OFTruncatedDataException
		    exceptionWithClass: [self class]];

	[serverHeaders makeImmutable];

	result = [[OFHTTPRequestResult alloc]
	    OF_initWithStatusCode: status
			  headers: serverHeaders
			     data: data];

	objc_autoreleasePoolPop(pool);

	[result autorelease];

	if (status != 200)
		@throw [OFHTTPRequestFailedException







|
<
|
|







467
468
469
470
471
472
473
474

475
476
477
478
479
480
481
482
483
	if (status == 200 && contentLengthHeader != nil &&
	    contentLength != bytesReceived)
		@throw [OFTruncatedDataException
		    exceptionWithClass: [self class]];

	[serverHeaders makeImmutable];

	result = [[OFHTTPRequestResult alloc] initWithStatusCode: status

							 headers: serverHeaders
							    data: data];

	objc_autoreleasePoolPop(pool);

	[result autorelease];

	if (status != 200)
		@throw [OFHTTPRequestFailedException

Modified src/OFHTTPRequest.h from [a7837b8f3d] to [f5735e078a].

153
154
155
156
157
158
159




















160
161
162
163
164
165
166
167
168
169

#ifdef OF_HAVE_PROPERTIES
@property (readonly) short statusCode;
@property (readonly, copy) OFDictionary *headers;
@property (readonly, retain) OFDataArray *data;
#endif





















- OF_initWithStatusCode: (short)status
		headers: (OFDictionary*)headers
		   data: (OFDataArray*)data;

/*!
 * @brief Returns the state code of the result of the HTTP request.
 *
 * @return The status code of the result of the HTTP request
 */
- (short)statusCode;







>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
|
|
|







153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189

#ifdef OF_HAVE_PROPERTIES
@property (readonly) short statusCode;
@property (readonly, copy) OFDictionary *headers;
@property (readonly, retain) OFDataArray *data;
#endif

/*!
 * @brief Creates a new OFHTTPRequestResult.
 *
 * @param status The HTTP status code replied to the request
 * @param headers The headers replied to the request
 * @param data The data replied to the request
 * @return A new OFHTTPRequestResult
 */
+ resultWithStatusCode: (short)status
	       headers: (OFDictionary*)headers
		  data: (OFDataArray*)data;

/*!
 * @brief Initializes an already allocated OFHTTPRequestResult.
 *
 * @param status The HTTP status code replied to the request
 * @param headers The headers replied to the request
 * @param data The data replied to the request
 * @return An initialized OFHTTPRequestResult
 */
- initWithStatusCode: (short)status
	     headers: (OFDictionary*)headers
		data: (OFDataArray*)data;

/*!
 * @brief Returns the state code of the result of the HTTP request.
 *
 * @return The status code of the result of the HTTP request
 */
- (short)statusCode;

Modified src/OFHTTPRequest.m from [3e1f9b1751] to [af5623a848].

116
117
118
119
120
121
122









123
124
125
126
127
128
129
130
131
132
- (OFString*)MIMEType
{
	OF_GETTER(MIMEType, YES)
}
@end

@implementation OFHTTPRequestResult









- OF_initWithStatusCode: (short)status
		headers: (OFDictionary*)headers_
		   data: (OFDataArray*)data_
{
	self = [super init];

	statusCode = status;
	data = [data_ retain];
	headers = [headers_ copy];








>
>
>
>
>
>
>
>
>
|
|
|







116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
- (OFString*)MIMEType
{
	OF_GETTER(MIMEType, YES)
}
@end

@implementation OFHTTPRequestResult
+ resultWithStatusCode: (short)status
	       headers: (OFDictionary*)headers
		  data: (OFDataArray*)data
{
	return [[[self alloc] initWithStatusCode: status
					 headers: headers
					    data: data] autorelease];
}

- initWithStatusCode: (short)status
	     headers: (OFDictionary*)headers_
		data: (OFDataArray*)data_
{
	self = [super init];

	statusCode = status;
	data = [data_ retain];
	headers = [headers_ copy];